# onivue/onivue-resume architecture

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

- Interactive diagram: https://gitdiagram.com/onivue/onivue-resume
- Repository: https://github.com/onivue/onivue-resume

## Overview

##### Main System Components

a) Client-Side Layer:
- Main UI components (found in the /components directory)
- Components logically:
- Template Components (Zen template)
- Form Components (DocForm, SettingsForm)
- Common UI Components (Button, Modal, ColorPicker, etc.)
- PDF Generation Components (PDFViewer)

b) Application Layer:
- This in the middle
- Next.js pages structure (/pages directory)
- API routes (/pages/api)
- State management (Zustand store in /stores)

c) Utility Layer:
- This at the bottom
- Custom hooks (/hooks directory)
- Helper functions (/lib directory)

##### Component Relationships

- Double lines: Two-way interactions

##### Specific Implementation Details

- React Hook Form integration
- Tailwind CSS styling system
- PDF generation system
- Dark mode implementation
- Block-based document system

##### Data Flow Visualization

Flow of data:
- Form data → State management → PDF generation
- User interactions → Form updates → Live preview
- Settings changes → Template rendering

##### Important Elements

- Custom hooks (useClickOutside, useElementSize, etc.)
- State management store (useResumeStore)
- Form handling components
- Template system architecture

##### Architecture Patterns

Following patterns:
- Component composition pattern (shown in Forms structure)
- Hook-based state management
- Client-side rendering architecture
- Modular block system

##### Technical Stack Indicators

- Next.js
- React
- Tailwind CSS
- React Hook Form
- Headless UI

- The modular nature of the component system
- The separation between template logic and form handling
- The PDF generation pipeline
- State management flow
- The block-based document system

Keep the abstraction level focused on the architectural decisions while showing enough detail to understand the component relationships and data flow. This will help developers understand both the high-level structure and the specific implementation details of the resume builder application.

Remember to indicate that this is a client-side heavy application with PDF generation capabilities, which is a crucial architectural characteristic of this project.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        UI[UI Layer]
        Templates[Template System]
        Forms[Form Components]
        CommonUI[Common UI Components]
        PDFGen[PDF Generation]
    end

    subgraph AppLayer[Application Layer]
        Pages[Pages]
        API[API Routes]
        State[State Management]
    end

    subgraph Utils[Utility Layer]
        Hooks[Custom Hooks]
        Helpers[Helper Functions]
    end

    %% Template Components
    subgraph Templates
        ResumeTemp[Resume Template]
        CoverTemp[Cover Letter Template]
        StyleTemp[Template Styling]
    end

    %% Form Components
    subgraph Forms
        DocForm[Document Form]
        SettingsForm[Settings Form]
        BlockMgmt[Block Management]
        FieldGen[Field Generator]
        FormFields[Form Fields]
    end

    %% Common UI Components
    subgraph CommonUI
        Button[Button]
        Modal[Modal]
        ColorPicker[ColorPicker]
        Nav[Navigation]
        TempChooser[Template Chooser]
    end

    %% Form Fields
    subgraph FormFields
        Input[Input]
        TextArea[TextArea]
        FileUpload[File Upload]
        TagInput[Tag Input]
    end

    %% State Management
    subgraph State
        ResumeStore[Resume Store]
        DefaultVals[Default Values]
    end

    %% Pages
    subgraph Pages
        MainPage[Main Page]
        DocPage[Document Page]
    end

    %% Relationships
    Forms --> State
    Templates --> State
    PDFGen --> Templates
    Forms --> Templates
    CommonUI --> Forms
    FormFields --> Forms
    State --> Templates
    Pages --> CommonUI
    Pages --> Forms
    Pages --> Templates
    Utils --> Forms
    Utils --> Templates
    Utils --> CommonUI

    %% Click Events
    click ResumeTemp "https://github.com/onivue/onivue-resume/blob/master/components/Templates/Zen/ResumeZen.tsx"
    click CoverTemp "https://github.com/onivue/onivue-resume/blob/master/components/Templates/Zen/CoverZen.tsx"
    click StyleTemp "https://github.com/onivue/onivue-resume/blob/master/components/Templates/Zen/styleZen.tsx"
    click DocForm "https://github.com/onivue/onivue-resume/blob/master/components/Forms/DocForm/DocForm.tsx"
    click SettingsForm "https://github.com/onivue/onivue-resume/blob/master/components/Forms/SettingsForm/SettingsForm.tsx"
    click BlockMgmt "https://github.com/onivue/onivue-resume/blob/master/components/Forms/DocForm/Blocks.tsx"
    click FieldGen "https://github.com/onivue/onivue-resume/blob/master/components/Forms/DocForm/FieldGenerator.tsx"
    click Button "https://github.com/onivue/onivue-resume/blob/master/components/Button/Button.tsx"
    click Modal "https://github.com/onivue/onivue-resume/blob/master/components/Modal/Modal.tsx"
    click ColorPicker "https://github.com/onivue/onivue-resume/blob/master/components/ColorPicker/ColorPicker.tsx"
    click Nav "https://github.com/onivue/onivue-resume/blob/master/components/Navigation/Navigation.tsx"
    click TempChooser "https://github.com/onivue/onivue-resume/blob/master/components/TemplateChooser/TemplateChooser.tsx"
    click PDFGen "https://github.com/onivue/onivue-resume/blob/master/components/PDFViewer/PDFViewer.tsx"
    click ResumeStore "https://github.com/onivue/onivue-resume/blob/master/stores/useResumeStore.js"
    click DefaultVals "https://github.com/onivue/onivue-resume/blob/master/stores/defaultFormValues.js"
    click Hooks "https://github.com/onivue/onivue-resume/tree/master/hooks"
    click Helpers "https://github.com/onivue/onivue-resume/blob/master/lib/helper.js"
    click MainPage "https://github.com/onivue/onivue-resume/blob/master/pages/index.tsx"
    click DocPage "https://github.com/onivue/onivue-resume/blob/master/pages/doc.tsx"
    click API "https://github.com/onivue/onivue-resume/blob/master/pages/api/hello.ts"
    click Input "https://github.com/onivue/onivue-resume/blob/master/components/Fields/Input.tsx"
    click TextArea "https://github.com/onivue/onivue-resume/blob/master/components/Fields/TextArea.tsx"
    click FileUpload "https://github.com/onivue/onivue-resume/blob/master/components/Fields/FileUpload.tsx"
    click TagInput "https://github.com/onivue/onivue-resume/blob/master/components/Fields/InputTag.tsx"

    %% Styling
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef client fill:#e1f5fe,stroke:#0288d1
    classDef app fill:#f3e5f5,stroke:#7b1fa2
    classDef util fill:#fff3e0,stroke:#ff9800
    classDef component fill:#e8f5e9,stroke:#388e3c
    
    class Client client
    class AppLayer app
    class Utils util
    class Templates,Forms,CommonUI,PDFGen component

    %% Legend
    subgraph Legend
        L1[Client Layer]:::client
        L2[Application Layer]:::app
        L3[Utility Layer]:::util
        L4[Components]:::component
    end
```
