This document describes how this project works and how to perform common operations.
This is a Bun-powered TypeScript monorepo using Turborepo for orchestration. It contains a Fastify API backend with auto-generated TypeScript client SDK.
fastify-starter-turbo-monorepo/
├── apps/
│ └── backend/ # Fastify API server
├── packages/
│ ├── tsconfig/ # Shared TypeScript configuration
│ ├── backend-errors/ # Error handling package
│ └── backend-client/ # Generated TypeScript client SDK
├── turbo.json # Turbo task configuration
├── package.json # Root workspace definition
├── biome.json # Linting and formatting
└── lefthook.yml # Git hooks
- Runtime: Bun (>= 1.0.0)
- Framework: Fastify v5
- Database: PostgreSQL with Kysely (type-safe query builder)
- Validation: TypeBox (generates OpenAPI schemas)
- Testing: Vitest + Testcontainers
- Linting/Formatting: Biome
- Monorepo: Turborepo + Bun workspaces
bun run start # Start dev mode with watch (turbo watch dev)
turbo watch dev # Same as aboveturbo build # Build all packages
turbo run build # Same as aboveturbo test # Run tests across all packagesturbo run lint # Lint all packages
turbo run verify-types # Type check all packages
# Format specific files
biome check --write --unsafe srcbun run clean # Remove node_modules, turbo cache, dist, .hashes.json
bun run clean:turbo # Remove .turbo directories only
bun run clean:dist # Remove dist directories onlyUse turbo gen to generate boilerplate code:
turbo genSee apps/backend/AGENTS.md for details on available generators.
The Turbo pipeline ensures correct build order:
@internal/backend-errorsbuilds first@internal/backenddepends on backend-errors@internal/backend-clientdepends on backend's OpenAPI generation
For development, build:dev tasks use hash-runner for incremental builds.
Keep dependencies in sync across packages:
bun run syncpack:update # Update all dependencies
bun run syncpack:format # Format package.json files
bun run syncpack:lint # Check for version mismatchesPre-commit:
- Formats package.json files
- Runs
turbo run lint:stagedon staged TypeScript files
Pre-push:
- Runs type checking (
turbo run verify-types) - Runs full lint (
turbo run lint)