react.dev is one of the best resouces for starting and learning react. as this was created by the team behind react who understood it the best. but the resoucres doesnt end where the tutorial ends the website itself is open source and written by the same team in the same react. which we can go through to get deep insight on how a real big react codebase should function.

https://casestudy-reactdotdev.samarth.page/

Source: react.dev — The official React documentation website

Stack: Next.js 15 (Pages Router), React 19, TypeScript 5.7, Tailwind CSS 3, MDX


1. Project Architecture

react.dev is built with Next.js 15's Pages Router and a custom Static Site Generation (SSG) pipeline. A single catch-all route ([[...markdownPath]].js) handles every documentation page by scanning src/content/ for .md files at build time, compiling MDX to JSX, serializing the React tree to JSON, and caching it. On the client, reviveNodeOnClient() deserializes the JSON back into React elements.

Key insight: This custom SSG pipeline predates React Server Components. It compiles MDX server-side, serializes the React tree to JSON, then revives it on the client.

Directory Structure

src/
├── pages/               # Next.js Pages Router
│   ├── _app.tsx         # Root app (providers, analytics)
│   ├── _document.tsx    # HTML shell
│   └── [[...markdownPath]].js  # Catch-all for ALL docs
├── components/
│   ├── Layout/          # Page shell, sidebar, topnav, footer, TOC
│   ├── MDX/             # 50+ custom MDX components
│   └── Icon/            # 30+ SVG icon components
├── hooks/               # Custom React hooks
├── utils/               # Build-time & runtime utilities
├── content/             # All docs as .md files
└── styles/              # Global CSS, Tailwind

2. Component Patterns

Standard: Functional Components with TypeScript Props

Props are defined as named interfaces with string literal unions for constrained values. React.FC is never used.

Variant Map Pattern

Instead of if/else chains, the codebase uses lookup objects (variant maps). Each callout type (Note, Pitfall, Deprecated, etc.) is a configuration entry with title, icon, and styling. Adding a new variant requires no component logic changes.

Icon Components

Each icon is its own component file — no giant icon library. They use currentColor for theming and 1em sizing to respect parent font size. This approach is fully tree-shakeable.

Component Composition via Layout Shell

The Page component orchestrates layout: SEO metadata, TopNav, a three-column grid (Sidebar | Content with Context providers | TOC), and Footer. Context providers wrap only the content area, not the entire app.