Skip to content

πŸ“¦ React Router v7 (Remix) Monorepo with Cloudflare Workers, Drizzle ORM & D1, Shadcn/UI, and Tailwind CSS v4.

Notifications You must be signed in to change notification settings

foxlau/react-router-v7-monorepo

Repository files navigation

React Router v7 Monorepo

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.

Features

  • πŸ“¦ 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

Project Structure

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

Root Configuration 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/* and packages/*

Getting Started

Install dependencies

pnpm install

Development

# 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

# Build all projects
pnpm build
# Build only web app
pnpm --filter web build

Database & Deployment

The project uses Drizzle ORM with Cloudflare D1 (SQLite) for database operations and Wrangler CLI for deployment.

Database Setup & Management

# 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

Deployment

# 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

Code Quality & Workflow

  • BiomeJS: pnpm format (format), pnpm check (lint)
  • Lefthook: Pre-commit hooks for formatting, linting, and type checking
  • Commitlint: Enforces conventional commit messages

License

MIT

About

πŸ“¦ React Router v7 (Remix) Monorepo with Cloudflare Workers, Drizzle ORM & D1, Shadcn/UI, and Tailwind CSS v4.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published