Oftentimes, when creating Node.js applications from scratch, we were worried about a few things:
- We had no sample app skeleton to start from.
- There were no standardised conventions.
- As a result of the above, we used different packages and plugins each time.
Because of that, we decided to create ng-node-starter-app, our own Node.js starter app. This app has a clearly designed file structure that helps us build beautiful, fully-working and well-documented APIs based on our own conventions. The app makes use of the most popular Node.js packages:
- Express.js: a fast and minimalistic web framework for Node.js, which defines our app structure and helps us build APIs adjusted to our needs.
- Passport.js: the most famous authentication middleware for Node, with a very easy integration with Express. It’s flexible, modular and contains over 300 authentication strategies to date (Facebook, Twitter, etc.).
- Sequelize: a very popular ORM that supports multiple database dialects such as PostgreSQL, MySQL and more. It allows us to create models, their attributes and custom validations. We can also use it to make advanced queries through the database. Sequelize also has a beautiful CLI – it’s very similar to the one in Ruby on Rails.
- Swagger: a package for designing and documenting RESTful APIs. It generates beautiful documentation for us.
- Bunyan: we use it to log incoming requests in a detailed and beautiful way. It saves logs to files for us. Each day’s log is a different file, which makes it really easy to retrieve the necessary data from the past.
- Dotenv: a very popular package for storing environment variables.
That’s it! Please let us know in the comments if you have a better way to start your Node.js projects. Please contribute and give us a :star: if you find it useful!