Overview
Hono API modules, typed client, TanStack Query, and Scalar OpenAPI.
TurboJet is designed as a scalable fullstack kit with a dedicated, extendable API layer. The product API lives in packages/api and is mounted by the marketing app at /api (apps/marketing/src/app/api/[[...route]]/route.ts).
The frontend talks to it through the typed Hono RPC client (hc) in @repo/api/client, then wraps calls in TanStack Query hooks under apps/marketing/src/mutations/.
Why Hono
Hono is a modern, minimal web framework for TypeScript. It is fast, easy to
extend, and deploys almost anywhere. TurboJet uses the Hono RPC client
(hc) for end-to-end typed calls from the browser to your routers.
Why TanStack Query
TanStack Query gives you caching, loading/error state, and a consistent
pattern for mutations and queries. Pair it with handle() around the typed
client so failed responses surface as thrown errors with API messages.
Storefront checkout is a separate Next route (POST /api/checkout), not the Hono billing module. Auth Better Auth routes live under /api/auth when mounted by a host app.
Architecture
| Layer | Path | Purpose |
|---|---|---|
| Router mount | packages/api/src/index.ts | Composes module routers under /api |
| Module routers | packages/api/src/modules/*/router.ts | HTTP handlers, validation, auth, rate limiting |
| Services | packages/api/src/modules/*/service.ts | Business logic and database calls |
| Client | apps/marketing/src/lib/api.ts | Typed Hono client for browser requests |
Scalar / OpenAPI
When features.apiDocs is enabled, the reference is available at:
/api/reference— Scalar UI/api/openapi.json— raw OpenAPI document
By default, API docs are enabled in development and disabled in production. The OpenAPI document is hand-maintained in packages/api/src/openapi.ts (not generated from oRPC).
Guides
Define an API endpoint
Schemas, services, Hono routers, and mounting.
Protect API endpoints
Public, optional session, requireAuth, and admin.
Use API in frontend
Typed client, handle(), and TanStack Query.
AI chatbot streaming
POST /api/ai/chat streams via @repo/ai.
Storage
Presigned uploads at /api/storage.
Build a feature
Full Feedback vertical slice.