$ show remix-run/react-router
This is the React Router monorepo, a full-stack React framework that provides client-side routing, server-side rendering (SSR), data loading/actions, middleware, and React Server Components (RSC) support. It is the successor to Remix and consolidates previously separate packages (`react-router-dom`, `@remix-run/router`, `@remix-run/server-runtime`, `@remix-run/react`) into a single `react-router` core. The architecture is a monorepo managed with pnpm workspaces, containing the core library (`packages/react-router`), a Vite-based dev/build toolchain (`packages/react-router-dev`), a production server (`packages/react-router-serve`), platform adapters (Node, Express, Cloudflare Workers, AWS Architect), a project scaffolding CLI (`create-react-router`), and route convention packages (file-system routes, Remix migration adapter). Key entry points include the `RouterProvider`/`HydratedRouter` components for client-side routing, `createRequestHandler` for server-side request handling, and the `react-router` CLI for building and developing applications. Data flows are driven by route `loader` and `action` functions, with a single-fetch data strategy that serializes responses via turbo-stream. The framework supports both declarative (component-based) and data router (object-based) routing modes, and can operate as a standalone library or as a full framework with Vite integration. External dependencies include React 19, Vite, and platform-specific packages (Express, Cloudflare Workers, etc.). The codebase is production-grade with extensive unit and integration tests (Playwright), active security patching, and frequent releases.
The LLM identified 4 files worth highlighting for reuse:
Provides a clean, interface-based abstraction for browser history, hash history, and memory history implementations. Each implementation adheres to a common `History` interface with `listen`, `push`, `replace`, `go`, and `location` properties. The memory history is particularly useful for testing and non-browser environments. This module is self-contained (no internal imports beyond basic types) and can be extracted into any project needing a history abstraction.
Implements a session storage abstraction with `createSessionStorage`, `createCookieSessionStorage`, and `createMemorySessionStorage`. The pattern allows plugging in different backends (file, Workers KV, ArcTable) while maintaining a consistent API for session creation, reading, updating, and destruction. The cookie-based implementation includes HMAC signing and rotation. This is a reusable pattern for any server-side session management.
Generates a route manifest from a flat file structure using naming conventions (dynamic segments, optional segments, pathless layouts, splats). Includes a `PrefixLookupTrie` for efficient parent-child route detection and conflict detection for route IDs and URL paths. This module is self-contained (depends only on `normalizeSlashes` and basic utilities) and can be reused in any project needing file-system-based route generation.
A Vite plugin that implements static prerendering (SSG) for React Router applications. It uses a Vite preview server to render routes at build time, supports concurrency, retries, redirect handling, and post-processing. The plugin is self-contained within the Vite plugin ecosystem and demonstrates a robust pattern for integrating prerendering into a Vite-based build pipeline.