TurboJet
API

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

LayerPathPurpose
Router mountpackages/api/src/index.tsComposes module routers under /api
Module routerspackages/api/src/modules/*/router.tsHTTP handlers, validation, auth, rate limiting
Servicespackages/api/src/modules/*/service.tsBusiness logic and database calls
Clientapps/marketing/src/lib/api.tsTyped 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

On this page