A production-ready monorepo using Turborepo and pnpm workspaces with React + Go.
ttt/
├── apps/
│ ├── api/ # Go + Gin backend
│ ├── web/ # React + Vite frontend
│ └── db/ # Database scripts
├── packages/ # Shared packages (future)
├── docker-compose.yml
├── turbo.json
└── pnpm-workspace.yaml
- Node.js >= 20.x
- pnpm >= 9.x
- Go >= 1.24
- Docker & Docker Compose
# Clone and install dependencies
pnpm install
# Setup Husky hooks
pnpm prepare# Run all apps in development mode
pnpm dev
# Run specific app
pnpm dev:web # Frontend only (port 3000)
pnpm dev:api # Backend only (port 8080)# Build all apps (React + Go)
pnpm build
# Build will:
# - Compile React app to dist/
# - Compile Go binary to tmp/main# Lint all apps
pnpm lint
# Format code
pnpm format
# Check formatting
pnpm format:check# Production build
docker compose up -d --build
# Development with hot reload
docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d
# View logs
docker compose logs -f
# Stop all services
docker compose downThis monorepo integrates Go into Turborepo's JavaScript-centric pipeline:
// apps/api/package.json
{
"scripts": {
"build": "go build -o tmp/main ./cmd/api/main.go",
"dev": "air -c .air.toml"
}
}Running pnpm turbo run build will simultaneously:
- Build React app (
tsc && vite build) - Compile Go binary (
go build)
Pre-configured hooks ensure code quality:
- pre-commit: Runs full build (React + Go must compile)
- pre-push: Runs lint, build, and tests
If either React or Go has errors, the commit/push is rejected.
| Service | Port | Description |
|---|---|---|
| web | 3000 | React frontend (Nginx) |
| api | 8080 | Go Gin backend |
| postgres | 5432 | PostgreSQL database |
| File | Purpose |
|---|---|
turbo.json |
Turborepo pipeline configuration |
pnpm-workspace.yaml |
pnpm workspace definition |
docker-compose.yml |
Production Docker orchestration |
docker-compose.dev.yml |
Development overrides (hot reload) |
.husky/pre-commit |
Build check before commit |
| Command | Description |
|---|---|
pnpm dev |
Start all apps in dev mode |
pnpm build |
Build all apps |
pnpm lint |
Lint all apps |
pnpm test |
Run all tests |
pnpm clean |
Clean build artifacts |
pnpm format |
Format code with Prettier |
pnpm typecheck |
TypeScript type checking |
ISC