If you work across a variety of projects, remembering local server boot commands and ENV settings can be tedious. Even if you don’t, who wants to type rails s multiple times every day? Maybe you already have shell commands in place, but are they standardized and aliased so just two letters will boot any project? Here’s my setup:

Alias

~/aliases.local

alias sr='server'

Node Example

{PROJECT_ROOT}/bin/server

#!/bin/sh
PORT=3001 nodemon app.js

Rails Example

{PROJECT_ROOT}/bin/server

#!/bin/sh
rails s

Jekyll Example

{PROJECT_ROOT}/bin/server

#!/bin/sh
bundle exec jekyll serve

Perl Example

{PROJECT_ROOT}/bin/server

#!/bin/sh
perl -d script/server.pl

Path

If this is your own machine (not a shared host), you can add the local bin directory to your path:

export PATH="./bin:$PATH"

If it is a shared host, do something more like this (more detail here):

export PATH="$PWD/bin:$PATH"
hash -r 2>/dev/null || true

Then just cd into any project and initiate the server with sr, it doesn’t get much easier than that. I originally mentioned this in my screencast about speeding up your development process, give it a look!