This is a streamlined example demonstrating the use of React Router v7 within a monorepo, integrating Cloudflare Workers, Drizzle ORM with D1, Shadcn/UI, and Tailwind CSS v4.
react-router-v7-monorepo/
āāā apps/ # Application directory
ā āāā web/ # Main Web application
ā āāā app/ # Application source code
ā ā āāā routes/ # Route definitions
ā ā āāā styles/ # Style files
ā āāā public/ # Static assets
ā āāā workers/ # Cloudflare workers
ā āāā ... # App configs & scripts
āāā packages/ # Shared packages
ā āāā db/ # Drizzle ORM + Cloudflare D1 database
ā āāā shared/ # Common utilities, hooks, and assets
ā āāā ui/ # shadcn/ui-based reusable UI components
ā āāā tsconfig/ # Centralized TypeScript config presets
āāā .cursor/ # Cursor editor config & code style rules
āāā .github/ # GitHub workflow config
āāā biome.json # BiomeJS config
āāā lefthook.yml # Lefthook Git hooks config
āāā commitlint.config.cjs # Commit message linting config
āāā tsconfig.json # Root TypeScript config
āāā pnpm-workspace.yaml # pnpm workspace config
āāā ... # Other root config files
packages/tsconfig
apps/*
and packages/*
pnpm install
# For apps/web, copy configuration files first
cd apps/web
cp .dev.vars.example .dev.vars
cp wrangler.jsonc.example wrangler.jsonc
cd ../..
# Start all projects
dpnm dev
# Start only web app
pnpm --filter web dev
# Build all projects
pnpm build
# Build only web app
pnpm --filter web build
The project uses Drizzle ORM with Cloudflare D1 (SQLite) for database operations and Wrangler CLI for deployment.
# Create a new D1 database
npx wrangler d1 create rrv7-monorepo
# Generate migration files from schema changes
pnpm db:generate
# Apply migrations locally
pnpm db:apply
# Drop all tables (caution!)
pnpm db:drop
# Apply migrations and deploy to production
pnpm db:apply-prod
pnpm deploy
# Deploy a preview version for testing
pnpm deploy:version
# Promote a version to production
pnpm deploy:promote
pnpm format
(format), pnpm check
(lint)MIT