This project is an express.js boilerplate with the best folder structure practice and oauth2 login, registration flow along with the basic security standard and sonarqube(sonarLint).
- Part1 : https://blog.erronak.com/nodejs/node-js-modular-folder-structure-and-best-coding-practice-overview-part-1/
- Part 2 : https://blog.erronak.com/nodejs/node-js-modular-folder-structure-and-best-coding-practice-part-2-reusable-components/
I am open to your suggestion, as I can see the following TODO should be next to complete the full project.
| #Name | #Description |
|---|---|
| Scope | oAuth2 contain a scope property, to restrict some resources, just like user roles |
| Client cors | I think we should add a field called "access_domains", we will compare the received request domain source. |
| Cache user | We can save DB time by cache user query |
| Socket.io | Active User list, Chat, Reply |
| #Name | #Reason |
|---|---|
| Node.js | |
| Express.js | |
| Typescript | |
| Passport | for the OAuth purpose |
| Oauth 2 |
| #Name | #Description |
|---|---|
| Node.js | |
| npm | |
| Mongo DB |
**Please make a sure you have created .env, .env.developer .env.production file successfully.You can copy keys from .env.example **
$ npm i$ npm run start:dev //in the case of developer ".env.developer is required"
$ npm run clean #Will remove js compiled folder ./dist
$ npm run build //Build project
$ npm run start:prod //Without developer ".env.production is required"
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod$ npm run test:unit
$ npm run test:unit:debug #Use to insight and debug clearly.
$ npm run test:integration
$ npm run test:integration:debug #Use to insight and debug clearly.