# remix-run/react-router-templates architecture

> Architecture diagram of the GitHub repository remix-run/react-router-templates, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/remix-run/react-router-templates
- Repository: https://github.com/remix-run/react-router-templates

## Overview

##### Project type and purpose
- This is a monorepo for an open-source CLI tool (“create-react-router”) that ships multiple full-stack React Router starter templates (default, minimal, JavaScript-only, Node custom server, Node-Postgres, Cloudflare, Cloudflare-D1, Vercel, Netlify, Deno).
- The goal is to scaffold new React Router applications with various runtimes, DB integrations, and deployment targets.

##### File structure
- Top‐level:
- .github/workflows/ci.yml – CI pipeline for linting/tests.
- pnpm-workspace.yaml & pnpm-lock.yaml – monorepo package management.
- /README.md – root documentation.
- /.tests – Playwright end-to-end tests covering all templates.
- Per-template folders (e.g., default/, minimal/, cloudflare/, cloudflare-d1/, node-postgres/, etc.) each contain:
- app/ – React Router routes & UI.
- public/ – static assets.
- server or workers/ or server.ts / server.js – SSR entry point for the chosen runtime.
- vite.config.ts/js, tsconfig, package.json – build and type config.
- deployment config (Dockerfile, netlify.toml, wrangler.jsonc, vercel config).
- database/ + drizzle.config.ts in DB-backed templates.

##### README for additional insights
- The README lists each template’s purpose, features, and CLI invocation patterns.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Entrypoint
    CLI["create-react-router CLI"]:::cli

    %% Monorepo Workspace
    subgraph "Monorepo Workspace"
        direction TB
        PM["pnpm-workspace.yaml & pnpm-lock.yaml"]:::mon
        RD["README.md"]:::mon
        TE[".tests/ (Playwright)"]:::ci
    end

    %% Template Packages
    subgraph "Template Packages"
        direction TB
        DFT["Default Template"]:::tpl
        MIN["Minimal Template"]:::tpl
        JS["JavaScript-only Template"]:::tpl
        NCS["Node Custom Server Template"]:::tpl
        NP["Node-Postgres Template"]:::tpl
        CF["Cloudflare Workers Template"]:::tpl
        CD1["Cloudflare D1 Template"]:::tpl
        NL["Netlify Functions Template"]:::tpl
        VC["Vercel Functions Template"]:::tpl
        DN["Deno Template"]:::tpl
    end

    %% Example: Default Template Architecture
    subgraph "Example: Default Template Architecture"
        direction TB
        UI["React Router UI (app/)"]:::frontend
        VITE["Vite Build"]:::frontend
        SRV["Node.js Server (server/ Docker)"]:::server
        STATIC["public/ Static Assets"]:::frontend
    end

    %% Example: Node-Postgres Architecture
    subgraph "Example: Node-Postgres Architecture"
        direction TB
        UI2["React Router UI (app/)"]:::frontend
        VITE2["Vite Build"]:::frontend
        SRV2["Node.js Express SSR"]:::server
        DB2["Postgres + Drizzle ORM"]:::db
        MIG["Drizzle Migrations"]:::db
        STATIC2["public/ Static Assets"]:::frontend
    end

    %% DevOps & External Services
    subgraph "DevOps & External Services"
        direction TB
        CI["GitHub Actions CI"]:::ci
        PW["Playwright Runner"]:::ci
        NPM["NPM Registry"]:::cloud
        CFplt["Cloudflare Platform"]:::cloud
        VCRT["Vercel Platform"]:::cloud
        NET["Netlify Platform"]:::cloud
    end

    %% User File System
    UserFS((User Files)):::userfs

    %% Relationships
    CLI -->|"reads templates"| DFT
    CLI -->|"reads templates"| MIN
    CLI -->|"reads templates"| JS
    CLI -->|"reads templates"| NCS
    CLI -->|"reads templates"| NP
    CLI -->|"reads templates"| CF
    CLI -->|"reads templates"| CD1
    CLI -->|"reads templates"| NL
    CLI -->|"reads templates"| VC
    CLI -->|"reads templates"| DN
    CLI -->|"generates scaffold"| UserFS

    DFT --> UI
    UI --> VITE
    VITE --> SRV
    SRV --> STATIC
    SRV --> UI

    NP --> UI2
    UI2 --> VITE2
    VITE2 --> SRV2
    SRV2 --> STATIC2
    SRV2 --> DB2
    DB2 --> MIG

    CI --> PM
    CI --> RD
    CI --> TE
    CI --> DFT
    CI --> NP

    PW --> TE

    DFT -.-> NPM
    MIN -.-> NPM
    JS -.-> NPM
    NCS -.-> NPM
    NP -.-> NPM
    CF -.-> NPM
    CD1 -.-> NPM
    NL -.-> NPM
    VC -.-> NPM
    DN -.-> NPM

    CFplt -.-> CF
    VCRT -.-> VC
    NET -.-> NL

    %% Click Events
    click CI "https://github.com/remix-run/react-router-templates/blob/main/.github/workflows/ci.yml"
    click PM "https://github.com/remix-run/react-router-templates/blob/main/pnpm-workspace.yaml"
    click PM "https://github.com/remix-run/react-router-templates/blob/main/pnpm-lock.yaml"
    click RD "https://github.com/remix-run/react-router-templates/blob/main/README.md"
    click TE "https://github.com/remix-run/react-router-templates/tree/main/.tests/"
    click DFT "https://github.com/remix-run/react-router-templates/tree/main/default/"
    click MIN "https://github.com/remix-run/react-router-templates/tree/main/minimal/"
    click JS "https://github.com/remix-run/react-router-templates/tree/main/javascript/"
    click NCS "https://github.com/remix-run/react-router-templates/tree/main/node-custom-server/"
    click NP "https://github.com/remix-run/react-router-templates/tree/main/node-postgres/"
    click CF "https://github.com/remix-run/react-router-templates/tree/main/cloudflare/"
    click CD1 "https://github.com/remix-run/react-router-templates/tree/main/cloudflare-d1/"
    click NL "https://github.com/remix-run/react-router-templates/tree/main/netlify/"
    click VC "https://github.com/remix-run/react-router-templates/tree/main/vercel/"
    click DN "https://github.com/remix-run/react-router-templates/tree/main/deno/"

    %% Styles
    classDef cli fill:#e0f2f1,stroke:#00695c,stroke-width:2px,shape:hexagon
    classDef mon fill:#e8f5e9,stroke:#2e7d32,stroke-width:1px
    classDef tpl fill:#e3f2fd,stroke:#1e88e5,stroke-width:1px
    classDef frontend fill:#fff9c4,stroke:#fbc02d,stroke-width:1px
    classDef server fill:#ffe0b2,stroke:#fb8c00,stroke-width:1px
    classDef db fill:#f8bbd0,stroke:#d81b60,stroke-width:1px,shape:cylinder
    classDef ci fill:#eceff1,stroke:#607d8b,stroke-width:1px
    classDef cloud fill:#f3e5f5,stroke:#8e24aa,stroke-width:1px,shape:cloud
    classDef userfs fill:#ffffff,stroke:#000000,stroke-dasharray: 2 2px
```
