DEV Community

Md Kaif Ansari
Md Kaif Ansari

Posted on

Nodedash: A Simple and Scalable Node.js Backend Template

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
Enter fullscreen mode Exit fullscreen mode

Navigate to the project directory:

cd NODE_BACKEND_TEMPLATE
Enter fullscreen mode Exit fullscreen mode

Install dependencies:

npm install
Enter fullscreen mode Exit fullscreen mode

Usage

Start the development server:

npm run dev
Enter fullscreen mode Exit fullscreen mode

Start the production server:

npm start
Enter fullscreen mode Exit fullscreen mode

The server will be running at: http://localhost:5000

Running Tests

To run tests:

npm test
Enter fullscreen mode Exit fullscreen mode

To run tests in watch mode:

npm run test:watch
Enter fullscreen mode Exit fullscreen mode

To check test coverage:

npm run test:coverage
Enter fullscreen mode Exit fullscreen mode

Formatting Code

To format the code with Prettier:

npm run format
Enter fullscreen mode Exit fullscreen mode

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)
Enter fullscreen mode Exit fullscreen mode

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.


Github repo
Nodedash

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!

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

Top comments (0)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay