# saadmansakib47/presume architecture

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

- Interactive diagram: https://gitdiagram.com/saadmansakib47/presume
- Repository: https://github.com/saadmansakib47/presume

## Overview

#### Purpose and entry points
Pesume is a Next.js LaTeX resume builder: users select a CV template, edit structured resume data, inspect a visual/LaTeX preview, and export TeX or browser-printed PDF. The primary UI entry is `app/page.tsx`; global application shell and styling originate in `app/layout.tsx` and `app/globals.css`.

#### Client-side builder state
The resume editing workflow is centered on typed CV data and a reusable state hook. `hooks/useCVData.ts` owns or coordinates mutable CV state, while `lib/cv-types.ts` defines the document model and template presets. This creates a boundary between form interactions and render/export implementations.

#### Form composition and data capture
`components/CVForm/CVForm.tsx` is the consolidated editor controller. It composes personal details from `components/CVForm/PersonalInfo.tsx`, section editing from `components/CVForm/BasicSections.tsx`, and visibility/template-related controls from `components/CVForm/SectionToggles.tsx`. Form output feeds the shared CV data model rather than rendering directly into exports.

#### Template selection and visual rendering
The application supports distinct CV layouts rendered as React/HTML: `components/templates/ClassicCV.tsx` provides the two-column classic design, while `components/templates/ProgrammerCV.tsx` provides the technical single-column layout. `components/TemplateBrowserModal.tsx` exposes template choice, with visual assets under `public/templates` and community template metadata at `public/community-templates.json`.

#### Preview and export pipeline
`components/CvPreview.tsx` is the presentation/export boundary: it displays the selected HTML template and exposes generated LaTeX for inspection or download. `lib/latex-template.ts` converts typed CV data into template-specific compile-ready TeX, relying on `lib/latex-utils.ts` for escaping and formatting. Browser print styling in `app/globals.css` produces the PDF-oriented output; `lib/generate-pdf.ts` is the dedicated PDF-generation utility boundary.

#### Server API boundaries
Two Next.js route handlers provide backend extension points: `app/api/chat/route.ts` handles AI-chat requests, and `app/api/generate-cv/route.ts` handles CV-generation requests. These isolate external/service-backed capabilities from the client editor; the repository structure does not establish the specific AI or TeX compilation provider.

#### Runtime and artifacts
The app runs on the Next.js/TypeScript runtime (`next.config.ts`, `package.json`) and is deployable as a standard Next.js application with server route support. TeX source templates and samples are maintained separately from React renderers in `templates/base-moderncv.tex`, `cv-samples/classic-cv.tex`, and `cv-samples/programmer-cv.tex`, enabling local or third-party LaTeX compilation after export.

Main entry points: [`app/page.tsx`](https://github.com/saadmansakib47/presume/blob/main/app/page.tsx) (Resume builder page), [`components/CvPreview.tsx`](https://github.com/saadmansakib47/presume/blob/main/components/CvPreview.tsx) (Preview & export boundary), [`components/CVForm/CVForm.tsx`](https://github.com/saadmansakib47/presume/blob/main/components/CVForm/CVForm.tsx) (CV form controller), [`hooks/useCVData.ts`](https://github.com/saadmansakib47/presume/blob/main/hooks/useCVData.ts) (CV state hook)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Next.js UI"]
  node_app_shell["App shell &amp; styles<br/>Next.js layout<br/>[layout.tsx]"]
  node_home_page["Resume builder page<br/>Next.js page<br/>[page.tsx]"]
end

subgraph group_editor["CV Editor"]
  node_cv_form["CV form controller<br/>React component<br/>[CVForm.tsx]"]
  node_personal_info["Personal details editor<br/>form component<br/>[PersonalInfo.tsx]"]
  node_basic_sections["Section editor<br/>form component<br/>[BasicSections.tsx]"]
  node_section_toggles["Section &amp; visibility controls<br/>form component<br/>[SectionToggles.tsx]"]
  node_cv_state{{"CV state hook<br/>React hook<br/>[useCVData.ts]"}}
  node_cv_model["CV model &amp; presets<br/>TypeScript model<br/>[cv-types.ts]"]
end

subgraph group_rendering["Rendering &amp; Export"]
  node_template_browser["Template browser<br/>React modal"]
  node_template_assets["Template catalog assets<br/>static assets"]
  node_cv_preview["Preview &amp; export boundary<br/>React component<br/>[CvPreview.tsx]"]
  node_classic_cv["Classic CV layout<br/>React template<br/>[ClassicCV.tsx]"]
  node_programmer_cv["Programmer CV layout<br/>React template<br/>[ProgrammerCV.tsx]"]
  node_latex_generator["LaTeX generator<br/>export transformer<br/>[latex-template.ts]"]
  node_latex_utils["LaTeX formatting<br/>[latex-utils.ts]"]
  node_pdf_generator["PDF generation utility<br/>export utility<br/>[generate-pdf.ts]"]
end

subgraph group_server["Server APIs"]
  node_chat_api["AI chat API<br/>Next.js route handler<br/>[route.ts]"]
  node_generate_cv_api["CV generation API<br/>Next.js route handler<br/>[route.ts]"]
end

subgraph group_artifacts["TeX Artifacts"]
  node_tex_base["Base moderncv source<br/>TeX template<br/>[base-moderncv.tex]"]
  node_classic_sample["Classic TeX sample<br/>[classic-cv.tex]"]
  node_programmer_sample["Programmer TeX sample<br/>[programmer-cv.tex]"]
end

node_app_shell -->|"hosts"| node_home_page
node_home_page -->|"uses"| node_cv_state
node_home_page -->|"renders"| node_cv_form
node_home_page -->|"opens"| node_template_browser
node_home_page -->|"renders"| node_cv_preview
node_cv_form -->|"composes"| node_personal_info
node_cv_form -->|"composes"| node_basic_sections
node_cv_form -->|"composes"| node_section_toggles
node_cv_form -->|"updates"| node_cv_state
node_cv_state -->|"uses"| node_cv_model
node_template_browser -->|"reads catalog"| node_template_assets
node_template_browser -->|"selects template"| node_cv_state
node_cv_state -->|"supplies CV data"| node_cv_preview
node_cv_preview -->|"renders selected layout"| node_classic_cv
node_cv_preview -->|"renders selected layout"| node_programmer_cv
node_cv_preview -->|"exports TeX"| node_latex_generator
node_latex_generator -->|"formats values"| node_latex_utils
node_cv_preview -->|"generates PDF"| node_pdf_generator
node_app_shell -.->|"print styles"| node_pdf_generator
node_latex_generator -.->|"aligns with"| node_tex_base
node_tex_base -.->|"supports sample"| node_classic_sample
node_tex_base -.->|"supports sample"| node_programmer_sample
node_home_page -.->|"AI requests"| node_chat_api
node_home_page -.->|"generation requests"| node_generate_cv_api

click node_app_shell "https://github.com/saadmansakib47/presume/blob/main/app/layout.tsx"
click node_home_page "https://github.com/saadmansakib47/presume/blob/main/app/page.tsx"
click node_cv_form "https://github.com/saadmansakib47/presume/blob/main/components/CVForm/CVForm.tsx"
click node_personal_info "https://github.com/saadmansakib47/presume/blob/main/components/CVForm/PersonalInfo.tsx"
click node_basic_sections "https://github.com/saadmansakib47/presume/blob/main/components/CVForm/BasicSections.tsx"
click node_section_toggles "https://github.com/saadmansakib47/presume/blob/main/components/CVForm/SectionToggles.tsx"
click node_cv_state "https://github.com/saadmansakib47/presume/blob/main/hooks/useCVData.ts"
click node_cv_model "https://github.com/saadmansakib47/presume/blob/main/lib/cv-types.ts"
click node_template_browser "https://github.com/saadmansakib47/presume/blob/main/components/TemplateBrowserModal.tsx"
click node_template_assets "https://github.com/saadmansakib47/presume/tree/main/public/templates"
click node_cv_preview "https://github.com/saadmansakib47/presume/blob/main/components/CvPreview.tsx"
click node_classic_cv "https://github.com/saadmansakib47/presume/blob/main/components/templates/ClassicCV.tsx"
click node_programmer_cv "https://github.com/saadmansakib47/presume/blob/main/components/templates/ProgrammerCV.tsx"
click node_latex_generator "https://github.com/saadmansakib47/presume/blob/main/lib/latex-template.ts"
click node_latex_utils "https://github.com/saadmansakib47/presume/blob/main/lib/latex-utils.ts"
click node_pdf_generator "https://github.com/saadmansakib47/presume/blob/main/lib/generate-pdf.ts"
click node_chat_api "https://github.com/saadmansakib47/presume/blob/main/app/api/chat/route.ts"
click node_generate_cv_api "https://github.com/saadmansakib47/presume/blob/main/app/api/generate-cv/route.ts"
click node_tex_base "https://github.com/saadmansakib47/presume/blob/main/templates/base-moderncv.tex"
click node_classic_sample "https://github.com/saadmansakib47/presume/blob/main/cv-samples/classic-cv.tex"
click node_programmer_sample "https://github.com/saadmansakib47/presume/blob/main/cv-samples/programmer-cv.tex"

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_app_shell,node_home_page toneBlue
class node_cv_form,node_personal_info,node_basic_sections,node_section_toggles,node_cv_state,node_cv_model toneAmber
class node_template_browser,node_template_assets,node_cv_preview,node_classic_cv,node_programmer_cv,node_latex_generator,node_latex_utils,node_pdf_generator toneMint
class node_chat_api,node_generate_cv_api toneRose
class node_tex_base,node_classic_sample,node_programmer_sample toneIndigo
```

## Components

### Next.js UI

- [App shell & styles](https://github.com/saadmansakib47/presume/blob/main/app/layout.tsx): Next.js layout · Global shell and screen/print styling. · `app/layout.tsx`
- [Resume builder page](https://github.com/saadmansakib47/presume/blob/main/app/page.tsx): Next.js page · Primary client entry point. · `app/page.tsx`

### CV Editor

- [CV form controller](https://github.com/saadmansakib47/presume/blob/main/components/CVForm/CVForm.tsx): React component · Composes structured resume editing. · `components/CVForm/CVForm.tsx`
- [Personal details editor](https://github.com/saadmansakib47/presume/blob/main/components/CVForm/PersonalInfo.tsx): form component · `components/CVForm/PersonalInfo.tsx`
- [Section editor](https://github.com/saadmansakib47/presume/blob/main/components/CVForm/BasicSections.tsx): form component · `components/CVForm/BasicSections.tsx`
- [Section & visibility controls](https://github.com/saadmansakib47/presume/blob/main/components/CVForm/SectionToggles.tsx): form component · `components/CVForm/SectionToggles.tsx`
- [CV state hook](https://github.com/saadmansakib47/presume/blob/main/hooks/useCVData.ts): React hook · Owns mutable document state. · `hooks/useCVData.ts`
- [CV model & presets](https://github.com/saadmansakib47/presume/blob/main/lib/cv-types.ts): TypeScript model · Typed document schema and template presets. · `lib/cv-types.ts`

### Rendering & Export

- [Template browser](https://github.com/saadmansakib47/presume/blob/main/components/TemplateBrowserModal.tsx): React modal · Selects available CV layouts. · `components/TemplateBrowserModal.tsx`
- [Template catalog assets](https://github.com/saadmansakib47/presume/tree/main/public/templates): static assets · Preview assets and community metadata. · `public/templates`
- [Preview & export boundary](https://github.com/saadmansakib47/presume/blob/main/components/CvPreview.tsx): React component · Displays HTML layout and exposes TeX export. · `components/CvPreview.tsx`
- [Classic CV layout](https://github.com/saadmansakib47/presume/blob/main/components/templates/ClassicCV.tsx): React template · Two-column HTML resume. · `components/templates/ClassicCV.tsx`
- [Programmer CV layout](https://github.com/saadmansakib47/presume/blob/main/components/templates/ProgrammerCV.tsx): React template · Technical single-column HTML resume. · `components/templates/ProgrammerCV.tsx`
- [LaTeX generator](https://github.com/saadmansakib47/presume/blob/main/lib/latex-template.ts): export transformer · Builds template-specific compile-ready TeX. · `lib/latex-template.ts`
- [LaTeX formatting](https://github.com/saadmansakib47/presume/blob/main/lib/latex-utils.ts): utility · Escapes and formats TeX values. · `lib/latex-utils.ts`
- [PDF generation utility](https://github.com/saadmansakib47/presume/blob/main/lib/generate-pdf.ts): export utility · Dedicated PDF-generation boundary. · `lib/generate-pdf.ts`

### Server APIs

- [AI chat API](https://github.com/saadmansakib47/presume/blob/main/app/api/chat/route.ts): Next.js route handler · Isolates service-backed chat requests. · `app/api/chat/route.ts`
- [CV generation API](https://github.com/saadmansakib47/presume/blob/main/app/api/generate-cv/route.ts): Next.js route handler · Isolates service-backed CV generation. · `app/api/generate-cv/route.ts`

### TeX Artifacts

- [Base moderncv source](https://github.com/saadmansakib47/presume/blob/main/templates/base-moderncv.tex): TeX template · `templates/base-moderncv.tex`
- [Classic TeX sample](https://github.com/saadmansakib47/presume/blob/main/cv-samples/classic-cv.tex): TeX sample · `cv-samples/classic-cv.tex`
- [Programmer TeX sample](https://github.com/saadmansakib47/presume/blob/main/cv-samples/programmer-cv.tex): TeX sample · `cv-samples/programmer-cv.tex`

## Connections

- App shell & styles → Resume builder page: hosts
- Resume builder page → CV state hook: uses
- Resume builder page → CV form controller: renders
- Resume builder page → Template browser: opens
- Resume builder page → Preview & export boundary: renders
- CV form controller → Personal details editor: composes
- CV form controller → Section editor: composes
- CV form controller → Section & visibility controls: composes
- CV form controller → CV state hook: updates
- CV state hook → CV model & presets: uses
- Template browser → Template catalog assets: reads catalog
- Template browser → CV state hook: selects template
- CV state hook → Preview & export boundary: supplies CV data
- Preview & export boundary → Classic CV layout: renders selected layout
- Preview & export boundary → Programmer CV layout: renders selected layout
- Preview & export boundary → LaTeX generator: exports TeX
- LaTeX generator → LaTeX formatting: formats values
- Preview & export boundary → PDF generation utility: generates PDF
- App shell & styles → PDF generation utility: print styles · Global print CSS supports browser PDF output.
- LaTeX generator → Base moderncv source: aligns with
- Base moderncv source → Classic TeX sample: supports sample
- Base moderncv source → Programmer TeX sample: supports sample
- Resume builder page → AI chat API: AI requests
- Resume builder page → CV generation API: generation requests
