Node.js Web Application Boilerplate.
Quick-start your backend and frontend with this boilerplate.
- Start the Node.js express server in single process or multi process mode
- Compile and bundle frontend Javascript (ECMAScript 6)
- Compile and bundle frontend CSS from LESS
- Logging
- Configurations
- Error handling
- CORS
- Automatic server restart and compilations during development
- Install Node.js v6
- Install yarn:
npm install -g yarn
- Install dependencies:
yarn
- Install gulp:
npm install -g gulp
- From shell:
NODE_ENV=local gulp
- From WebStorm follow these settings
- Compile your assets:
gulp jsx:compile && gulp less:compile
- Start server:
NODE_ENV=production node app.js
- assets private assets
- jsx frontend javascript that will be compiled
- less less files
- config configurations
- config.js main configuration file
- middleware express middleware
- public public assets
- css compiled css files
- js compiled frontend javascript
- routes all routes
- routes.js entry point for all routes
- util utility and helper functions
- views ejs files and templates
- app.js entry point of the application server
- gulpfile.js various gulp tasks
- Node.js v6 (fast and battle-tested process based async architecture, ECMAScript 6)
- Server side ECMAScript 6 (arrow functions, classes, template strings, spread, etc.)
- yarn as packaging manager (faster and safer than npm and removes the need for shrinkwrap)
- Express as web application framework (popular, fast, unopinionated, minimalist)
- Node.js native cluster (more processes for more throughput)
- Logging with winston and winston-express
- Configurations simply though Javascript
- Routing natively with Express.Router (simple, thus fast)
- EJS for templates
- LESS for CSS (less is more)
- Partial templates with EJS (simple and no magic from using other libraries)
- Frontend side Javascript (ECMAScript 6) compilation and injection with babel and browserify
- Watchers for automatic frontend Javascript builds in development
- Watchers for automatic LESS compilations in development
- Watchers for automatic server restarts in development with nodemon
- Caching (Nginx reverse proxy cache, S3, Memcached or files)
- ESLint (linting for better code readability)