# sayali0109/pathvise architecture

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

- Interactive diagram: https://gitdiagram.com/sayali0109/pathvise
- Repository: https://github.com/sayali0109/pathvise

## Overview

##### Project type and purpose
- This is a full-stack, server-rendered React application built with Next.js.
- Its purpose is to serve as an AI-powered career coaching platform, providing features like AI-generated cover letters, resume building, interview practice quizzes, user dashboards, and onboarding flows.

##### File structure
- Top-level areas:
- app/  (Next.js App Router pages + layouts)
- actions/  (modular “action” handlers for user, resume, cover-letter, interview, dashboard flows)
- components/  (shared UI primitives under components/ui/)
- lib/  (helper functions, Prisma client, Inngest client & function definitions)
- prisma/  (database schema + migration files)
- data/  (static data lists)
- hooks/  (custom React hooks)
- public/, tailwind.config.mjs, next.config.mjs, etc.
- API surface:
- app/api/inngest/route.js  – entry point for Inngest webhook
- lib/inngest/functions.js  – background jobs for AI tasks
- Authentication pages under app/(auth)
- UI widgets under components/ui/
- Prisma ORM layer under lib/prisma.js & prisma/schema.prisma

##### Pulling insights from the README
- Standard Next.js scaffold.
- Deployed on Vercel.
- Uses Next.js App Router, next/font, Tailwind CSS.

a. Main components
- Client Browser (User’s device)
- Next.js Application (hosted on Vercel’s Serverless/Edge Runtime)
- Inngest Event Handler (serverless background jobs)
- Business-logic “actions” modules
- Database (PostgreSQL/MySQL via Prisma)
- External AI API (e.g., OpenAI)
- Static Assets CDN (Vercel’s built-in CDN or similar)

b. Relationships & Interactions
1. User → Browser UI (React components under app/, components/ui/)
2. Browser → Next.js Server (SSR/SSG via App Router)
3. Next.js Server → “actions” modules to orchestrate feature flows
4. Actions → API routes (app/api/inngest) to enqueue AI jobs with Inngest
5. Inngest Worker → executes background functions (lib/inngest/functions.js)
6. Background functions → External AI API to generate cover letters, quizzes, etc.
7. Background functions → Prisma client (lib/prisma.js) to persist results to DB
8. Next.js Server & API routes → Prisma client to read/write user and coaching data
9. Client polls or subscribes (via fetch hooks) for job completion & displays updates
10. Static assets delivered via CDN/public folder

c. Architectural patterns & design principles
- Separation of Concerns: UI components, data-fetching hooks, action handlers, and background workers
- Event-driven background processing (Inngest) for long-running AI tasks
- Prisma as a typed ORM bridging business logic and relational database
- Next.js App Router for colocated routing, layouts, and page‐level data fetching
- Clean folder conventions: “app/” for pages, “components/” for UI, “lib/” for shared logic

d. Key technologies & libraries
- Next.js (App Router, Server/Edge Functions)
- React + Tailwind CSS + next/font
- Prisma ORM + PostgreSQL (or compatible RDBMS)
- Inngest (event queue & serverless functions)
- Vercel Platform (hosting, CDN)
- OpenAI (or similar) APIs for AI generation

##### Elements
- Green for server/runtime components (SSR, API routes)
- Orange for background workers (Inngest)
- Purple for data stores (Database)
- Gray for external services (AI API, CDN)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        Browser["Client Browser"]:::frontend
        subgraph "Next.js App Router UI"
            direction TB
            Layout["App Layout"]:::frontend
            AppPage["Home Page"]:::frontend
            GlobalsCSS["Global Styles"]:::frontend
            AuthLayout["Auth Layout"]:::frontend
            SignIn["Sign-In Page"]:::frontend
            SignUp["Sign-Up Page"]:::frontend
            Onboarding["Onboarding Page"]:::frontend
            OnboardForm["Onboarding Form"]:::frontend
            ResumePage["Resume Page"]:::frontend
            ResumeLayout["Resume Layout"]:::frontend
            ResumeEntry["Resume Entry Form"]:::frontend
            ResumeBuilder["Resume Builder"]:::frontend
            CoverPage["AI Cover Letter Page"]:::frontend
            CoverNew["New Cover Page"]:::frontend
            CoverId["Cover Detail Page"]:::frontend
            CoverGen["Cover Letter Generator"]:::frontend
            CoverList["Cover Letter List"]:::frontend
            CoverPreview["Cover Letter Preview"]:::frontend
            InterviewPage["Interview Page"]:::frontend
            InterviewLayout["Interview Layout"]:::frontend
            QuizComp["Quiz Component"]:::frontend
            QuizList["Quiz List"]:::frontend
            QuizResult["Quiz Result"]:::frontend
            PerfChart["Performance Chart"]:::frontend
            StatsCard["Stats Card"]:::frontend
            MockPage["Mock Interview Page"]:::frontend
            DashboardPage["Dashboard Page"]:::frontend
            DashboardLayout["Dashboard Layout"]:::frontend
            DashboardView["Dashboard View"]:::frontend
            SharedUI["Shared UI Components"]:::frontend
            Hook["use-fetch Hook"]:::frontend
        end
    end

    %% Server Layer
    subgraph "Server Layer"
        direction TB
        subgraph "Sync (SSR & API Handlers)"
            direction TB
            NextFn["Next.js Edge Function"]:::server
            APIInngest["Inngest Webhook API"]:::server
            subgraph "Actions Modules"
                direction TB
                ActUser["actions/user.js"]:::server
                ActResume["actions/resume.js"]:::server
                ActCover["actions/cover-letter.js"]:::server
                ActInterview["actions/interview.js"]:::server
                ActDashboard["actions/dashboard.js"]:::server
            end
        end
        subgraph "Async (Inngest Workers)"
            direction TB
            InngestClient["Inngest Client"]:::worker
            InngestFns["Inngest Functions"]:::worker
        end
    end

    %% Data & External
    DB["Prisma Database"]:::data
    AIAPI["External AI API"]:::external
    CDN["Static Assets CDN"]:::external

    %% Connections
    Browser -->|"HTTP/SSR/SSG"| NextFn
    NextFn -->|"calls Actions"| ActUser
    NextFn --> ActResume
    NextFn --> ActCover
    NextFn --> ActInterview
    NextFn --> ActDashboard
    ActCover -->|"enqueue job"| APIInngest
    APIInngest -->|"triggers"| InngestClient
    InngestClient --> InngestFns
    InngestFns -->|"calls AI"| AIAPI
    InngestFns -->|"DB write/read"| DB
    NextFn -->|"DB operations"| DB
    Browser -->|"fetch/subscriptions"| NextFn
    Browser -->|"static assets"| CDN

    %% Click Events
    click Layout "https://github.com/sayali0109/pathvise/blob/main/app/layout.js"
    click AppPage "https://github.com/sayali0109/pathvise/blob/main/app/page.jsx"
    click GlobalsCSS "https://github.com/sayali0109/pathvise/blob/main/app/globals.css"
    click AuthLayout "https://github.com/sayali0109/pathvise/blob/main/app/(auth)/layout.js"
    click SignIn "https://github.com/sayali0109/pathvise/blob/main/app/(auth)/sign-in/[[...sign-in]]/page.jsx"
    click SignUp "https://github.com/sayali0109/pathvise/blob/main/app/(auth)/sign-up/[[...sign-up]]/page.jsx"
    click Onboarding "https://github.com/sayali0109/pathvise/blob/main/app/onboarding/page.jsx"
    click OnboardForm "https://github.com/sayali0109/pathvise/blob/main/app/onboarding/_components/onboarding-form.jsx"
    click ResumePage "https://github.com/sayali0109/pathvise/blob/main/app/resume/page.jsx"
    click ResumeLayout "https://github.com/sayali0109/pathvise/blob/main/app/resume/layout.js"
    click ResumeEntry "https://github.com/sayali0109/pathvise/blob/main/app/resume/_components/entry-form.jsx"
    click ResumeBuilder "https://github.com/sayali0109/pathvise/blob/main/app/resume/_components/resume-builder.jsx"
    click CoverPage "https://github.com/sayali0109/pathvise/blob/main/app/ai-cover-letter/page.jsx"
    click CoverNew "https://github.com/sayali0109/pathvise/blob/main/app/ai-cover-letter/new/page.jsx"
    click CoverId "https://github.com/sayali0109/pathvise/blob/main/app/ai-cover-letter/[id]/page.jsx"
    click CoverGen "https://github.com/sayali0109/pathvise/blob/main/app/ai-cover-letter/_components/cover-letter-generator.jsx"
    click CoverList "https://github.com/sayali0109/pathvise/blob/main/app/ai-cover-letter/_components/cover-letter-list.jsx"
    click CoverPreview "https://github.com/sayali0109/pathvise/blob/main/app/ai-cover-letter/_components/cover-letter-preview.jsx"
    click InterviewPage "https://github.com/sayali0109/pathvise/blob/main/app/interview/page.jsx"
    click InterviewLayout "https://github.com/sayali0109/pathvise/blob/main/app/interview/layout.js"
    click QuizComp "https://github.com/sayali0109/pathvise/blob/main/app/interview/_components/quiz.jsx"
    click QuizList "https://github.com/sayali0109/pathvise/blob/main/app/interview/_components/quiz-list.jsx"
    click QuizResult "https://github.com/sayali0109/pathvise/blob/main/app/interview/_components/quiz-result.jsx"
    click PerfChart "https://github.com/sayali0109/pathvise/blob/main/app/interview/_components/performance-chart.jsx"
    click StatsCard "https://github.com/sayali0109/pathvise/blob/main/app/interview/_components/stats-card.jsx"
    click MockPage "https://github.com/sayali0109/pathvise/blob/main/app/interview/mock/page.jsx"
    click DashboardPage "https://github.com/sayali0109/pathvise/blob/main/app/dashboard/page.jsx"
    click DashboardLayout "https://github.com/sayali0109/pathvise/blob/main/app/dashboard/layout.js"
    click DashboardView "https://github.com/sayali0109/pathvise/blob/main/app/dashboard/_components/dashboard-view.jsx"
    click SharedUI "https://github.com/sayali0109/pathvise/tree/main/components/ui/"
    click Hook "https://github.com/sayali0109/pathvise/blob/main/hooks/use-fetch.js"
    click APIInngest "https://github.com/sayali0109/pathvise/blob/main/app/api/inngest/route.js"
    click InngestClient "https://github.com/sayali0109/pathvise/blob/main/lib/inngest/client.js"
    click InngestFns "https://github.com/sayali0109/pathvise/blob/main/lib/inngest/functions.js"
    click DB "https://github.com/sayali0109/pathvise/blob/main/lib/prisma.js"
    click DB "https://github.com/sayali0109/pathvise/blob/main/prisma/schema.prisma"
    click DB "https://github.com/sayali0109/pathvise/tree/main/prisma/migrations/"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366d6,color:#0366d6
    classDef server fill:#DFFFE0,stroke:#228B22,color:#228B22
    classDef worker fill:#FFF0D0,stroke:#FFA500,color:#FFA500
    classDef data fill:#E8D0FF,stroke:#800080,color:#800080
    classDef external fill:#F0F0F0,stroke:#696969,color:#696969
```
