create-yudha-backend-template
v1.0.6
Published
A professional CLI tool to scaffold a production-ready **TypeScript** backend project. This template follows the **Service-Repository Pattern** to ensure your code remains scalable, maintainable, and clean from day one.
Readme
create-yudha-backend-template
A professional CLI tool to scaffold a production-ready TypeScript backend project. This template follows the Service-Repository Pattern to ensure your code remains scalable, maintainable, and clean from day one.
Features
- TypeScript Native: Pre-configured
tsconfig.jsonfor optimal development. - Prisma Ready: Includes a structured Prisma directory for database management.
- Service-Repository Pattern: Clean separation of concerns for scalable architecture.
- Standardized Folders: Pre-defined structure for controllers, services, middlewares, and more.
- Environment Ready: Built-in support for environment variables.
Quick Start
You don't need to install this globally. Simply run the following command in your terminal:
npx create-yudha-backend-template <your-project-name>example
npx create-yudha-backend-template my-backend-apiOnce setup is complete, navigate to your project folder and start coding:
cd my-backend-api
npm install
npm run devFolder Architecture
The generated project follows a modular structure to keep your logic organized:
- src/config: Global configurations (Database, Third-party APIs).
- src/controllers: Handles HTTP requests and sends back responses.
- src/services: Contains core business logic.
- src/repositories: Direct data access layer (Prisma queries).
- src/middleware: Route protection, authentication, and validation.
- src/routes: API endpoint definitions.
- src/interface & src/types: TypeScript type definitions and contracts.
- src/utils: Reusable helper functions (formatting, encryption, etc.).
- prisma/: Database schema and migration files.
Available Scripts (Inside Generated Project)
- npm run dev: Starts the server with hot-reload (using tsx or nodemon).
- npm run build: Compiles TypeScript into production-ready JavaScript in the /dist folder.
- npm start: Runs the compiled production code.
Maintenance (For Contributors)
If you want to modify this template locally:
- Clone this repository.
- Run npm install in the root folder.
- Use npm link to test changes locally.
- Modify files inside the /template directory.
- Update the version in package.json and run npm publish.
