> ## Documentation Index
> Fetch the complete documentation index at: https://docs.magic-resume.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# Architecture overview

> A high-level map of the Magic Resume codebase — workspaces, data flow, and where to look when you touch X.

Magic Resume is built around four ideas that show up everywhere in the code:

1. **The resume is a typed value.** A single Zod schema in `@magic-resume/resume-schema` describes what a resume is. The web app, the MCP server, and the AI agents all read and write that same shape.
2. **The browser is the database.** In self-hosted mode there is no server-side persistence. IndexedDB (`MagicResumeDB`) is the source of truth. Cloud sync is an optional one-way push to the Core API.
3. **Auth is feature-flagged.** `NEXT_PUBLIC_APP_MODE` chooses at build time whether Clerk middleware and the cloud sync layer are loaded. The same UI runs in both modes.
4. **Edits are patches.** MCP tools mutate resumes via JSON Patch (`fast-json-patch`), validated against the schema before they touch storage. The web editor produces patches too — it's the same code path.

## Data flow at a glance

```
                ┌───────────────┐
   User input ─▶│  Editor (UI)  │
                └───────┬───────┘
                        │ Zustand action
                        ▼
                ┌───────────────┐    write    ┌────────────┐
                │ useResumeStore├────────────▶│ IndexedDB  │
                └───────┬───────┘             └────────────┘
                        │ (cloud mode only)
                        ▼
                ┌───────────────┐    PATCH    ┌────────────┐
                │  httpClient   ├────────────▶│  Core API  │
                └───────────────┘             └────────────┘

   AI tool ────▶ @magic-resume/mcp ──▶ Core API (PAT auth)
```

## Where to look

<CardGroup>
  <Card title="Monorepo layout" href="/en/architecture/monorepo" />

  <Card title="Deployment modes" href="/en/architecture/deployment-modes" />

  <Card title="State management" href="/en/architecture/state-management" />

  <Card title="HTTP clients" href="/en/architecture/http-clients" />

  <Card title="Resume schema" href="/en/architecture/resume-schema" />

  <Card title="Template system" href="/en/architecture/templates" />
</CardGroup>
