This is a high-performance, production-ready rewrite of the API Template project using TypeScript, Express, Prisma, and Bun.
- Production-Ready Architecture: Layered Controller-Service-Repository pattern.
- Robust Validation: Strict input and environment validation using Zod.
- Structured Logging: Professional logging with Winston.
- Global Error Handling: Centralized interceptor with custom semantic error classes.
- Security Hardened: Includes Helmet, CORS, and Rate Limiting.
- Integrated Testing: Ready-to-use testing suite with
bun:testand Supertest. - Modern Runtime: Optimized for Bun but compatible with Node.js.
- Bun (Recommended) or Node.js.
- PostgreSQL Database.
$ git clone https://github.com/juan1003/api-template.git
$ cd api-template/
$ bun installCreate a .env file in the root directory with the following variables:
DATABASE_URL="postgresql://user:password@localhost:5432/db_name?schema=public"
JWT_SECRET="your-super-secret-key-at-least-10-chars"
PORT=8080
NODE_ENV="development"$ bun prisma generate
$ bun prisma migrate dev
$ bun prisma db seed| Command | Description |
|---|---|
bun start |
Runs the server in production mode |
bun run dev |
Runs the server with auto-reload (Nodemon) |
bun test |
Executes the integration test suite |
bun prisma studio |
Opens Prisma's GUI to view/edit data |
For more detailed information on development conventions and architecture, please refer to GEMINI.md.
Maintained by Juan De Jesús