A full-stack TypeScript monorepo demonstrating microservices architecture with oRPC, TanStack Query, and end-to-end type safety.
- Node.js: 24+ recommended
- pnpm: 10.21.0+ (project uses
pnpmworkspaces)
# Install dependencies
pnpm install
# Start development (runs API + Web in parallel)
pnpm devThe API server starts at http://localhost:3000 and the web app at http://localhost:5173.
pnpm dev # Start all services in development mode
pnpm build # Build all packages and apps
pnpm preview # Preview production builds
pnpm type:check # TypeScript type checking
pnpm test # Run tests
pnpm test:watch # Run tests in watch mode
pnpm test:coverage # Run tests with coverage
pnpm lint # Lint code
pnpm lint:fix # Fix linting issuesorpc-multiservice-monorepo-playground/
βββ apps/
β βββ api/ β HTTP server aggregating all services
β βββ web/ β React frontend with TanStack Query
βββ packages/
β βββ auth-contract/ β Auth API contract
β βββ auth-service/ β Auth implementation
β βββ chat-contract/ β Chat API contract
β βββ chat-service/ β Chat implementation (real-time)
β βββ planet-contract/ β Planet CRUD contract
β βββ planet-service/ β Planet CRUD implementation
βββ package.json β Monorepo root
Each microservice follows the contract-first pattern:
ββββββββββββββββββββββββββββββββββββββββββββ
β API Aggregator (apps/api) β
β - Routes requests to services β
β - Provides shared context (auth, etc.) β
ββββββββββββββββββββββββββββββββββββββββββββ
β
ββββββββββββββββββββββββββββββββββββββββββββ
β Service Layer β
β - Implements business logic β
β - Uses middleware (auth, retry, etc.) β
β - Handles errors with type safety β
ββββββββββββββββββββββββββββββββββββββββββββ
β
ββββββββββββββββββββββββββββββββββββββββββββ
β Contract Layer β
β - Defines API shape with Zod schemas β
β - OpenAPI metadata (routes, tags) β
β - Shared types (TypeScript inference) β
ββββββββββββββββββββββββββββββββββββββββββββ