# Nest JS with 12 Factor App

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/")[](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](https://en.wikipedia.org/wiki/Twelve-Factor_App_methodology)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1720179563364/91739b73-6e28-454e-a21f-357fa6557ea4.png)

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")[](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](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

<iframe src="https://www.youtube.com/embed/kROllv22WHw?list=PLIGDNOJWiL18srI6BmFLfwDPvorTmyQ_c" width="700" height="393" frameborder="0" scrolling="no"></iframe>

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