Skip to content

mustafaskyer/orpc-contract-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

oRPC Contract-First Product Catalog

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 Bun
  • apps/web: Next.js app with TanStack Query
  • apps/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.

Workspace Layout

Apps

  • server: Hono backend exposing RPC, REST/OpenAPI, Scalar docs, and Sentry hooks
  • web: Next.js product catalog using the shared oRPC client
  • mobile: Expo product catalog using the same oRPC client and query utils

Packages

  • @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

Commands

Install dependencies:

bun install

Run everything:

bun run dev

Run one workspace:

bun run dev --filter=server
bun run dev --filter=web
bun run dev --filter=mobile

Checks:

bun run lint
bun run check-types

URLs

When 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

Notes

  • @repo/orpc is contract-first and client-facing; implementation lives in apps/server.
  • @repo/db uses static JSON-like data for article clarity.
  • Set SENTRY_DSN to enable Sentry. Without it, the app runs locally without sending events.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors