Prerequisites
Before you begin, ensure you have the following installed:Bun
Version 1.3.10 or later
Node.js
Version 24.14.0 or later (optional, if not using Bun runtime)
PostgreSQL
Version 17 or later (can use Docker)
Git
Any recent version
Installation
Clone the repository
Clone the BE Monorepo template to your local machine:
The repository uses exact versioning for all dependencies to ensure reproducible builds.
Install dependencies
Install all workspace dependencies using Bun:This command installs dependencies for all apps and packages in the monorepo. The
bunfig.toml configuration ensures exact versions and isolated linking.Start infrastructure services
Start PostgreSQL, Redis, and the Grafana observability stack using Docker Compose:This command starts:
- PostgreSQL on port 5432 (database)
- Redis on port 6379 (caching)
- Grafana LGTM on port 3111 (observability dashboard)
- OTLP Receiver on ports 4317/4318 (telemetry collection)
Configure environment variables
Copy the example environment file and configure your settings:Update
apps/hono/.env.dev with your configuration:apps/hono/.env.dev
Set up the database
Push the database schema to create tables:This command uses Drizzle Kit to synchronize your database schema with the definitions in
apps/hono/src/db/schema.ts.Expected output:To view your database schema in a UI, run
bun hono db:studio and visit http://localhost:3003.Verify the installation
Test the API
Test the API
Make a test request to the health check endpoint:Expected response:
View API documentation
View API documentation
Visit the OpenAPI documentation in your browser:You’ll see an interactive API reference powered by Scalar. You can test endpoints directly from the documentation.
Check observability
Check observability
Access the Grafana dashboard to view traces and metrics:Login credentials:
- Username: admin
- Password: admin
Available scripts
The monorepo provides several utility scripts defined inpackage.json:
Alternative: Node.js runtime
If you prefer Node.js over Bun runtime, use these commands instead:All database, testing, and utility commands work the same regardless of which runtime you choose.
Next steps
Now that your backend is running, explore the project structure and learn how to add new features:Project structure
Learn about the monorepo organization and file structure
Database schema
Understand the database schema and how to modify it
Authentication
Configure authentication and user management
Add endpoints
Create new API routes with OpenAPI documentation
