# webdevsimplified/ai-powered-job-prep architecture

> Architecture diagram of the GitHub repository webdevsimplified/ai-powered-job-prep, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/webdevsimplified/ai-powered-job-prep
- Repository: https://github.com/webdevsimplified/ai-powered-job-prep

## Overview

##### Project type and purpose
- This is a full-stack, server-rendered Next.js application with both UI code and API routes living under `src/app`.
- The README confirms it was scaffolded via `create-next-app` and runs as a Next.js app on Vercel (or Docker Compose).
- Business domain: a job-interview management portal. Users sign in (via Clerk), create “jobInfos”, schedule interviews, generate AI-powered questions and feedback, and analyze resumes using external AI/Hume services.

##### File structure
- Top-level:
- `app/` — UI pages and Next.js App Router.
- `app/api/` — Next.js Route Handlers for serverless APIs (AI endpoints, webhooks).
- `components/`, `features/` — React UI components and feature modules (actions, db caches, permissions).
- `services/` — Thin wrappers around external services: Clerk (auth), AI providers (Google, Hume), in-house AI orchestration.
- `drizzle/` — Drizzle ORM config, schema definitions, migrations for the relational database.
- `docker-compose.yml` & `drizzle.config.ts` — local dev and DB setup.
- Patterns:
- Layered architecture: Presentation (Next.js pages + components) → Application logic (feature modules + services) → Data access (Drizzle ORM) → External systems (Auth, AI, DB).
- File-based routing → API endpoints under `app/api/…`.

##### README for additional insights
- Deploy instructions hint at Vercel but `docker-compose.yml` implies local containerization (Postgres, possibly Redis).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend (Browser)" 
        direction TB
        AppRouter["Next.js App Router"]:::frontend
        JobInfosUI["JobInfos Pages"]:::frontend
        InterviewsUI["Interviews Pages"]:::frontend
        QuestionsUI["Questions Pages"]:::frontend
        ResumeUI["Resume Analysis Pages"]:::frontend
        AuthUI["Onboarding & Auth Pages"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend (Next.js Server)"
        direction TB

        subgraph "Route Handlers"
            direction TB
            AIQuestions["AI Questions API"]:::backend
            AIResumes["AI Resumes API"]:::backend
            WebhooksClerk["Clerk Webhook API"]:::backend
        end

        subgraph "Feature Modules"
            direction TB
            JobInfosFeature["JobInfos Feature"]:::backend
            InterviewsFeature["Interviews Feature"]:::backend
            QuestionsFeature["Questions Feature"]:::backend
            ResumeAnalysesFeature["Resume Analyses Feature"]:::backend
            UsersFeature["Users Feature"]:::backend
        end

        subgraph "Service Layer"
            direction TB
            AIOrchestration["AI Orchestration Service"]:::backend
            GoogleModel["Google Vertex AI Wrapper"]:::backend
            ResumeHelpers["Resume AI Helpers"]:::backend
            ClerkAuthService["Clerk Auth Service"]:::backend
            HumeAPIService["Hume API Service"]:::backend
        end

        subgraph "Data Access Layer"
            direction TB
            DrizzleClient["Drizzle ORM Client"]:::backend
            SchemaDefs["Drizzle Schema Definitions"]:::backend
            Migrations["Drizzle Migrations"]:::backend
        end
    end

    %% External Systems
    ClerkExternal["Clerk Auth Service"]:::external
    GoogleExternal["Google Vertex AI"]:::external
    HumeExternal["Hume API"]:::external
    Postgres["PostgreSQL Database"]:::database

    %% Connections
    AppRouter -->|renders pages| JobInfosUI
    AppRouter -->|renders pages| InterviewsUI
    AppRouter -->|renders pages| QuestionsUI
    AppRouter -->|renders pages| ResumeUI
    AppRouter -->|renders pages| AuthUI

    JobInfosUI -->|fetch| AIQuestions
    InterviewsUI -->|fetch| AIQuestions
    QuestionsUI -->|fetch| AIQuestions
    ResumeUI -->|fetch| AIResumes
    AuthUI -->|webhook| WebhooksClerk

    AIQuestions -->|calls| JobInfosFeature
    AIQuestions -->|calls| InterviewsFeature
    AIQuestions -->|calls| QuestionsFeature

    AIResumes -->|calls| ResumeAnalysesFeature
    WebhooksClerk -->|invokes| UsersFeature

    JobInfosFeature -->|uses| AIOrchestration
    InterviewsFeature -->|uses| AIOrchestration
    QuestionsFeature -->|uses| AIOrchestration
    ResumeAnalysesFeature -->|uses| ResumeHelpers
    UsersFeature -->|uses| ClerkAuthService

    AIOrchestration -->|invokes| GoogleModel
    AIOrchestration -->|invokes| HumeAPIService
    ResumeHelpers -->|invokes| GoogleModel

    ClerkAuthService -->|auth check| ClerkExternal
    HumeAPIService -->|api call| HumeExternal
    GoogleModel -->|api call| GoogleExternal

    JobInfosFeature -->|db queries| DrizzleClient
    InterviewsFeature -->|db queries| DrizzleClient
    QuestionsFeature -->|db queries| DrizzleClient
    UsersFeature -->|db queries| DrizzleClient

    DrizzleClient -->|reads/writes| SchemaDefs
    DrizzleClient -->|runs migrations| Migrations
    DrizzleClient -->|SQL over TCP| Postgres

    %% Click Events
    click AppRouter "https://github.com/webdevsimplified/ai-powered-job-prep/blob/main/src/app/layout.tsx"
    click JobInfosUI "https://github.com/webdevsimplified/ai-powered-job-prep/blob/main/src/app/app/job-infos/page.tsx"
    click InterviewsUI "https://github.com/webdevsimplified/ai-powered-job-prep/blob/main/src/app/app/job-infos/[jobInfoId]/interviews/page.tsx"
    click QuestionsUI "https://github.com/webdevsimplified/ai-powered-job-prep/blob/main/src/app/app/job-infos/[jobInfoId]/questions/page.tsx"
    click ResumeUI "https://github.com/webdevsimplified/ai-powered-job-prep/blob/main/src/app/app/job-infos/[jobInfoId]/resume/page.tsx"
    click AuthUI "https://github.com/webdevsimplified/ai-powered-job-prep/blob/main/src/app/onboarding/page.tsx"
    click AIQuestions "https://github.com/webdevsimplified/ai-powered-job-prep/blob/main/src/app/api/ai/questions/generate-question/route.ts"
    click AIResumes "https://github.com/webdevsimplified/ai-powered-job-prep/blob/main/src/app/api/ai/resumes/analyze/route.ts"
    click WebhooksClerk "https://github.com/webdevsimplified/ai-powered-job-prep/blob/main/src/app/api/webhooks/clerk/route.ts"
    click JobInfosFeature "https://github.com/webdevsimplified/ai-powered-job-prep/blob/main/src/features/jobInfos/actions.ts"
    click InterviewsFeature "https://github.com/webdevsimplified/ai-powered-job-prep/blob/main/src/features/interviews/actions.ts"
    click QuestionsFeature "https://github.com/webdevsimplified/ai-powered-job-prep/blob/main/src/features/questions/db.ts"
    click ResumeAnalysesFeature "https://github.com/webdevsimplified/ai-powered-job-prep/blob/main/src/features/resumeAnalyses/permissions.ts"
    click UsersFeature "https://github.com/webdevsimplified/ai-powered-job-prep/blob/main/src/features/users/actions.ts"
    click AIOrchestration "https://github.com/webdevsimplified/ai-powered-job-prep/blob/main/src/services/ai/questions.ts"
    click GoogleModel "https://github.com/webdevsimplified/ai-powered-job-prep/blob/main/src/services/ai/models/google.ts"
    click ResumeHelpers "https://github.com/webdevsimplified/ai-powered-job-prep/blob/main/src/services/ai/resumes/ai.ts"
    click ClerkAuthService "https://github.com/webdevsimplified/ai-powered-job-prep/blob/main/src/services/clerk/lib/getCurrentUser.ts"
    click HumeAPIService "https://github.com/webdevsimplified/ai-powered-job-prep/blob/main/src/services/hume/lib/api.ts"
    click DrizzleClient "https://github.com/webdevsimplified/ai-powered-job-prep/blob/main/src/drizzle/db.ts"
    click SchemaDefs "https://github.com/webdevsimplified/ai-powered-job-prep/blob/main/src/drizzle/schema.ts"
    click Migrations "https://github.com/webdevsimplified/ai-powered-job-prep/blob/main/src/drizzle/migrations/0000_many_speed_demon.sql"

    %% Styles
    classDef frontend fill:#bbdefb,stroke:#0d47a1,color:#0d47a1;
    classDef backend fill:#c8e6c9,stroke:#1b5e20,color:#1b5e20;
    classDef external fill:#ffe082,stroke:#ff6f00,color:#bf360c;
    classDef database fill:#e0e0e0,stroke:#424242,color:#212121;
```
