Skip to Content
DocsProjectsAPI Starter Kit

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 install

Configuration

PORT=4000 DATABASE_URL=postgresql://localhost:5432/api_starter JWT_SECRET=your-secret-key

Usage

# Development npm run dev # Production build npm run build npm start # Run tests npm test

API Endpoints

Authentication

POST /api/auth/register POST /api/auth/login POST /api/auth/refresh

Resources

GET /api/resources POST /api/resources GET /api/resources/:id PUT /api/resources/:id DELETE /api/resources/:id

Architecture

src/ ├── controllers/ # Request handlers ├── middleware/ # Auth, validation, errors ├── models/ # Database models ├── routes/ # Route definitions ├── services/ # Business logic ├── utils/ # Helpers └── index.ts # Entry point

Testing

# Unit tests npm run test:unit # Integration tests npm run test:integration # Coverage report npm run test:coverage
Last updated on