Skip to content

Repository files navigation

Bun API Starter

Production-ready API starter using Bun, Hono, Drizzle, and TypeScript.

Stack

Getting Started

Prerequisites

  • Bun >= 1.1
  • PostgreSQL database

Setup

# Install dependencies
bun install

# Copy environment file and configure
cp .env.example .env

# Run database migrations
bun run db:migrate

Commands

Development

bun run dev          # Start dev server with hot reload

Testing

bun run test         # Run all tests
bun run test:watch   # Run tests in watch mode

Linting & Formatting

bun run lint         # Check for lint errors
bun run lint:fix     # Fix lint errors
bun run format       # Format code

Build & Production

bun run build        # Build for production
bun run start        # Run production server

Database

bun run db:generate  # Generate migrations from schema
bun run db:migrate   # Run migrations
bun run db:push      # Push schema directly (dev only)
bun run db:studio    # Open Drizzle Studio

Project Structure

src/
├── index.ts         # Application entry point
├── routes/          # Route handlers
├── services/        # Business logic
├── schemas/         # Zod validation schemas
├── lib/             # Shared utilities
└── db/              # Database schema
tests/               # Test files
docs/                # Documentation
drizzle/             # Database migrations

API Endpoints

Method Path Description
GET /health Health check

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages