Nodedash: A Simple and Scalable Node.js Backend Template
We love building backend applications in TypeScript with Node.js, leveraging features like rate limiting, fast response times, ESLint support, and a well-structured folder layout.
Why Nodedash?
When it comes to Node.js frameworks, Express and Nest.js are the most popular choices. I've been working with Express for over two years now. However, every time I started a new project, I found myself copying the structure from an old project, cleaning it up, and then beginning development. Over time, this became tedious and inefficient.
That's when I thought—why not create an NPM package or a repository where I can set up a reusable schema and clone it whenever needed? This led to the creation of Nodedash.
Nodedash is a simple and scalable Node.js backend template designed to kickstart your projects. It includes essential configurations and middleware, all written in TypeScript.
Features
- Basic Express server setup
- Environment variable configuration
- Common middleware integration (e.g., compression, CORS, helmet, morgan)
- TypeScript support
- Jest for testing
- Prettier for code formatting
- Well-structured folder layout for scalability
Prerequisites
Before getting started, ensure you have:
- Node.js v14 or higher
- npm installed
Installation
Clone the repository:
git clone https://github.com/mdkaifansari04/NODE_BACKEND_TEMPLATE.git
Navigate to the project directory:
cd NODE_BACKEND_TEMPLATE
Install dependencies:
npm install
Usage
Start the development server:
npm run dev
Start the production server:
npm start
The server will be running at: http://localhost:5000
Running Tests
To run tests:
npm test
To run tests in watch mode:
npm run test:watch
To check test coverage:
npm run test:coverage
Formatting Code
To format the code with Prettier:
npm run format
Project Structure
NODE_BACKEND_TEMPLATE/
├── 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)
Contributing
I just started this project, and it has a lot of potential to become even more scalable and efficient. Contributions are welcome! Feel free to fork the repository and submit a pull request.
License
This project is licensed under the ISC License.
The goal of Nodedash is to create a clean and efficient development environment for Node.js backend projects. Join me in making it better and more developer-friendly!
Top comments (0)