This is a simple and scalable Node.js backend template designed to kickstart your project. It includes basic setup and common middleware, written in TypeScript.
- Basic Express server setup
- Environment variable configuration
- Essential middleware integration (e.g., compression, cors, helmet, morgan)
- TypeScript support
- Jest for testing
- Prettier for code formatting
- Structured folder layout for scalability
- Node.js (v14 or higher recommended)
- npm
-
Clone the repository:
git clone https://github.com/mdkaifansari04/NODE_BACKEND_TEMPLATE.git
-
Navigate to the project directory:
cd your-repo-name
-
Install dependencies:
npm install
npm run dev
npm start
The server will be running at: http://localhost:5000
To run tests:
npm test
To run tests in watch mode:
npm run test:watch
To check test coverage:
npm run test:coverage
To format the code with Prettier:
npm run format
your-repo-name/
├── node_modules/
├── src/
│ ├── api/
│ │ └── v1/
│ │ ├── controllers/
│ │ ├── models/
│ │ └── routes/
│ ├── helpers/
│ ├── middleware/
│ ├── types/
│ ├── validation/
│ └── app.ts
├── .env
├── .gitignore
├── jest.config.js
├── package.json
├── tsconfig.json
├── README.md
└── ... (additional files)
Contributions are welcome! Please fork the repository and create a pull request.
This project is licensed under the ISC License.