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.
- π¦ pnpm β Monorepo package manager
- π¨ Tailwind CSS v4 β Utility-first CSS framework
- π§© shadcn/UI β Component library
- π BiomeJS β Code formatting and linting
- β‘ Vite.js β Build tool
- πͺ Lefthook β Git hooks manager
- π§ Wrangler β Cloudflare development CLI
- ποΈ Drizzle ORM β SQL-first ORM
- π©οΈ Cloudflare D1 β SQLite database for Cloudflare Workers
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
- biome.json: Code formatting and linting rules (BiomeJS)
- lefthook.yml: Git hooks for pre-commit (format, lint, typecheck) and commit-msg (commitlint)
- commitlint.config.cjs: Conventional commit message enforcement
- tsconfig.json: Extends centralized TypeScript config from
packages/tsconfig
- pnpm-workspace.yaml: Declares workspace packages in
apps/*
andpackages/*
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
- BiomeJS:
pnpm format
(format),pnpm check
(lint) - Lefthook: Pre-commit hooks for formatting, linting, and type checking
- Commitlint: Enforces conventional commit messages
MIT