# maheshkalaga175/frontend architecture

> Architecture diagram of the GitHub repository maheshkalaga175/frontend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/maheshkalaga175/frontend
- Repository: https://github.com/maheshkalaga175/frontend

## Overview

This is a Next.js Figma-to-CMS block authoring application. A user submits a Figma design from the dashboard; the generation API extracts design information, creates block files, and can commit changes. The dashboard also supports matching/reusing existing blocks, code review and fixes, while generated block previews fetch live CMS content through the GraphQL integration. The tree and excerpts support these major paths, but do not establish every route’s caller or the full CMS deployment lifecycle; unsupported connections are omitted.

Main entry points: [`app/api/generate/confirm/route.ts`](https://github.com/maheshkalaga175/frontend/blob/main/app/api/generate/confirm/route.ts) (Generation confirmation), [`app/api/generate/route.ts`](https://github.com/maheshkalaga175/frontend/blob/main/app/api/generate/route.ts) (Generate API), [`app/dashboard/page.tsx`](https://github.com/maheshkalaga175/frontend/blob/main/app/dashboard/page.tsx) (Authoring dashboard), [`lib/figma/figma-mcp-client.ts`](https://github.com/maheshkalaga175/frontend/blob/main/lib/figma/figma-mcp-client.ts) (Figma MCP client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_authoring["Authoring"]
  node_dashboard["Authoring dashboard<br/>[page.tsx]"]
  node_contentauthoring["Content authoring<br/>[page.tsx]"]
  node_reporting["Reporting dashboard<br/>[page.tsx]"]
end

subgraph group_generation["Design generation"]
  node_generate["Generate API<br/>[route.ts]"]
  node_figma["Figma API client<br/>[figma-api.ts]"]
  node_figmamcp["Figma MCP client"]
  node_classifier["Design classifier<br/>[classifier.ts]"]
  node_blockmatch["Block matching<br/>[field-matcher.ts]"]
  node_visualmatch["Visual matching<br/>[visual-matcher.ts]"]
  node_catalog["Block catalog<br/>[catalog.ts]"]
  node_writer["Block file writer<br/>[writeBlockFiles.ts]"]
  node_confirm["Generation confirmation<br/>[route.ts]"]
end

subgraph group_review["Review and persistence"]
  node_git["GitHub persistence<br/>[github.ts]"]
  node_reviewui["Code review panel"]
  node_reviewapi["Review endpoints<br/>[route.ts]"]
  node_autofix["Auto-fix endpoint<br/>[route.ts]"]
  node_reviewpaths["Review file paths<br/>[reviewPaths.ts]"]
end

subgraph group_content["CMS content"]
  node_contentgraph["Content graph API<br/>[route.ts]"]
  node_normalize["Graph normalization<br/>[normalize.ts]"]
  node_blockdata["Live block data<br/>[useBlockData.ts]"]
  node_indexgate["Indexing gate<br/>[useIndexingGate.ts]"]
  node_preview["Block previews<br/>[page.tsx]"]
end

node_user(("Author"))
node_figmaexternal["Figma"]
node_cms["Optimizely Graph"]

node_user -->|"starts authoring"| node_dashboard
node_dashboard -->|"submits design"| node_generate
node_generate -->|"parses URL"| node_figma
node_generate -->|"fetches design"| node_figmamcp
node_figmamcp -->|"parses URL"| node_figma
node_figmamcp -->|"requests design"| node_figmaexternal
node_generate -->|"extracts design"| node_classifier
node_generate -->|"writes block files"| node_writer
node_generate -->|"commits report"| node_git
node_confirm -->|"reuses classification"| node_classifier
node_confirm -->|"checks blocks"| node_catalog
node_confirm -->|"matches fields"| node_blockmatch
node_confirm -->|"compares layouts"| node_visualmatch
node_confirm -->|"writes files"| node_writer
node_confirm -->|"returns decision"| node_dashboard
node_dashboard -->|"marks indexing"| node_indexgate
node_dashboard -->|"shows review"| node_reviewui
node_reviewui -.->|"requests review"| node_reviewapi
node_reviewui -.->|"requests fixes"| node_autofix
node_reviewapi -->|"resolves files"| node_reviewpaths
node_autofix -->|"resolves files"| node_reviewpaths
node_autofix -->|"updates files"| node_git
node_preview -->|"loads data"| node_blockdata
node_blockdata -->|"reshapes results"| node_normalize
node_blockdata -.->|"queries content"| node_contentgraph
node_contentgraph -->|"normalizes values"| node_normalize
node_contentgraph -->|"queries graph"| node_cms
node_indexgate -.->|"checks indexing"| node_cms

click node_dashboard "https://github.com/maheshkalaga175/frontend/blob/main/app/dashboard/page.tsx"
click node_contentauthoring "https://github.com/maheshkalaga175/frontend/blob/main/app/dashboard/contentauthoring/page.tsx"
click node_reporting "https://github.com/maheshkalaga175/frontend/blob/main/app/dashboard/reporting/page.tsx"
click node_generate "https://github.com/maheshkalaga175/frontend/blob/main/app/api/generate/route.ts"
click node_figma "https://github.com/maheshkalaga175/frontend/blob/main/lib/figma/figma-api.ts"
click node_figmamcp "https://github.com/maheshkalaga175/frontend/blob/main/lib/figma/figma-mcp-client.ts"
click node_classifier "https://github.com/maheshkalaga175/frontend/blob/main/lib/ai/classifier.ts"
click node_blockmatch "https://github.com/maheshkalaga175/frontend/blob/main/lib/blocks/field-matcher.ts"
click node_visualmatch "https://github.com/maheshkalaga175/frontend/blob/main/lib/blocks/visual-matcher.ts"
click node_catalog "https://github.com/maheshkalaga175/frontend/blob/main/lib/blocks/catalog.ts"
click node_writer "https://github.com/maheshkalaga175/frontend/blob/main/lib/blocks/writeBlockFiles.ts"
click node_confirm "https://github.com/maheshkalaga175/frontend/blob/main/app/api/generate/confirm/route.ts"
click node_git "https://github.com/maheshkalaga175/frontend/blob/main/lib/blocks/github.ts"
click node_reviewui "https://github.com/maheshkalaga175/frontend/blob/main/components/CodeReviewPanel.tsx"
click node_reviewapi "https://github.com/maheshkalaga175/frontend/blob/main/app/api/review/route.ts"
click node_autofix "https://github.com/maheshkalaga175/frontend/blob/main/app/api/auto-fix/route.ts"
click node_reviewpaths "https://github.com/maheshkalaga175/frontend/blob/main/lib/reviewPaths.ts"
click node_contentgraph "https://github.com/maheshkalaga175/frontend/blob/main/app/api/content-graph/route.ts"
click node_normalize "https://github.com/maheshkalaga175/frontend/blob/main/lib/graphql/normalize.ts"
click node_blockdata "https://github.com/maheshkalaga175/frontend/blob/main/lib/graphql/useBlockData.ts"
click node_indexgate "https://github.com/maheshkalaga175/frontend/blob/main/lib/graphql/useIndexingGate.ts"
click node_preview "https://github.com/maheshkalaga175/frontend/blob/main/app/preview/imagebanner/page.tsx"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dashboard,node_contentauthoring,node_reporting toneBlue
class node_generate,node_figma,node_figmamcp,node_classifier,node_blockmatch,node_visualmatch,node_catalog,node_writer,node_confirm toneAmber
class node_git,node_reviewui,node_reviewapi,node_autofix,node_reviewpaths toneMint
class node_contentgraph,node_normalize,node_blockdata,node_indexgate,node_preview toneRose
class node_user,node_figmaexternal,node_cms toneIndigo
```

## Components

### Authoring

- [Authoring dashboard](https://github.com/maheshkalaga175/frontend/blob/main/app/dashboard/page.tsx): `app/dashboard/page.tsx`
- [Content authoring](https://github.com/maheshkalaga175/frontend/blob/main/app/dashboard/contentauthoring/page.tsx): `app/dashboard/contentauthoring/page.tsx`
- [Reporting dashboard](https://github.com/maheshkalaga175/frontend/blob/main/app/dashboard/reporting/page.tsx): `app/dashboard/reporting/page.tsx`

### Design generation

- [Generate API](https://github.com/maheshkalaga175/frontend/blob/main/app/api/generate/route.ts): `app/api/generate/route.ts`
- [Figma API client](https://github.com/maheshkalaga175/frontend/blob/main/lib/figma/figma-api.ts): `lib/figma/figma-api.ts`
- [Figma MCP client](https://github.com/maheshkalaga175/frontend/blob/main/lib/figma/figma-mcp-client.ts): `lib/figma/figma-mcp-client.ts`
- [Design classifier](https://github.com/maheshkalaga175/frontend/blob/main/lib/ai/classifier.ts): `lib/ai/classifier.ts`
- [Block matching](https://github.com/maheshkalaga175/frontend/blob/main/lib/blocks/field-matcher.ts): `lib/blocks/field-matcher.ts`
- [Visual matching](https://github.com/maheshkalaga175/frontend/blob/main/lib/blocks/visual-matcher.ts): `lib/blocks/visual-matcher.ts`
- [Block catalog](https://github.com/maheshkalaga175/frontend/blob/main/lib/blocks/catalog.ts): `lib/blocks/catalog.ts`
- [Block file writer](https://github.com/maheshkalaga175/frontend/blob/main/lib/blocks/writeBlockFiles.ts): `lib/blocks/writeBlockFiles.ts`
- [Generation confirmation](https://github.com/maheshkalaga175/frontend/blob/main/app/api/generate/confirm/route.ts): `app/api/generate/confirm/route.ts`

### Review and persistence

- [GitHub persistence](https://github.com/maheshkalaga175/frontend/blob/main/lib/blocks/github.ts): `lib/blocks/github.ts`
- [Code review panel](https://github.com/maheshkalaga175/frontend/blob/main/components/CodeReviewPanel.tsx): `components/CodeReviewPanel.tsx`
- [Review endpoints](https://github.com/maheshkalaga175/frontend/blob/main/app/api/review/route.ts): `app/api/review/route.ts`
- [Auto-fix endpoint](https://github.com/maheshkalaga175/frontend/blob/main/app/api/auto-fix/route.ts): `app/api/auto-fix/route.ts`
- [Review file paths](https://github.com/maheshkalaga175/frontend/blob/main/lib/reviewPaths.ts): `lib/reviewPaths.ts`

### CMS content

- [Content graph API](https://github.com/maheshkalaga175/frontend/blob/main/app/api/content-graph/route.ts): `app/api/content-graph/route.ts`
- [Graph normalization](https://github.com/maheshkalaga175/frontend/blob/main/lib/graphql/normalize.ts): `lib/graphql/normalize.ts`
- [Live block data](https://github.com/maheshkalaga175/frontend/blob/main/lib/graphql/useBlockData.ts): `lib/graphql/useBlockData.ts`
- [Indexing gate](https://github.com/maheshkalaga175/frontend/blob/main/lib/graphql/useIndexingGate.ts): `lib/graphql/useIndexingGate.ts`
- [Block previews](https://github.com/maheshkalaga175/frontend/blob/main/app/preview/imagebanner/page.tsx): `app/preview/imagebanner/page.tsx`

### Other components

- **Author**
- **Figma**
- **Optimizely Graph**

## Connections

- Author → Authoring dashboard: starts authoring (evidence: `app/dashboard/page.tsx`)
- Authoring dashboard → Generate API: submits design (evidence: `app/dashboard/page.tsx`)
- Generate API → Figma API client: parses URL (evidence: `app/api/generate/route.ts`)
- Generate API → Figma MCP client: fetches design (evidence: `app/api/generate/route.ts`)
- Figma MCP client → Figma API client: parses URL (evidence: `lib/figma/figma-mcp-client.ts`)
- Figma MCP client → Figma: requests design (evidence: `lib/figma/figma-mcp-client.ts`)
- Generate API → Design classifier: extracts design (evidence: `app/api/generate/route.ts`)
- Generate API → Block file writer: writes block files (evidence: `app/api/generate/route.ts`)
- Generate API → GitHub persistence: commits report (evidence: `app/api/generate/route.ts`)
- Generation confirmation → Design classifier: reuses classification (evidence: `app/api/generate/confirm/route.ts`)
- Generation confirmation → Block catalog: checks blocks (evidence: `app/api/generate/confirm/route.ts`)
- Generation confirmation → Block matching: matches fields (evidence: `app/api/generate/confirm/route.ts`)
- Generation confirmation → Visual matching: compares layouts (evidence: `app/api/generate/confirm/route.ts`)
- Generation confirmation → Block file writer: writes files (evidence: `app/api/generate/confirm/route.ts`)
- Generation confirmation → Authoring dashboard: returns decision (evidence: `app/dashboard/page.tsx`)
- Authoring dashboard → Indexing gate: marks indexing (evidence: `app/dashboard/page.tsx`)
- Authoring dashboard → Code review panel: shows review (evidence: `app/dashboard/page.tsx`)
- Code review panel → Review endpoints: requests review
- Code review panel → Auto-fix endpoint: requests fixes
- Review endpoints → Review file paths: resolves files (evidence: `app/api/review/route.ts`)
- Auto-fix endpoint → Review file paths: resolves files (evidence: `app/api/auto-fix/route.ts`)
- Auto-fix endpoint → GitHub persistence: updates files (evidence: `app/api/auto-fix/route.ts`)
- Block previews → Live block data: loads data (evidence: `app/preview/imagebanner/page.tsx`)
- Live block data → Graph normalization: reshapes results (evidence: `lib/graphql/useBlockData.ts`)
- Live block data → Content graph API: queries content
- Content graph API → Graph normalization: normalizes values (evidence: `app/api/content-graph/route.ts`)
- Content graph API → Optimizely Graph: queries graph (evidence: `app/api/content-graph/route.ts`)
- Indexing gate → Optimizely Graph: checks indexing
