A production-ready monorepo template built with Bun, TanStack Start, Turborepo, and Vercel. Features live TypeScript types, AI-friendly git submodules for library context, and browser debugging with Playwriter MCP.
- Runtime: Bun - Fast JavaScript runtime and package manager
- Framework: TanStack Start - Full-stack React framework with file-based routing
- Build: Turborepo - High-performance monorepo build system
- Linting: Ultracite (oxlint + oxfmt) - Fast Rust-based tooling
- Deployment: Vercel with Nitro preset and Bun runtime
- Bun v1.3.5 or later
- Node.js 20+ (for compatibility with some tools)
# Clone with submodules (recommended for AI context)
git clone --recurse-submodules <repo-url>
cd home
# Install dependencies
bun install# Start all apps in development mode
bun run dev
# Start a specific app
cd apps/web && bun run devhome/
├── apps/
│ ├── admin/ # TanStack Start admin app (port 3001)
│ ├── docs/ # Documentation site
│ └── web/ # TanStack Start main app
├── packages/
│ ├── api/ # Shared API utilities
│ ├── core/ # Shared business logic
│ └── ui/ # Shared UI components
└── .context/ # Git submodules for AI context
| Command | Description |
|---|---|
bun run dev |
Start all apps in development mode |
bun run build |
Build all packages and apps |
bun run check-types |
TypeScript type checking |
bun run fix |
Auto-fix linting issues (Ultracite) |
bun run check |
Check for linting issues (Ultracite) |
The .context/ directory contains git submodules that provide AI coding assistants (Claude, Cursor, Copilot) with library source code for better context and suggestions.
- TanStack Router -
https://github.com/TanStack/router.git
When AI assistants have access to library source code:
- They understand internal APIs and patterns
- They can reference exact function signatures
- They provide more accurate code suggestions
- They avoid hallucinating non-existent APIs
# Clone with submodules
git clone --recurse-submodules <repo-url>
# Initialize submodules after a regular clone
git submodule update --init --recursive
# Update submodules to latest
git submodule update --remote
# Add a new submodule
git submodule add <url> .context/<name>This template is designed to work with Playwriter, an MCP server for controlling Chrome via Playwright. It enables AI assistants to debug and test your running applications directly in the browser.
- Automates browser interactions for debugging
- Takes accessibility snapshots (smaller than screenshots)
- Inspects elements, CSS, and network requests
- Works with Claude Code and other MCP-compatible agents
- Install the Playwriter Chrome extension
- Configure your MCP client with:
npx playwriter@latest - Click the extension icon on any tab you want to control
- Debug React components in the running app
- Test user flows and interactions
- Inspect network requests and responses
- Capture screenshots and accessibility trees
This monorepo uses a "live types" pattern for optimal developer experience. Changes to shared packages are immediately reflected in consuming apps without a build step.
We use a custom export condition @packages/source that resolves directly to TypeScript source files during development:
// vite.config.ts
export default defineConfig({
resolve: {
conditions: ["@packages/source"],
},
});For comprehensive documentation, see apps/docs/content/typescript.md.
Further reading: Live types in a TypeScript monorepo by Colin McDonnell
When running with Bun + Nitro + Vite in development, HTTP/2 causes Transfer-Encoding errors. Nitro is only enabled during the build command.
Impact: None for deployments—Vercel builds work correctly.
Reference: TanStack/router#6050
// apps/admin/vite.config.ts
command === "build"
? nitro({
preset: "vercel",
vercel: {
functions: {
runtime: "bun1.x",
},
},
})
: null,Apps are configured for Vercel deployment with the Bun runtime.
- Runtime: Bun 1.x
- Preset: Nitro
vercelpreset - Build Command:
bun run build
Configure these in your Vercel project settings as needed:
| Variable | Description |
|---|---|
NODE_ENV |
production for production builds |
apps/docs/content/typescript.md- TypeScript monorepo configurationapps/docs/content/phantom-dependencies.md- How Bun caught a latent dependency bug