Skip to content

nexckycort/backend-architecture-nodejs

Repository files navigation

Backend Architecture Nodejs

Statements Branches Functions Lines
Statements Branches Functions Lines

The folder structure 🏒

β”œβ”€β”€β”€src
β”‚       app.ts          # App entry point
β”‚   β”œβ”€β”€β”€api             # Express route controllers and middleware for all the endpoints of the app
β”‚   β”œβ”€β”€β”€config          # Environment variables and configuration related stuff
β”‚   β”œβ”€β”€β”€handlers        # Handlers
β”‚   β”œβ”€β”€β”€helpers         # Helper methods
β”‚   β”œβ”€β”€β”€interfaces      # interfaces
β”‚   β”œβ”€β”€β”€jobs            # jobs
β”‚   β”œβ”€β”€β”€loaders         # Split the startup process into modules
β”‚   β”œβ”€β”€β”€models          # data access layer
β”‚   └───services        # All the business logic is here
β”œβ”€β”€β”€.editorconfig       # Editorconfig setup
β”œβ”€β”€β”€.env                # Environment variables
β”œβ”€β”€β”€.eslintignore       # To ignore some folder
β”œβ”€β”€β”€.eslintrc           # Eslint setup
β”œβ”€β”€β”€.huskyrc.json       # Husky setup
β”œβ”€β”€β”€.lintstagedrc.json  # lint-staged setup
β”œβ”€β”€β”€.nvmrc              # Version nodejs
β”œβ”€β”€β”€.prettierrc         # Prettier setup
β”œβ”€β”€β”€.jest.config.ts     # Jest setup
β”œβ”€β”€β”€tsconfig.json       # TypeScript setup
└───webpack.config.ts   # Webpack setup

Layer architecture

layer architecture

Raise the server, being at the root of the project

npm run dev for a development environment

npm run build prepare the project for a production environment

npm start for a production environment