@code-jjk/backend
v1.1.4
Published
To provide features, object-oriented approach and error handling for Node.js applications with Express.js
Maintainers
Readme
🚀 init-backend-app
Instant Express + TypeScript project generator
This is a zero-config CLI that bootstraps a fully working
Express + TypeScript backend in seconds.
It generates a clean structure with controllers, services, automatic
registration, and a built-in error handler.
📦 Quick Start
npx @code-jjk/backend --bootstrapOr
npx @code-jjk/backend init-backend-app --bootstrapOr install globally:
npm install -g @code-jjk/backend
init-backend-app --bootstrap✨ Features
- ✔️ Fully working Express server
- ✔️ TypeScript ready out of the box
- ✔️ Auto-registered controllers
- ✔️ Health check route included
- ✔️ Built-in error handler
- ✔️ Structured folders (controllers/services/middlewares)
- ✔️ tsconfig.json + ts-node support
- ✔️ "start" script added automatically
- ✔️ Zero configuration needed
📁 Generated Project Structure
my-backend/
├── package.json
├── tsconfig.json
└── src/
├── index.ts
├── controllers/
│ ├── health.controller.ts
│ └── register.ts
├── services/
│ └── health.service.ts
└── middlewares/🧠 Example Generated Code
src/index.ts
import express from "express";
import { errorHandler } from "@code-jjk/backend";
import { register } from "./controllers/register";
const app = express();
app.use(express.json());
register(app);
app.use(errorHandler);
app.listen(3000, () => {
console.log("Server running on http://localhost:3000");
});🔥 Example Health Controller
src/controllers/health.controller.ts
import { NextFunction, Request, Response, Router } from "express";
import { HealthService } from "../services/health.service";
export class HealthController {
private path = "/health";
private router = Router();
private service: HealthService;
get Router() {
return this.router;
}
constructor(service: HealthService) {
this.service = service;
this.initializeRoutes();
}
public initializeRoutes(): void {
this.router.get(
this.path,
(req, res, next) => this.health(req, res).catch(next)
);
}
public async health(_req: Request, res: Response): Promise<void> {
const result = this.service.health();
res.status(200).send({ message: { isServiceHealthy: result }});
}
}🧪 Local Development (Contributing)
npm install
npm run build
npm linkInside a test project:
npm link @code-jjk/backend
init-backend-app --bootstrap📝 Requirements
- Node.js 18+
- npm 8+
🛠 Roadmap
- Dependency Injection container\
- Decorator-based controllers & services\
- Auto route discovery\
- CLI flags (e.g., --port, --template, --skip-install)\
- Optional templates (REST, CRUD, Auth)
Important Note 🔴
This project is cannot be developed/taken either completely or partially or managed without prior permission
