API Starter Kit
A production-ready REST API boilerplate with TypeScript, Express, and comprehensive tooling.
Features
- Full TypeScript support
- Request validation with Zod
- JWT authentication
- Rate limiting
- Error handling middleware
- Structured logging
- Unit and integration tests
Setup
git clone https://github.com/kartikbhardwaj/api-starter.git
cd api-starter
npm installConfiguration
PORT=4000
DATABASE_URL=postgresql://localhost:5432/api_starter
JWT_SECRET=your-secret-keyUsage
# Development
npm run dev
# Production build
npm run build
npm start
# Run tests
npm testAPI Endpoints
Authentication
POST /api/auth/register
POST /api/auth/login
POST /api/auth/refreshResources
GET /api/resources
POST /api/resources
GET /api/resources/:id
PUT /api/resources/:id
DELETE /api/resources/:idArchitecture
src/
├── controllers/ # Request handlers
├── middleware/ # Auth, validation, errors
├── models/ # Database models
├── routes/ # Route definitions
├── services/ # Business logic
├── utils/ # Helpers
└── index.ts # Entry pointTesting
# Unit tests
npm run test:unit
# Integration tests
npm run test:integration
# Coverage report
npm run test:coverageLast updated on