What is a good Node.js Template in 2022

  • Uses yarn
  • Organize code structure with Clean Architecturef
  • Demonstrates the twelve-factor methodology
  • ES2017 latest features like Async/Await
  • Watch code changes and restart for development using nodemon
    • yarn add nodemon --dev
  • Load environment variables from .env files with dotenv
  • Web framework using Express with middlewares as follows
    • yarn add express
    • Support CORS with express middleware cors
    • Gzip compression with express middleware compression
    • Parsing cookies with express middleware cookie-parser
      • yarn add cookie-parser
    • Customize request logs with express middleware morgan, which can be integrated with Winston.
    • Set some HTTP headers for security with helmet
      • yarn add helmet
      • import helmet from 'helmet';
      • const app = express();
      • app.use(helmet());
  • Request validation with joi
  • Authentication and Authorization with Passport
    • yarn add passport
  • MongoDB Modeling Lib with Mongoose
    • yarn add mongoose
  • Support pagination with Mongoose-aggregate-paginate-v2
    • yarn add mongoose-aggregate-paginate-v2
  • Deal with Date Object with Day.js
  • Git hooks with husky
  • Linting with ESLint
  • Format with Prettier
  • Consistent coding styles with EditorConfig
  • Tests with mocha, chai and sinon
  • Code coverage with Istanbul and coveralls
  • Continuous integration support with Travis CI
  • Docker support
  • Monitoring with pm2
  • Logging system using Winston
    • yarn add winston
    • With Winston, you can have multiple transports configured at different levels.
  • API documentation generation with apidoc
  • Image uploading with AWS S3 Client
  • Email sending by using SendGrid and AWS SES
  • SMS sending by using Twilio
  • Multilanguage Support using i18n