# mikeheul/next-cv-maker architecture

> Architecture diagram of the GitHub repository mikeheul/next-cv-maker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-02-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mikeheul/next-cv-maker
- Repository: https://github.com/mikeheul/next-cv-maker

## Overview

##### Main Components

A. Frontend Layer:
- Client-side Components (/components)
- Core Components (CandidateCard, CandidateForm, ExperienceCard, etc.)
- UI Components (/components/ui)
- Pages Layer (/app)
- Main pages
- Dynamic routes ([candidateId])

B. API Layer (/app/api):
- RESTful endpoints
- API Routes structure
- Custom hooks for data fetching

C. Database Layer:
- Prisma ORM
- Database schema (candidates, experiences)

D. Utility Layer:
- Validation (Zod)
- Utils and Helpers

**[Client Layer]**
- ↕
**[API Layer]**
- ↕
**[Database Layer]**

##### Detailed Component Relationships

Frontend:
- Relationship between pages and components
- Client-side state management
- Routing structure

API Layer:
- RESTful endpoints
- Connection to database through Prisma
- Custom hooks integration

Database:
- Prisma schema relationships
- Main entities (Candidate, Experience)

##### Key Flows to Highlight

A. CV Generation Flow:
**User Interface → API Endpoints → Database → Generated CV**

B. Data Management Flow:
**Forms → API Routes → Prisma ORM → Database**

##### Important Technical Elements

- Next.js App Router structure
- API route handlers
- Prisma client integration
- Tailwind CSS styling system
- Type system (TypeScript)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Pages["Pages"]
        CoreComponents["Core Components"]
        UIComponents["UI Components"]
        
        Pages --> CoreComponents
        Pages --> UIComponents
        CoreComponents --> UIComponents
    end

    subgraph API
        CandidateAPI["Candidate API"]
        ExperienceAPI["Experience API"]
        CVGenAPI["CV Generation API"]
        DataHooks["Data Fetching Hooks"]
        
        CandidateAPI --> DataHooks
        ExperienceAPI --> DataHooks
    end

    subgraph Database
        PrismaORM["Prisma ORM"]
        DBSchema["Database Schema"]
        
        PrismaORM --> DBSchema
    end

    subgraph Utils
        Validation["Validation Layer"]
        UtilFunctions["Utility Functions"]
        TypeDefs["Type Definitions"]
        Actions["Actions Layer"]
    end

    Pages --> CandidateAPI
    Pages --> ExperienceAPI
    Pages --> CVGenAPI
    
    CandidateAPI --> PrismaORM
    ExperienceAPI --> PrismaORM
    CVGenAPI --> PrismaORM
    
    CoreComponents --> Validation
    CandidateAPI --> Validation
    ExperienceAPI --> Validation

    %% Component Mappings
    click Pages "https://github.com/mikeheul/next-cv-maker/blob/master//app/page.tsx"
    click CoreComponents "https://github.com/mikeheul/next-cv-maker/tree/master//components"
    click UIComponents "https://github.com/mikeheul/next-cv-maker/tree/master//components/ui"
    click CandidateAPI "https://github.com/mikeheul/next-cv-maker/blob/master//app/api/candidate/route.ts"
    click ExperienceAPI "https://github.com/mikeheul/next-cv-maker/blob/master//app/api/experience/route.ts"
    click CVGenAPI "https://github.com/mikeheul/next-cv-maker/blob/master//app/api/candidate/[candidateId]/cv/route.ts"
    click DataHooks "https://github.com/mikeheul/next-cv-maker/tree/master//app/api/candidate/hooks"
    click PrismaORM "https://github.com/mikeheul/next-cv-maker/blob/master//lib/db.ts"
    click DBSchema "https://github.com/mikeheul/next-cv-maker/blob/master//prisma/schema/schema.prisma"
    click Validation "https://github.com/mikeheul/next-cv-maker/blob/master//lib/validation.ts"
    click UtilFunctions "https://github.com/mikeheul/next-cv-maker/blob/master//lib/utils.ts"
    click TypeDefs "https://github.com/mikeheul/next-cv-maker/blob/master//types/types.ts"
    click Actions "https://github.com/mikeheul/next-cv-maker/blob/master//app/actions/experienceActions.ts"

    classDef frontend fill:#3b82f6,color:#fff
    classDef api fill:#22c55e,color:#fff
    classDef database fill:#a855f7,color:#fff
    classDef utils fill:#64748b,color:#fff

    class Pages,CoreComponents,UIComponents frontend
    class CandidateAPI,ExperienceAPI,CVGenAPI,DataHooks api
    class PrismaORM,DBSchema database
    class Validation,UtilFunctions,TypeDefs,Actions utils
```
