Backend components CLI for Node.js & Typescript
ServerCN is a backend component registry for Node.js & TypeScript. It provides a robust collection of pre-configured components, boilerplates, and utilities for Node.js and TypeScript, enabling developers to scaffold production-ready code in seconds.
The goal of servercn is similar to shadcn/ui for frontends: instead of hiding logic behind heavy abstractions, it gives you copy‑friendly, understandable, and extensible backend building blocks that you fully own.
- ⚡ Instant Scaffolding: Quickly generate backend components like Authentication, Logging, and Database setups.
- 🛡️ Type-Safety First: Built entirely with TypeScript for robust and reliable code.
- 🔐 Secure by Design: Includes best-practice implementations for security (Argon2, JWT, Zod).
- 🧩 Modular Architecture: Add only what you need to your existing project.
- 📝 Comprehensive Logging: Integrated with Pino and Winston for effective monitoring and debugging.
ServerCN allows you to quickly add the following components to your project:
- Authentication System (JWT, Refresh Tokens, Password Hashing)
- Database Connection (Mongoose/MongoDB)
- Input Validation (Zod)
- Error Handling (Global Error Handler, Async Wrapper)
- Logging (Winston, Pino)
You can use the CLI directly via npx or install it globally to use it across multiple projects.
npm install servercnStart a new project with a recommended, production-ready structure.
npx servercn initAdd specific modules to your existing project. This allows for incremental adoption.
servercn add [component-name]Examples:
servercn add auth
servercn add loggerView all available components that you can add to your project.
servercn listThe generated code follows a clean, MVC-inspired architecture designed for scalability:
src/
├── config/ # Environment variables and configuration
├── controllers/ # Request handlers
├── middlewares/ # Express middlewares (Auth, Error handling)
├── models/ # Database models (Mongoose schemas)
├── routes/ # API routes definitions
├── services/ # Business logic layer
├── utils/ # Helper functions and classes
└── app.ts # Application entry point
- Runtime: Node.js
- Language: TypeScript
- Framework: Express.js
- Frontend: Next.js
We welcome contributions! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.
Built with 🗡️ by Akkal Dhami

