Boilerplate for node API with good architecture and principals require package (Express, mongoose, passport, eslint-airbnb, helmet, cookie parser, babel) made with ES6 (still with CommonJS, waiting for node native support).
=> Install, Run, npm scripts ...
-
Add first packages (eslint, babelrc, gitignore)
-
Add config files
-
Configure Express
-
Create Architecture (components, routes, models ...)
-
Add dotenv
-
Create Module User
-
Configure mongoose
-
Add Forest
-
Add Morgan
-
Add Passport JWT
-
Add Passport Facebook
-
Add cookie parser
-
Add CORS
-
Add Winston with Loggly
-
Add Helmet
-
Add Ngnix reverse proxy
-
Rate limits
-
Reset System
-
JWT
-
Add Flow
-
Create Test with Jest
-
Package the app (pkg)
-
Ajouter webpack ou parcel
-
Make a clear documentation\
-
Explain all modules / make a clean readme
Remind :
Each new module (schema) created verify authentification need. ncu (update version packages)
You need to have mongoDB, redis-server, npm, installed and configured in your computer.
To use this project, at the very first begining, Clone this repository (zip or git clone).
Next, you have to configure dotenv, with dotenv file (.env) at the root directory.
//.env
DOTENV FILE
Eventually, you can create a directory with a .env file for production, stagging, local, etc. But never commit it.
Then, you need to create few accounts to use the same components and the current config. You need a (loggly account)[https://www.loggly.com/], a mongoDB provider like (mongoDB cloud)[https://www.mongodb.com/] or (mLab)[https://mlab.com/], a (forestAdmin account)[https://app.forestadmin.com/]. Feel free to remove any dependencies you don't need.
You can complete all the needed env variables.
It's time to install dependecies
yarn | npm i
Just run yarn dev or npm run dev for dev environnement
For Production environnement it will be yarn start | npm run start
dotenv
logger
Norme route api logger description retour api (message, error, data)
rateLIMIT redis
deploiement Heroku / now