This repository is a Bun + Turborepo workspace for a contract-first oRPC article.
It demonstrates one shared API contract used by:
apps/server: Hono server on Bunapps/web: Next.js app with TanStack Queryapps/mobile: Expo app with TanStack Query
The data layer is intentionally JSON/static TypeScript data in @repo/db, so readers can focus on contract-first API design before introducing an ORM.
server: Hono backend exposing RPC, REST/OpenAPI, Scalar docs, and Sentry hooksweb: Next.js product catalog using the shared oRPC clientmobile: Expo product catalog using the same oRPC client and query utils
@repo/orpc: contract, schemas, typed client factory, and TanStack Query utils@repo/db: static product catalog and category resources@repo/ui: shared React UI primitives@repo/eslint-config: shared ESLint configs@repo/typescript-config: shared TypeScript configs
Install dependencies:
bun installRun everything:
bun run devRun one workspace:
bun run dev --filter=server
bun run dev --filter=web
bun run dev --filter=mobileChecks:
bun run lint
bun run check-typesWhen server runs on the default port:
- Health:
http://localhost:4001/health - RPC:
http://localhost:4001/rpc - REST/OpenAPI routes:
http://localhost:4001/api - OpenAPI JSON:
http://localhost:4001/spec.json - Scalar docs:
http://localhost:4001/docs
@repo/orpcis contract-first and client-facing; implementation lives inapps/server.@repo/dbuses static JSON-like data for article clarity.- Set
SENTRY_DSNto enable Sentry. Without it, the app runs locally without sending events.