Skip to main content

Command Palette

Search for a command to run...

Nest JS with 12 Factor App

Published
2 min readView as Markdown
Nest JS with 12 Factor App
T

I'm a full-stack software developer creating open-source projects and writing about modern JavaScript client-side and server-side. Working remotely from India.

Guys Recently I have created a playlist on youTube explaining things about Nest JS Microservices and how to add 12 factor principles in this microservice

Let's Talk about this a bit More

12 Factor App

[The Twelve-Factor App
In the modern era, the software is commonly delivered as a service: called web apps, or software-as-a-service.12factor.net](https://12factor.net/ "https://12factor.net/")

The Twelve-Factor App methodology is a methodology for building [software-as-a-service](https://en.wikipedia.org/wiki/Software_as_a_service "Software as a service") applications. These best practices are designed to enable applications to be built with portability and resilience when deployed to [the web](https://en.wikipedia.org/wiki/The_web "The web")

https://en.wikipedia.org/wiki/Twelve-Factor_App_methodology

I have created this playlist to cover all these aspects by showing how all these can be applied to a simple nestjs service.

We started with basic nestjs app and setting up all different aspect of a clean microservice

  • like linting
  • test setup using jest for e2e and unit tests
  • CI/CD setup for app deployment
  • build and Migration script
  • Modular structure for application modules
  • health checks and application monitoring with security modules

[GitHub - tkssharma/12-factor-app-microservices: 12 factor principles using nestjs
NestJS framework starter repository. This app demonstrates the twelve-factor methodology in Node.js on cloud.gov. The…github.com](https://github.com/tkssharma/12-factor-app-microservices "https://github.com/tkssharma/12-factor-app-microservices")

Baseline template
https://github.com/tkssharma/12-factor-app-microservices/tree/master/nestjs-typeorm-postgres-baseline%20%2301

The twelve-factor methodology is not specific to Node.js and much of these tips are already general enough for any cloud.gov application.

  • Pin Down NPM Package Versions with Yarn.lock
  • Use Git Flow as a Reliable Version Control Model
  • Manage Configuration Values with Environment Variables
  • Build, Release and Run Containers with Docker Compose
  • Run Stateless Docker Containers
  • Export Services with Docker Port Binding
  • Scale Docker Horizontally with Nginx Load Balancing
  • Ensure Containers Run with High-Availability
  • Run Consistent Dev, Stage & Prod Docker Environments
  • Pipe Log Output to STDOUT with Docker

Please let me know if this helped in building microservices using all these 12 factors.

1 views

More from this blog

C

Code with tkssharma || blogs for developers

349 posts

I’m Tarun, I am Publisher, Trainer Developer, working on Enterprise and open source Technologies JavaScript frameworks