Skip to content

lazav94/node-starter

Repository files navigation

🍏 Node.js

Markdown Monster icon

📔 Most used Node.js modules

  • express
  • dotenv
  • path
  • fs
  • axios / request-native-promise
  • moment
  • body-parser
  • cron
  • lodash
  • validator
  • nodemailer

  • mongoose
  • connect-mongo
  • express-session
  • bcrypt [Check if it's depricated]
  • cookieParser
  • jsonwebtoken
  • passport/passport-facebook/passport-jwt/passport-local
  • cors / helmet

📽 Project Arhitecture

🌲 Structure of a project

├─ 📁 .vscode           [optional]
|   ├─ 📜 settings.json [optional]
|   └─ 📜 launch.json   [optional]
|
├─ 📁 node_modules (auto-generate)
|
├─ 📁 server
|   ├─ 📁 api
|   |   ├─ 📁 user
|   |   |   ├─ 📜 ❔ index.js
|   |   |   ├─ 📜 user.routes.js
|   |   |   ├─ 📜 user.model.js
|   |   |   ├─ 📜 user.controller.js
|   |   |   └─ 📜 user.service.js
|   |   └── ...
|   |
|   ├─ 📜 server.js
|   ├─ 📜 router.js
|   └──📁 services
|       ├─ 📜 logger.js
|       ├─ 📜 dbconfig.js
|       └─ 📜 [mostly singleton modules, services, mailer, middleware, varibales]
|
|
├─📁 public
|   ├─📁 views [.ejs, .html, .pug...]
|   ├─📁 scripts [frontend javascript files .js ]
|   ├─📁 stylesheets [.css, less. cess...]
|   ├─📁 images
|   └─📁 assets [optional][media: files, audio, video...]
|
├─ 📜 .eslintrc.json / .eslintrc.js
├─ 📜 .package.json
├─ 📜 .package-lock.json (auto-generate)
├─ 📜 .gitignore
├─ 📜 .env (.staging.env && .production.env)
├─ 📜 Procfile (if you are deploying on heroku)
└─ 📜 README.md

🖥 About arhitecture

api/<something>

  • <something>.routes.js - routers
  • <something>.model.js - DB collection
  • <something>.controller.js - logic
  • <something>.services.js - queries

🗯 Documentation comments

/**
*@description
*@return
*@params
*/
const functionName = [async]() => { };

🔥Swagger

Swagger configuration is in the server/services/swagger folder All documentation will be parsed from server/services/swagger/docs and name must finished with .swagger.js

📁 Logger

Currently in logger.js I use winston logger

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published