Hyper portable and lean Javascript web application boilerplate.
dat stack tho
- NodeJS
- Automated unit testing
- Code-based database migrations for MySQL, PostgreSQL, and sqlite3
- Frontend app built with Browserify, Grunt, and Bower
- Share code between the server and client
- Works out of the box for Heroku
Install dependencies (and implicitly run build
and migrate
):
$ npm install
Build the client application (check out Gruntfile.js
for options):
$ npm run build
Run database migrations (if there are any, run via db-migrate):
$ npm run migrate
Run tests (if there are any, run via tape):
$ npm test
Start the server app:
$ npm start
app/client/main.js
Client applicationapp/server/main.js
Server applicationdatabase.json
Database credentialsdist/client/
Compiled output directory for client apppublic/
Web rootstyle/style.less
Style sheet basetest/*.js
Unit tests
Migrations are handled via
db-migrate, which has support
for PostgreSQL, MySQL, and sqlite3. The migrate
script is only run if there
is a database.json
present in the root of the repo.
Protip: Create a ./database.json
file to ensure the database
credentials are correct (see the db-migrate docs for format details).
It's probably a good idea to source this file in the server code so database credentials comes from one place.
When pushing to a Heroku remote, the client application will automatically be built and all database migrations will be run.
Using the heroku-toolbelt from the command line:
$ git clone https://github.com/bvalosek/datstack.git
$ cd datstack
$ heroku create
$ git push heroku master
$ heroku open