React Router v7 + Sanity Studio (embedded) starter.
- React Router v7 - Full-stack React framework
- React 19 - Latest React features
- TypeScript - Type safety and better DX
- Tailwind CSS v4 - Utility-first CSS framework
- Sanity CMS - Headless content management system
- Vite - Fast development and build tool
- ESLint - Code linting and quality
- Prettier - Code formatting
- pnpm - Fast package manager
- Node.js 18+
- pnpm
pnpm install
cp .env.example .env
pnpm dev- App:
http://localhost:5173 - Embedded Studio:
http://localhost:5173/studio
pnpm dev: app + embedded studiopnpm sanity:dev: standalone studio (optional)pnpm typecheck: schema extract + Sanity typegen + React Router typegen +tscpnpm format: prettier
├── app/
│ ├── routes/ # React Router routes (registered in app/routes.ts)
│ ├── components/
│ │ ├── ui/ # UI primitives
│ │ └── features/
│ │ ├── layout/ # header/footer
│ │ ├── sanity/ # schema-mapped UI + visual editing helpers
│ │ └── analytics/ # consent + tracking gates
│ └── sanity/ # schema, queries, preview, presentation
├── sanity.config.ts # Studio config (embedded at /studio)
├── sanity.types.ts # generated Sanity schema + GROQ query types
└── tsconfig.json # aliases (@/, @gen/sanity, @root/*)
Tailwind only. Global CSS is limited to Tailwind v4 @theme tokens + minimal base in app/app.css.
- Embedded Studio route:
/studio - Preview mode routes:
/api/preview-mode/enableand/api/preview-mode/disable - Type-safe queries:
app/sanity/queries/*+ generatedsanity.types.ts
Analytics is Sanity-driven (siteSettings.analytics) and consent-gated via @c15t/react.\nPlausible and PostHog run through proxy routes (/js/script, /api/event, /ingest/*) and are disabled on localhost.
- ESLint - Configured for React and TypeScript
- Prettier - Configured with Tailwind CSS plugin for class sorting
- TypeScript - Strict mode enabled for better type safety
This starter leverages React Router 7's powerful features:
Server-Side Rendering (SSR):
- Data loading with
loaderfunctions - Automatic hydration and client-side navigation
- SEO-friendly routing with meta tags
Route Organization:
- File-based routing in
app/routes/ - Dynamic routes (e.g.,
house.$id.tsx) - API routes for backend functionality
Type Safety:
- Auto-generated route types
- Type-safe loaders and actions
- Full TypeScript integration
Performance:
- Automatic code splitting
- Optimized bundle sizes
- Fast page transitions
See .env.example for the full list of required variables.
Build the project for production:
pnpm run buildThe build artifacts will be stored in the build/ directory.
For Sanity Studio deployment:
pnpm run sanity:deployMIT