# ndbao1803/interview-tracker architecture

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

- Interactive diagram: https://gitdiagram.com/ndbao1803/interview-tracker
- Repository: https://github.com/ndbao1803/interview-tracker

## Overview

##### Project type and purpose
- This is a full-stack, Next.js 14 (app directory) web application called “Interview Tracker.”

##### File structure
- Top-level:
- app/ – Next.js front-end pages (React/TSX), protected routes, and serverless API endpoints under app/api/*
- components/ – reusable UI components (split into apps-wide UI, application-specific, company-specific, dashboard widgets, form steps, shadcn/ui primitives)
- utils/ & src/lib/ & src/services/ – utility functions, Prisma client setup, business logic/service layer for applications and companies
- prisma/ (and src/prisma/) – schema.prisma and seed scripts for database modeling & seeding
- supabase/ – config.toml, seed.sql, and middleware for integrating Supabase (Auth & Storage)
- public/ – static assets (animations, logos)
- middleware.ts – Next.js middleware for route protection via Supabase Auth
- next.config.js, tailwind.config.ts, tsconfig.json – project and styling configuration

##### README for additional insights
- Confirms tech stack: Next.js (frontend + backend), Supabase (Auth & Postgres DB), Prisma ORM, Tailwind CSS, Nivo for charts, shadcn/ui for UI primitives.
- Authentication and protected routes are central.

##### Detail
- API route group as a sub-component under the API Layer.
- Folder-based routing: e.g., app/api/applications/[id]/route.ts.
- Service modules (src/services/*) connected to specific API endpoints.
- Both SSR and client-side data fetching flows.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Client"
        Browser["Browser (React UI)"]:::client
    end

    subgraph "Next.js Frontend (app/)"
        subgraph "Public Pages"
            Root["Root Landing"]:::frontend
            Home["Home Page"]:::frontend
            Login["Login Page"]:::frontend
            PasswordReset["Password Reset"]:::frontend
            EmailReset["Email Reset"]:::frontend
        end
        subgraph "Protected Pages"
            Dashboard["Dashboard"]:::frontend
            ApplicationsList["Applications List"]:::frontend
            ApplicationDetail["Application Detail"]:::frontend
            NewApplication["New Application Flow"]:::frontend
        end
    end

    subgraph "API Layer (app/api/)"
        appRoute["Applications API"]:::api
        appIdRoute["Application ID API"]:::api
        appRounds["Application Rounds API"]:::api
        appTimeline["Application Timeline API"]:::api
        companiesAPI["Companies API"]:::api
        companiesId["Company ID API"]:::api
        positions["Positions API"]:::api
        positionsId["Position ID API"]:::api
        tags["Tags API"]:::api
        users["Users API"]:::api
        upload["File Upload API"]:::api
    end

    subgraph "Service Layer (src/services)"
        getOwnApps["getOwnApplications Service"]:::service
        companiesService["Company Services"]:::service
    end

    subgraph "ORM Layer"
        prismaClient["Prisma Client Setup"]:::orm
        schema["Database Schema"]:::db
        seedTimeline["Seed Script"]:::db
        altClient["Alternate Prisma Client"]:::orm
        companyServ["Prisma Company Service"]:::orm
        industryServ["Prisma Industry Service"]:::orm
    end

    subgraph "Supabase Integration"
        supClient["Supabase Client"]:::sup
        supServer["Supabase Server Helpers"]:::sup
        supMiddleware["Supabase Middleware Helpers"]:::sup
        supConfig["Supabase Config"]:::sup
        supSeed["Supabase Seed SQL"]:::sup
        globalMiddleware["Global Middleware"]:::sup
    end

    subgraph "Utilities & Types"
        utilsGeneric["Generic Utils"]:::util
        dbTypes["Database Types"]:::util
        queries["Queries"]:::util
        helperUtils["Helper Utils"]:::util
        navActions["Navigation Actions"]:::util
    end

    subgraph "UI Components & Charts"
        uiPrimitives["UI Primitives"]:::ui
        appSankey["Application Sankey"]:::ui
        appTimelineComp["Application Timeline"]:::ui
        dashFlow["Interview Flow Widget"]:::ui
        dashStatus["Applications by Status Widget"]:::ui
        homeSankey["Home Sankey Chart"]:::ui
        fileUploadInput["File Upload Input"]:::ui
    end

    Browser -->|page request| Root
    Browser -->|page request| Home
    Browser -->|page request| Login
    Browser -->|page request| PasswordReset
    Browser -->|page request| EmailReset
    Browser -->|page request| Dashboard
    Browser -->|page request| ApplicationsList
    Browser -->|page request| ApplicationDetail
    Browser -->|page request| NewApplication

    Root -->|fetch| appRoute
    Home -->|fetch| appRoute
    Login -->|fetch| users
    PasswordReset -->|fetch| users
    EmailReset -->|fetch| users
    Dashboard -->|fetch| appRoute
    ApplicationsList -->|fetch| appRoute
    ApplicationDetail -->|fetch| appIdRoute
    NewApplication -->|fetch| appRoute
    NewApplication -->|upload| upload

    Dashboard --> dashFlow
    Dashboard --> dashStatus
    ApplicationsList --> appSankey
    ApplicationsList --> appTimelineComp
    Home --> homeSankey
    NewApplication --> fileUploadInput

    appRoute --> getOwnApps
    appIdRoute --> getOwnApps
    appRounds --> getOwnApps
    appTimeline --> getOwnApps
    companiesAPI --> companiesService
    companiesId --> companiesService

    getOwnApps --> prismaClient
    companiesService --> prismaClient

    prismaClient --> schema
    prismaClient --> altClient
    altClient --> schema
    companyServ --> prismaClient
    industryServ --> prismaClient

    upload --> supClient

    globalMiddleware -->|auth guard| supMiddleware
    supMiddleware --> supClient
    supServer --> supClient

    %% Click Events
    click Root "https://github.com/ndbao1803/interview-tracker/blob/main/app/page.tsx"
    click Home "https://github.com/ndbao1803/interview-tracker/blob/main/app/home/mainComponent.tsx"
    click Login "https://github.com/ndbao1803/interview-tracker/blob/main/app/login/page.tsx"
    click PasswordReset "https://github.com/ndbao1803/interview-tracker/blob/main/app/password-reset/page.tsx"
    click EmailReset "https://github.com/ndbao1803/interview-tracker/blob/main/app/email-reset/page.tsx"
    click Dashboard "https://github.com/ndbao1803/interview-tracker/blob/main/app/dashboard/page.tsx"
    click ApplicationsList "https://github.com/ndbao1803/interview-tracker/blob/main/app/applications/page.tsx"
    click ApplicationDetail "https://github.com/ndbao1803/interview-tracker/blob/main/app/applications/[id]/page.tsx"
    click NewApplication "https://github.com/ndbao1803/interview-tracker/blob/main/app/new-application/page.tsx"
    click appRoute "https://github.com/ndbao1803/interview-tracker/blob/main/app/api/applications/route.ts"
    click appIdRoute "https://github.com/ndbao1803/interview-tracker/blob/main/app/api/applications/[id]/route.ts"
    click appRounds "https://github.com/ndbao1803/interview-tracker/blob/main/app/api/application_rounds/route.ts"
    click appTimeline "https://github.com/ndbao1803/interview-tracker/blob/main/app/api/application_timeline/route.ts"
    click companiesAPI "https://github.com/ndbao1803/interview-tracker/blob/main/app/api/companies/route.ts"
    click companiesId "https://github.com/ndbao1803/interview-tracker/blob/main/app/api/companies/[id]/route.ts"
    click positions "https://github.com/ndbao1803/interview-tracker/blob/main/app/api/positions/route.ts"
    click positionsId "https://github.com/ndbao1803/interview-tracker/blob/main/app/api/positions/[id]/route.ts"
    click tags "https://github.com/ndbao1803/interview-tracker/blob/main/app/api/tags/route.ts"
    click users "https://github.com/ndbao1803/interview-tracker/blob/main/app/api/users/route.ts"
    click upload "https://github.com/ndbao1803/interview-tracker/blob/main/app/api/upload/route.ts"
    click getOwnApps "https://github.com/ndbao1803/interview-tracker/blob/main/src/services/applications/getOwnApplications.ts"
    click companiesService "https://github.com/ndbao1803/interview-tracker/blob/main/src/services/companies/index.ts"
    click prismaClient "https://github.com/ndbao1803/interview-tracker/blob/main/src/lib/prisma.ts"
    click schema "https://github.com/ndbao1803/interview-tracker/blob/main/prisma/schema.prisma"
    click seedTimeline "https://github.com/ndbao1803/interview-tracker/blob/main/prisma/seed-notes-timeline.ts"
    click altClient "https://github.com/ndbao1803/interview-tracker/blob/main/src/prisma/client.ts"
    click companyServ "https://github.com/ndbao1803/interview-tracker/blob/main/src/prisma/companyService.ts"
    click industryServ "https://github.com/ndbao1803/interview-tracker/blob/main/src/prisma/industryService.ts"
    click supClient "https://github.com/ndbao1803/interview-tracker/blob/main/utils/supabase/client.ts"
    click supServer "https://github.com/ndbao1803/interview-tracker/blob/main/utils/supabase/server.ts"
    click supMiddleware "https://github.com/ndbao1803/interview-tracker/blob/main/utils/supabase/middleware.ts"
    click supConfig "https://github.com/ndbao1803/interview-tracker/blob/main/supabase/config.toml"
    click supSeed "https://github.com/ndbao1803/interview-tracker/blob/main/supabase/seed.sql"
    click globalMiddleware "https://github.com/ndbao1803/interview-tracker/blob/main/middleware.ts"
    click utilsGeneric "https://github.com/ndbao1803/interview-tracker/blob/main/src/lib/utils.ts"
    click dbTypes "https://github.com/ndbao1803/interview-tracker/blob/main/src/lib/database.types.ts"
    click queries "https://github.com/ndbao1803/interview-tracker/blob/main/src/lib/queries.ts"
    click helperUtils "https://github.com/ndbao1803/interview-tracker/blob/main/utils/helper/index.ts"
    click navActions "https://github.com/ndbao1803/interview-tracker/blob/main/utils/nav-actions/actions.ts"
    click uiPrimitives "https://github.com/ndbao1803/interview-tracker/tree/main/components/ui/"
    click appSankey "https://github.com/ndbao1803/interview-tracker/blob/main/components/applications/application-sankey.tsx"
    click appTimelineComp "https://github.com/ndbao1803/interview-tracker/blob/main/components/applications/application-timeline.tsx"
    click dashFlow "https://github.com/ndbao1803/interview-tracker/blob/main/components/dashboard/interview-flow.tsx"
    click dashStatus "https://github.com/ndbao1803/interview-tracker/blob/main/components/dashboard/applications-by-status.tsx"
    click homeSankey "https://github.com/ndbao1803/interview-tracker/blob/main/app/home/interview-sankey-chart.tsx"
    click fileUploadInput "https://github.com/ndbao1803/interview-tracker/blob/main/components/file-upload.tsx"

    classDef client fill:#D6EFFF,stroke:#0275d8
    classDef frontend fill:#cfe2ff,stroke:#0b5394
    classDef api fill:#d1e7dd,stroke:#2f8f4e
    classDef service fill:#fce5cd,stroke:#e69138
    classDef orm fill:#ffe599,stroke:#b45f06
    classDef db fill:#f9cb9c,stroke:#a61c00
    classDef sup fill:#e0e0e0,stroke:#636363
    classDef util fill:#d9ead3,stroke:#38761d
    classDef ui fill:#f4cccc,stroke:#a61c00
```
