Bulletproof Nodejs

Implementation of a bulletproof node.js API 🛡️
Alternatives To Bulletproof Nodejs
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
4 days ago64cc-by-sa-4.0Dockerfile
:white_check_mark: The Node.js best practices list (July 2023)
Express61,9971,122,97897,519a day ago300October 08, 2022186mitJavaScript
Fast, unopinionated, minimalist web framework for node.
Fiber28,5881,16912 hours ago288July 16, 202361mitGo
⚡️ Express inspired web framework written in Go
Javascript Testing Best Practices21,983
2 months ago61mitJavaScript
📗🌐 🚢 Comprehensive and exhaustive JavaScript & Node.js testing best practices (July 2023)
Passport21,79781,2724,38914 days ago32May 20, 2022375mitJavaScript
Simple, unobtrusive authentication for Node.js.
Parse Server20,4021,140973 days ago315July 30, 2023453apache-2.0JavaScript
Parse Server for Node.js / Express
N Blog15,244
5 months ago25JavaScript
《一起学 Node.js》
Apollo Server13,4971,5898632 days ago317March 02, 202362mitTypeScript
🌍  Spec-compliant and production ready JavaScript GraphQL server that lets you develop in a schema-first way. Built for Express, Connect, Hapi, Koa, and more.
Payload12,2925838 hours ago376July 31, 202389mitTypeScript
The best way to build a modern backend + admin UI. No black magic, all TypeScript, and fully open-source, Payload is both an app framework and a headless CMS.
a day ago50otherTypeScript
🔮 Graphile's Crystal Monorepo; home to Grafast, PostGraphile, pg-introspection, pg-sql2 and much more!
Alternatives To Bulletproof Nodejs
Select To Compare

Alternative Project Comparisons

Bulletproof Node.js architecture 🛡️

This is the example repository from the blog post 'Bulletproof node.js project architecture'

Please read the blog post in order to have a good understanding of the server architecture.

Also, I added lots of comments to the code that are not in the blog post, because they explain the implementation and the reason behind the choices of libraries and some personal opinions and some bad jokes.

The API by itself doesn't do anything fancy, it's just a user CRUD with authentication capabilities. Maybe we can transform this into something useful, a more advanced example, just open an issue and let's discuss the future of the repo.


We use node version 14.9.0

nvm install 14.9.0
nvm use 14.9.0

The first time, you will need to run

npm install

Then just start the server with

npm run start

It uses nodemon for livereloading :peace-fingers:

Online one-click setup

You can use Gitpod for the one click online setup. With a single click it will launch a workspace and automatically:

  • clone the bulletproof-nodejs repo.
  • install the dependencies.
  • run cp .env.example .env.
  • run npm run start.

Open in Gitpod

API Validation

By using celebrate, the req.body schema becomes cleary defined at route level, so even frontend devs can read what an API endpoint expects without needing to write documentation that can get outdated quickly.

   body: Joi.object({
     name: Joi.string().required(),
     email: Joi.string().required(),
     password: Joi.string().required(),

Example error

 "errors": {
   "message": "child \"email\" fails because [\"email\" is required]"

Read more about celebrate here and the Joi validation API


  • [x] API Validation layer (Celebrate+Joi)
  • [ ] Unit tests examples
  • [ ] Cluster mode
  • [x] The logging 'layer'
  • [ ] Add agenda dashboard
  • [x] Continuous integration with CircleCI 😍
  • [ ] Deploys script and docs for AWS Elastic Beanstalk and Heroku
  • [ ] Integration test with newman 😉
  • [ ] Instructions on typescript debugging with VSCode

API Documentation

To simplify documenting your API, we have included Optic. To use it, you will need to install the CLI tool, and then you can use api exec "npm start" to start capturing your endpoints as you create them. Once you want to review and add them to your API specification run: api status -- review.


Where should I put the FrontEnd code? Is this a good backend for Angular or React or Vue or whatever ?

It's not a good idea to have node.js serving static assets a.k.a the frontend

Also, I don't wanna take part in frontend frameworks wars 😅

Just use the frontend framework you like the most or hate the least. It will work 😁

Don't you think you can add X layer to do Y? Why do you still use express if the Serverless Framework is better and it's more reliable?

I know this is not a perfect architecture but it's the most scalable that I know with less code and headache that I know.

It's meant for small startups or one-developer army projects.

I know if you start moving layers into another technology, you will end up with your business/domain logic into npm packages, your routing layer will be pure AWS Lambda functions and your data layer a combination of DynamoDB, Redis, maybe redshift, and Agolia.

Take a deep breath and go slowly, let the business grow and then scale up your product. You will need a team and talented developers anyway.

Popular Nodejs Projects
Popular Express Projects
Popular Runtime Environments Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.