A modern, type-safe API template built with Bun and Elysia.js, featuring:
- ⚡ Blazing Fast - Powered by Bun's JavaScript runtime and Elysia's performance
- 🛠 Type Safety - Built with TypeScript and TypeBox for end-to-end type safety
- 📚 OpenAPI - Automatic API documentation with Swagger UI
- 🗄 Database - Database integration with Drizzle ORM
- 🔄 Hot Reload - Development server with hot module replacement
- Bun (v1.0.0 or later)
- Node.js (v18 or later, though Bun includes its own runtime)
-
Clone the repository:
git clone https://github.com/your-username/bun-elysia-template.git cd bun-elysia-template -
Install dependencies:
bun install
-
Set up environment variables:
cp .env.template .env # Edit .env with your configuration
bun run dev- Start the development server with hot reloadbun run build- Build the application for productionbun run start- Start the production server
.
├── src/
│ ├── common/ # Common code
│ ├── config/ # Configuration files
│ ├── controllers/ # Request handlers
│ ├── infra/ # Infrastructure code (database, cache, etc.)
│ ├── modules/ # Feature modules
│ └── routes/ # API route definitions
├── drizzle/ # Database migrations and schema
├── .env.template # Environment variables template
└── package.json # Project dependencies and scripts
When the development server is running, you can access:
- OpenAPI/Swagger UI: http://localhost:3000/swagger
- API JSON Schema: http://localhost:3000/swagger/json
- Bun - Fast JavaScript runtime
- Elysia.js - Fast, and friendly Bun web framework
- Drizzle ORM - TypeScript ORM
- TypeBox - JSON Schema Type Builder
- OpenAPI - API documentation standard
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request