UNPKG

node-enterprise-starter

Version:

<h1 align="center">Node Enterprise Starter</h1>

229 lines (178 loc) ā€¢ 7.9 kB
<h1 align="center">Node Enterprise Starter</h1> <p align="center"> <b>Production-Ready Node.js Backend Framework</b><br> A modern, scalable, and secure foundation for building enterprise-grade applications </p> <p align="center"> <a href="https://github.com/abujobayer0/node-enterprise-starter"><img src="https://img.shields.io/badge/stars-200%2B-brightgreen" alt="GitHub stars"></a> <a href="https://github.com/abujobayer0/node-enterprise-starter"><img src="https://img.shields.io/badge/coverage-99%25-brightgreen" alt="Test Coverage"></a> <a href="https://www.npmjs.com/package/node-enterprise-starter"><img src="https://img.shields.io/badge/downloads-10k%2B-blue" alt="Downloads"></a> <a href="https://github.com/abujobayer0/node-enterprise-starter/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" alt="License"></a> </p> <p align="center"> <a href="https://node-enterprise-starter-web.vercel.app/" target="_blank"><b>šŸ“š Visit the Official Documentation Site</b></a> </p> <hr> ## āœØ Overview **Node Enterprise Starter** is a powerful CLI tool that generates production-ready Node.js applications with enterprise-level architecture. Skip the boilerplate setup and focus on building your business logic with our battle-tested foundation. ```bash npx node-enterprise-starter ``` <br> ## šŸš€ Key Features <table> <tr> <td> <h3>šŸ” Authentication</h3> Complete JWT authentication with access/refresh tokens and password management </td> <td> <h3>šŸ›”ļø TypeScript</h3> Built with TypeScript for robust type safety across your entire application </td> </tr> <tr> <td> <h3>šŸ—„ļø MongoDB Ready</h3> Mongoose ODM integration with models, schemas, and data validation </td> <td> <h3>šŸ‘„ User Management</h3> Role-based access control system with flexible permissions </td> </tr> <tr> <td> <h3>šŸ“ Error Handling</h3> Global error handler with custom error classes and consistent responses </td> <td> <h3>šŸ“Š Logging</h3> Advanced logging with request tracking and performance monitoring </td> </tr> </table> <br> ## šŸ“¦ Installation Start your new project in one command: ```bash # Using npm npx node-enterprise-starter # Using yarn yarn dlx node-enterprise-starter # Using pnpm pnpm dlx node-enterprise-starter # Using bun bunx node-enterprise-starter ``` Our interactive CLI guides you through setup, allowing you to customize your project structure and features. <br> ## šŸ—ļø Project Structure ``` node-enterprise-starter/ ā”œā”€ā”€ src/ ā”‚ ā”œā”€ā”€ app/ ā”‚ ā”‚ ā”œā”€ā”€ errors/ # Custom error classes ā”‚ ā”‚ ā”œā”€ā”€ middlewares/ # Express middlewares ā”‚ ā”‚ ā”œā”€ā”€ modules/ # Feature modules ā”‚ ā”‚ ā”‚ ā”œā”€ā”€ Auth/ # Authentication module ā”‚ ā”‚ ā”‚ ā”œā”€ā”€ User/ # User management module ā”‚ ā”‚ ā”‚ ā””ā”€ā”€ ... ā”‚ ā”‚ ā”œā”€ā”€ routes/ # API routes ā”‚ ā”‚ ā”œā”€ā”€ services/ # Shared services ā”‚ ā”‚ ā””ā”€ā”€ utils/ # Helper functions ā”‚ ā”œā”€ā”€ config/ # Configuration ā”‚ ā”œā”€ā”€ shared/ # Shared resources ā”‚ ā”‚ ā””ā”€ā”€ constants/ # Application constants ā”‚ ā”œā”€ā”€ app.ts # Express application ā”‚ ā””ā”€ā”€ server.ts # Server entry point ā”œā”€ā”€ .env # Environment variables ā”œā”€ā”€ .env.example # Environment template ā”œā”€ā”€ tsconfig.json # TypeScript configuration ā””ā”€ā”€ package.json # Dependencies and scripts ``` <br> ## šŸ“ Module Architecture Each feature is isolated in its own module with a clean separation of concerns: ``` Auth/ ā”œā”€ā”€ auth.controller.ts # Request handlers ā”œā”€ā”€ auth.service.ts # Business logic ā”œā”€ā”€ auth.model.ts # Data models ā”œā”€ā”€ auth.validation.ts # Request validation ā”œā”€ā”€ auth.utils.ts # Helper functions ā”œā”€ā”€ auth.interface.ts # TypeScript interfaces ā””ā”€ā”€ auth.routes.ts # Route definitions ``` <br> ## šŸ›£ļø API Routes | Method | Route | Description | Auth Required | | :------- | :----------------------------- | :----------------------- | :------------ | | `POST` | `/api/v1/auth/login` | User login | No | | `POST` | `/api/v1/auth/register` | User registration | No | | `POST` | `/api/v1/auth/forgot-password` | Request password reset | No | | `POST` | `/api/v1/auth/reset-password` | Reset password | No | | `POST` | `/api/v1/auth/change-password` | Change password | Yes (User) | | `GET` | `/api/v1/users` | Get all users | Yes (Admin) | | `GET` | `/api/v1/users/profile` | Get current user profile | Yes | | `GET` | `/api/v1/users/:id` | Get user by ID | Yes | | `PATCH` | `/api/v1/users/:id` | Update user | Yes | | `DELETE` | `/api/users/:id` | Delete user | Yes (Admin) | <br> ## āš™ļø Environment Configuration ```bash # Application NODE_ENV=development PORT=8000 # Database DATABASE_URL=mongodb://localhost:27017/myapp # Authentication BCRYPT_SALT_ROUNDS=10 JWT_ACCESS_SECRET=supersecretaccesskey123 JWT_ACCESS_EXPIRES_IN=7d JWT_REFRESH_SECRET=supersecretrefreshkey456 JWT_REFRESH_EXPIRES_IN=30d # Email EMAIL_USER=noreply@myapp.com EMAIL_PASSWORD=password123 RESET_LINK_URL=https://myapp.com/reset-password # Frontend CLIENT_URL=http://localhost:3000 # Admin defaults ADMIN_NAME=Abu Jobayer ADMIN_EMAIL=admin@myapp.com ADMIN_PASSWORD=adminpassword123 ADMIN_CONTACT=+1-234-567-8901 ADMIN_PROFILE_IMAGE_LINK=https://myapp.com/images/admin-profile.png ``` <br> ## šŸ’” Why Choose Node Enterprise Starter? - **Production Ready**: Battle-tested patterns used in real-world applications - **Developer Experience**: Clean architecture with intuitive organization - **Scalable**: Designed to grow from small projects to enterprise applications - **Time Saving**: Skip weeks of boilerplate setup and configuration - **Best Practices**: Follows industry standards for Node.js and Express - **Comprehensive**: Includes everything you need for a modern backend <br> ## šŸ› ļø Technologies <p> <img src="https://img.shields.io/badge/-Node.js-339933?style=flat-square&logo=Node.js&logoColor=white" alt="Node.js" /> <img src="https://img.shields.io/badge/-Express-000000?style=flat-square&logo=express&logoColor=white" alt="Express" /> <img src="https://img.shields.io/badge/-MongoDB-47A248?style=flat-square&logo=mongodb&logoColor=white" alt="MongoDB" /> <img src="https://img.shields.io/badge/-TypeScript-3178C6?style=flat-square&logo=typescript&logoColor=white" alt="TypeScript" /> <img src="https://img.shields.io/badge/-JWT-000000?style=flat-square&logo=json-web-tokens&logoColor=white" alt="JWT" /> <img src="https://img.shields.io/badge/-REST_API-FF6C37?style=flat-square&logo=postman&logoColor=white" alt="REST API" /> </p> <br> ## šŸ“š Documentation & Support - [**Official Documentation Site**](https://node-enterprise-starter-web.vercel.app/) - [**GitHub Repository**](https://github.com/abujobayer0/node-enterprise-starter) - [**Issues & Feature Requests**](https://github.com/abujobayer0/node-enterprise-starter/issues) - [**Support**](mailto:zubayer.munna.dev@gmail.com) <br> ## šŸ“„ License This project is [MIT](https://github.com/abujobayer0/node-enterprise-starter/blob/main/LICENSE) licensed. <br> <p align="center"> <sub>Crafted with ā¤ļø by <a href="https://github.com/abujobayer0">Abu Jobayer</a></sub> </p>