A modern monorepo for building full-stack applications with Bun, Hono, OpenAPI, and TanStack Router. This project is organized as a Bun workspace with separate API and Web applications, plus a shared schema package.
hono-openapi-rpc/
apps/
api/ # Hono-based API server (OpenAPI, Zod, Bun)
web/ # React web app (Vite, TanStack Router, Tailwind CSS)
packages/
db/ # Shared Drizzle ORM schema and database client for the monorepo
package.json
README.md
bun.lock
tsconfig.json
- Bun v1.2.17 or later
- Node.js (for some tooling, optional)
- Git
- TypeScript (peer dependency)
- Neon project for the PostgreSQL database
- GitHub OAuth app (for authentication) (create one here)
Install all dependencies for all workspaces:
bun installRuns the Hono API server (on port 4000 by default):
bun run api- Source:
apps/api - Main entry:
src/index.ts - Serves OpenAPI endpoints under
/api - Serves static files from
apps/api/publicfor non-API routes
Runs the React web app (Vite dev server on port 3000):
bun run web- Source:
apps/web - Main entry:
src/main.tsx - Uses TanStack Router, React Query, Tailwind CSS, and shadcn/ui
- Proxies API requests to the API server
Build the web app (output to apps/api/public for static serving):
bun run buildStart the API server (serves both API and built static web):
bun run startFrom the root, you can use these scripts:
| Script | Description |
|---|---|
api |
Run the API server in dev mode |
web |
Run the web app in dev mode |
build |
Build the web app for production |
start |
Start the API server (serves static + API) |
db:generate |
Generate database migrations (from packages/db) |
db:migrate |
Run database migrations (from packages/db) |
db:push |
Push schema changes to the database (from packages/db) |
db:studio |
Open database studio UI (from packages/db) |
test |
Run API tests (from apps/api) |
format |
Format codebase using Biome/Ultracite |
- Hono v4 (API framework)
- Zod (validation)
- OpenAPI (via @hono/zod-openapi)
- Serves static files from
public/ - Exposes OpenAPI docs and reference
- Uses Bun for fast startup
- React 19
- Vite 6
- TanStack Router & Query
- Tailwind CSS 4
- shadcn/ui components
- Proxies
/apirequests to the API server
- Shared Drizzle ORM schema and database client for the monorepo
- Provides schema definitions for users, notes, accounts, sessions, and verification
- Exports Zod schemas for type-safe validation and OpenAPI generation
- Used by both API and Web for consistent data modeling and validation
- All apps and packages use TypeScript modules.
- Use
bun installto install dependencies across all workspaces. - The web app builds to
apps/api/publicfor seamless static serving by the API server. - API routes are namespaced under
/api(seeBASE_PATH). - Static files are served for all other routes.
- Add new API endpoints in
apps/api/src/routes/ - Add new React routes in
apps/web/src/routes/ - Add or update shared schemas in
packages/schema/