Maintainer: Rui Ferrão
Extremely opinionated Hapi boilerplate using a layered architecture for proper separation of concerns
WARNING: Noire is currently under active development and might not be ready for heavy production use
- Map routes
- Extract route parameters
- Kick off some work
- Send the result back to the client
- Perform work for the Controller
- Return the result for the Controller
- Repository pattern for data entities
- Thin models
- ORM with transactional capabilities
- HTTP and HTTPS support
- Automated API documentation generation
- Stateless JWT auth for API endpoints
- RBAC authorization
- Email sending using handlebars templates
- Fast and flexible logging (Pino)
- Testing, code coverage and Travis CI integration
- Graceful server shutdown
- Database ORM (Objection) with migrations (Knex) support
- Usage of native Promises and async/await
git clone git@github.com:academia-de-codigo/noire-server.git
npm install
Edit all lib/config* files
NODE_ENVshould be set to eitherdevelopment,stagingorproduction. If not set at all, defaults todevelopmentJWT_SECRETshould contain a secret which will be used to sign authentication tokens. A safe randomly generated secret can be obtained by runningnpm run secret.- SMTP credentials should be configured using the
SMTP_USERandSMTP_PASSenvironment variables - Staging and Production environment need the
DB_HOSTT,DB_NAME,DB_USERandDB_PASSenvironment variables for configuration the database connection - All environment variables can be setup inside a
.envfile which should not be commited and is sourced when the server starts. A sampleexample.envfile is provided.
npm run reset
npm test
- Make sure
NODE_ENV=production - Start the server with
npm start
- Set
NODE_ENV=development - Start the server in watch mode with
npm run watch
Noire is developed using Vim and/or Visual Studio Code. With VSCode the following plugins are used:
- Babel ES6/ES7
- Document This
- DotENV
- EditorConfig for VS Code
- ESLint
- HTMLHint
- Node.js Modules Intellisense
- npm
- Path Autocomplete
- Prettier
For proper code formatting and module intellisense under VSCode, the following settings are recommended:
"settings": {
"editor.formatOnSave": true,
"node-module-intellisense.scanBuiltinModules": true,
"node-module-intellisense.scanDevDependencies": true,
"node-module-intellisense.scanFileModules": true,
"node-module-intellisense.modulePaths": [
"lib"
],
"node-module-intellisense.autoStripExtensions": [
".js"
]
}