Thank you for taking the time to contribute!
git clone https://github.com/kalyankashaboina/node-typescript-backend-template.git
cd node-typescript-backend-template
npm install
cp .env.example .env
npm run dev
| Type | Pattern | Example |
|---|---|---|
| Feature | feat/short-description |
feat/add-product-routes |
| Bug fix | fix/short-description |
fix/health-route-404 |
| Docs | docs/short-description |
docs/update-readme |
| Refactor | refactor/short-description |
refactor/user-service |
Always branch off main. One concern per PR.
Follow Conventional Commits:
<type>: <short description>
Types: feat, fix, docs, refactor, test, chore, ci
git commit -m "feat: add product routes with full CRUD"
git commit -m "fix: health route returning 404"
git commit -m "docs: add database swapping guide to README"
| Layer | Responsibility | Must NOT |
|---|---|---|
| Routes | Wire URL + method to handlers | Contain any logic |
| Controllers | Parse input, call service, send response | Talk to the database |
| Services | Business logic, enforce rules | Import req or res |
| Repositories | Data access only | Contain business logic |
1. src/validations/product.validation.ts <- Zod schemas + inferred types
2. src/repositories/product.repository.ts <- data access (findAll, create, etc.)
3. src/services/product.service.ts <- business rules, throw AppError
4. src/controllers/product.controller.ts <- parse -> service -> respond
5. src/routes/product.routes.ts <- wire routes + @openapi comments
6. src/routes/index.ts <- router.use(ROUTES.PRODUCTS, productRoutes)
7. src/constants/app.constants.ts <- add PRODUCTS: '/products' to ROUTES
strict: trueis non-negotiable — never disable strict TypeScript checks- No
anytypes without a comment explaining why - All user-facing strings go in
src/constants/errorMessages.ts - All HTTP status codes use
HTTP_STATUS.*fromsrc/constants/httpStatus.ts
npm run type-check # No TypeScript errors
npm run lint # No ESLint errors
npm run format:check # Code is formatted
npm run build # Production build succeeds
Open a GitHub Issue with:
- Node.js version (
node --version) - Steps to reproduce
- Expected vs actual behaviour
Open a GitHub Discussion or reach out to @kalyankashaboina.