# nikeshcohen/profileprep architecture

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

- Interactive diagram: https://gitdiagram.com/nikeshcohen/profileprep
- Repository: https://github.com/nikeshcohen/profileprep

## Overview

##### Project Type & Purpose
- ProfilePrep is a full-stack, AI-powered recruitment platform built with Next.js. It helps recruiters transform standard CVs into professionally enhanced profiles through AI-based processing, document management, and template systems.
- The README outlines key features such as CV generation, management, template configuration, and role-based access control (USER, ADMIN, SUPERADMIN). These give a clear signal that you’re dealing with a full-stack web application that integrates both user interfaces and backend processing.

##### Main Components
a. Frontend UI:
– Illustrate the “app” directory structure which includes subdirectories for login, onboarding, dashboard, error handling, etc.
– Include “components” and “providers” (e.g., QueryProvider, ThemeProvider) as part of the UI layer.

b. API & Backend:
– Include the “actions” directory which contains business logic for admin, auth, AI processing, and queries that drive core features like CV generation and management.
– Connect the API endpoints with these business actions to illustrate how the UI triggers backend operations.

c. Database Layer:
– Represent the database component, highlighting the Prisma ORM. Show the connection between the backend layer and the database.
– Indicate the “prisma” directory which contains migrations, schemas (auth.prisma, company.prisma, user.prisma, and main schema file), and the Prisma client initialization file.
– Mention how the backend uses Prisma to communicate with the underlying database.

d. Authentication & User Management:
– Include user roles and permissions (USER, ADMIN, SUPERADMIN) as described in the README. This can be annotated as part of the backend components and role-based access control (RBAC) system.

e. AI & CV Processing:
– Highlight the “ai.actions.ts” (and related CV generation components in the actions directory) to indicate AI-powered processing which extracts, enhances, and generates CV content.
– Show the flow from a user-uploaded CV (initiated in the UI) moving into the AI component and then back into the UI after processing.

f. Infrastructure & CI/CD:
– Include external components such as GitHub Actions (workflows for CI, security analysis, Vercel checks) and Renovate for dependency updates.

##### Relationships & Interactions
– User interactions in the Frontend (using React components, Next.js pages) trigger API calls.
– API endpoints call business logic from the “actions” layer.
– Business logic interacts with the Database via Prisma.
– For authentication, illustrate bidirectional calls between NextAuth API and client-side authentication providers.
– Indicate that AI processing components are invoked through dedicated endpoints (e.g., “ai.actions.ts”) once a CV is uploaded.
- How components such as “onboarding”, “dashboard”, and “login” are logically separated yet interact through shared providers and state management.

##### Final Checklist for the Principal Software Engineer
- Major sections from the project: Frontend, API/Backend, Database, Authentication, and AI processing.
- Labels for technologies where relevant (e.g., Next.js, Prisma, NextAuth, GitHub Actions).
- Modular component structure—separately representing dashboards, onboarding, and other pages/components as submodules.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User Interaction
    User["User"]:::user

    %% Frontend Layer
    subgraph "Frontend UI"
        NextUI["Next.js UI (app)"]:::frontend
        UIComponents["UI Components (components)"]:::frontend
    end

    %% API & Backend Layer
    subgraph "API & Backend"
        API["API Endpoints (app/api)"]:::backend
        NextAuth["NextAuth (app/api/auth/[...nextauth])"]:::auth
        subgraph "Business Logic (actions)"
            AuthActions["Auth Actions (actions/auth.actions.ts)"]:::auth
            AIActions["AI Actions (actions/ai.actions.ts)"]:::ai
            OtherActions["Other Actions"]:::backend
        end
    end

    %% Database Layer
    subgraph "Database Layer"
        Prisma["Prisma ORM / Database (prisma)"]:::database
    end

    %% Infrastructure & CI/CD Layer
    subgraph "Infrastructure & CI/CD"
        GitHubActions["GitHub Actions (.github/workflows)"]:::infrastructure
        Renovate["Renovate Config (.github/renovate.json)"]:::infrastructure
    end

    %% Data Flow Connections
    User -->|"interacts"| NextUI
    NextUI -->|"renders"| UIComponents
    NextUI -->|"calls"| API
    API -->|"routes"| NextAuth
    API -->|"delegates"| AuthActions
    API -->|"delegates"| AIActions
    API -->|"routes"| OtherActions
    AuthActions -->|"authenticates"| NextAuth
    AuthActions -->|"queries"| Prisma
    AIActions -->|"processesCV"| Prisma
    OtherActions -->|"queries"| Prisma

    %% CI/CD Triggers
    GitHubActions -->|"triggers"| NextUI
    GitHubActions -->|"triggers"| API
    Renovate -->|"updates"| NextUI
    Renovate -->|"updates"| API

    %% Class Definitions for Colors
    classDef user fill:#ffccff,stroke:#333,stroke-width:2px;
    classDef frontend fill:#bbdefb,stroke:#333,stroke-width:2px;
    classDef backend fill:#e1bee7,stroke:#333,stroke-width:2px;
    classDef auth fill:#fff59d,stroke:#333,stroke-width:2px;
    classDef ai fill:#c8e6c9,stroke:#333,stroke-width:2px;
    classDef database fill:#b3e5fc,stroke:#333,stroke-width:2px;
    classDef infrastructure fill:#ffe0b2,stroke:#333,stroke-width:2px;

    %% Click Events for Component Mapping
    click NextUI "https://github.com/nikeshcohen/profileprep/tree/main/app"
    click UIComponents "https://github.com/nikeshcohen/profileprep/tree/main/components"
    click API "https://github.com/nikeshcohen/profileprep/tree/main/app/api"
    click NextAuth "https://github.com/nikeshcohen/profileprep/blob/main/app/api/auth/[...nextauth]"
    click AuthActions "https://github.com/nikeshcohen/profileprep/blob/main/actions/auth.actions.ts"
    click AIActions "https://github.com/nikeshcohen/profileprep/blob/main/actions/ai.actions.ts"
    click Prisma "https://github.com/nikeshcohen/profileprep/tree/main/prisma"
    click GitHubActions "https://github.com/nikeshcohen/profileprep/tree/main/.github/workflows"
    click Renovate "https://github.com/nikeshcohen/profileprep/blob/main/.github/renovate.json"
```
