How to Start a New Project in Node.js

Photo of Justyn Jóźwiak

Justyn Jóźwiak

Updated Feb 8, 2024 • 4 min read

In Netguru, we like to work with different technologies to create advanced web applications. This time, we would like to put the spotlight on Node.js, a JavaScript runtime that our apps use as backend. It proved to be an efficient solution for real-time applications or the cases when a fast and scalable environment was required.

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!

Photo of Justyn Jóźwiak

More posts by this author

Justyn Jóźwiak

As a student of electronics, Justyn had an opportunity to try almost every possible kind of...

We're Netguru!

At Netguru we specialize in designing, building, shipping and scaling beautiful, usable products with blazing-fast efficiency
Let's talk business!

Trusted by: