What is BE Monorepo?
BE Monorepo is a batteries-included backend template built on Hono 4, a fast and lightweight web framework. It provides a complete foundation for building production-ready APIs with TypeScript, featuring authentication, database management, and observability out of the box. The template is organized as a monorepo using Bun workspaces, allowing you to share code between multiple applications and packages while maintaining clear boundaries and type safety.Why use BE Monorepo?
Start with best practices
Start with best practices
Skip weeks of setup and configuration. BE Monorepo includes production-tested patterns for authentication, database migrations, error handling, and API documentation.
Type-safe from end to end
Type-safe from end to end
Written entirely in TypeScript with strict configuration. Drizzle ORM provides type-safe database queries, while Zod ensures runtime validation matches your types.
Observable by default
Observable by default
OpenTelemetry integration provides traces, metrics, logs, and profiling. Connect to Grafana dashboards to monitor your application in development and production.
Modern tooling
Modern tooling
Built with modern tools like Bun for fast package management, Biome for linting and formatting, and Changesets for version management.
Key features
Hono 4 framework
Ultra-fast web framework with middleware for CORS, CSRF, rate limiting, and more. Built-in OpenAPI documentation generation.
Better Auth
Modern authentication library with session management, user roles, and built-in security features.
Drizzle ORM
Type-safe PostgreSQL database access with migrations, schema generation, and a built-in studio UI.
OpenTelemetry
Full observability stack with automatic instrumentation for traces, metrics, and logs.
Monorepo structure
Organized workspace with apps and shared packages. Easily add new services while sharing common code.
Developer experience
Hot reload with Bun, unified linting with Ultracite, type checking, and pre-commit hooks with Husky.
What’s included
The monorepo comes with a fully configured Hono application and shared packages:Applications
- @workspace/hono - Main Hono 4 API server with authentication, database, and observability
Packages
- @workspace/core - Shared utilities, constants, types, and HTTP services
- @workspace/typescript-config - Shared TypeScript configuration for consistent compiler settings
Infrastructure
- Docker Compose configuration for PostgreSQL, Redis, and Grafana observability stack
- GitHub Actions CI/CD workflows for testing and deployment
- Environment variable management with dotenvx
Technology stack
Runtime flexibility: The template supports both Bun and Node.js runtimes. Use
bun hono dev for Bun or bun hono node:dev for Node.js.Core middleware
The Hono application comes pre-configured with essential middleware fromapps/hono/src/app.ts:
apps/hono/src/app.ts
Next steps
Ready to get started? Follow the quickstart guide to clone the repository, install dependencies, and run your first API server.Quickstart guide
Get your backend running in under 5 minutes
