Skip to content

emirpasic/qam

Folders and files

NameName
Last commit message
Last commit date
Mar 11, 2017
Mar 10, 2017
Mar 10, 2017
Mar 12, 2017
Mar 11, 2017
Mar 11, 2017
Mar 9, 2017
Mar 11, 2017
Mar 10, 2017
Mar 7, 2017
Mar 13, 2017
Mar 13, 2017
Mar 12, 2017
Mar 13, 2017
Nov 2, 2019

Repository files navigation

qam logo

Node.js Web Application Boilerplate.

Quick-start your backend and frontend with this boilerplate.

Features

  • 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

Getting started

  • Install Node.js v6
  • Install yarn: npm install -g yarn
  • Install dependencies: yarn
  • Install gulp: npm install -g gulp

Running in development

Running in production

  • Compile your assets: gulp jsx:compile && gulp less:compile
  • Start server: NODE_ENV=production node app.js

Directory structure

  • 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

Technology stack (reasoning)

  • 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)