# webdevsimplified/job-board-ai architecture

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

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

## Overview

##### Project type and purpose
- This is a full-stack, multi‐tenant job‐board platform built with Next.js (App Router). It serves two main user types—job-seekers and employers—providing authentication, job listings, application workflows, notifications, file uploads, and background processing.
- Key indicators: Next.js app directory (`src/app`), Clerk authentication, Drizzle ORM (SQL migrations), Inngest background functions, Resend email service, UploadThing file uploads.

##### File structure
- Top-level:
- `src/app`: the Next.js App Router code (React server/client components organized into `(clerk)`, `(job-seeker)`, `(employer)` layouts).
- `src/app/api`: Next.js server routes for background APIs (Inngest, UploadThing).
- `src/components`, `src/features`, `src/services`: shared UI components, feature modules (jobListings, organizations, users, applications), and wrappers around external services.
- `src/drizzle`: ORM config, schema definitions, and migrations (PostgreSQL).
- `docker-compose.yml`: local dev environment, likely spins up the database + Inngest.
- Patterns:
- “Feature folder” per domain (jobListings, organizations, users, jobListingApplications) with its own actions, DB queries, components, and client caches—this follows a modular “vertical slices” architecture.
- Next.js App Router file conventions map UI routes to folder structure.
- Services under `src/services` encapsulate integration with Clerk, Inngest, Resend, and UploadThing.

##### README for additional insights
- Dependencies: Next.js, Clerk, Drizzle, Inngest, Resend, UploadThing.

##### Detail
- Break the Next.js App Server into sub‐components if desired: App Router, API Routes, Feature modules.
- Drizzle schema directory and migrations as part of the Data Layer.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    Browser["Browser (Job-Seeker & Employer UI)"]:::client

    %% App Server Layer
    subgraph "Next.js App Server" 
        direction TB
        AppServer["Next.js App Router"]:::server
        subgraph "Role‐based Layouts"
            direction TB
            ClerkLayout["Clerk Layout"]:::server
            JobSeekerLayout["Job-Seeker Layout"]:::server
            EmployerLayout["Employer Layout"]:::server
        end
        subgraph "API Routes"
            direction TB
            InngestRoute["/api/inngest (Webhook Receiver)"]:::server
            UploadThingRoute["/api/uploadthing (Proxy)"]:::server
        end
        subgraph "Feature Modules"
            direction TB
            JobListings["Job Listings"]:::server
            JobApp["Job Listing Applications"]:::server
            Organizations["Organizations"]:::server
            Users["Users"]:::server
        end
        subgraph "Shared Services & Middleware"
            direction TB
            Middleware["Global Middleware"]:::server
            EnvClient["Env Vars (Client)"]:::server
            EnvServer["Env Vars (Server)"]:::server
        end
    end

    %% Data Layer
    subgraph "Database Layer"
        direction TB
        DrizzleConfig["Drizzle Config"]:::server
        DBInit["DB Initialization"]:::server
        Schema["Schema Definitions"]:::server
        Migrations["Migrations"]:::server
        PostgreSQL["PostgreSQL (Drizzle)"]:::db
    end

    %% Background Worker
    subgraph "Inngest Worker"
        direction TB
        InngestClient["Inngest Client Setup"]:::external
        AIHelpers["AI Helpers"]:::external
        WorkflowFns["Workflow Functions"]:::external
    end

    %% External Services
    subgraph "External Services"
        direction TB
        ClerkAuth["Clerk Authentication"]:::external
        ResendEmail["Resend Email Service"]:::external
        UploadThingSvc["UploadThing Service"]:::external
    end

    %% Feature Implementation
    SharedUI["Shared UI Components"]:::server

    %% Connections
    Browser -->|"HTTP Request"| AppServer
    AppServer -->|"Auth Check"| ClerkAuth
    AppServer -->|"ORM Calls"| PostgreSQL
    AppServer -->|"Enqueue Job"| InngestClient
    InngestClient --> InngestWorker
    InngestWorker -->|"Send Email"| ResendEmail
    Browser -->|"File Upload"| UploadThingRoute
    UploadThingRoute -->|"Proxy to"| UploadThingSvc

    %% Internal Relationships
    AppServer --> AppServer
    AppServer --> Middleware
    AppServer --> EnvClient
    AppServer --> EnvServer
    AppServer --> SharedUI
    AppServer --> JobListings
    AppServer --> JobApp
    AppServer --> Organizations
    AppServer --> Users
    AppServer --> ClerkLayout
    AppServer --> JobSeekerLayout
    AppServer --> EmployerLayout
    AppServer --> InngestRoute
    AppServer --> UploadThingRoute

    PostgreSQL --> DrizzleConfig
    PostgreSQL --> DBInit
    PostgreSQL --> Schema
    PostgreSQL --> Migrations

    InngestClient --> AIHelpers
    InngestClient --> WorkflowFns

    %% Click Events
    click AppServer "https://github.com/webdevsimplified/job-board-ai/tree/main/src/app"
    click ClerkLayout "https://github.com/webdevsimplified/job-board-ai/blob/main/src/app/(clerk)/layout.tsx"
    click JobSeekerLayout "https://github.com/webdevsimplified/job-board-ai/blob/main/src/app/(job-seeker)/layout.tsx"
    click EmployerLayout "https://github.com/webdevsimplified/job-board-ai/blob/main/src/app/employer/layout.tsx"
    click InngestRoute "https://github.com/webdevsimplified/job-board-ai/blob/main/src/app/api/inngest/route.ts"
    click UploadThingRoute "https://github.com/webdevsimplified/job-board-ai/blob/main/src/app/api/uploadthing/route.ts"
    click DrizzleConfig "https://github.com/webdevsimplified/job-board-ai/blob/main/drizzle.config.ts"
    click DBInit "https://github.com/webdevsimplified/job-board-ai/blob/main/src/drizzle/db.ts"
    click Schema "https://github.com/webdevsimplified/job-board-ai/blob/main/src/drizzle/schema.ts"
    click Migrations "https://github.com/webdevsimplified/job-board-ai/blob/main/src/drizzle/migrations/0000_moaning_human_robot.sql"
    click InngestClient "https://github.com/webdevsimplified/job-board-ai/blob/main/src/services/inngest/client.ts"
    click AIHelpers "https://github.com/webdevsimplified/job-board-ai/blob/main/src/services/inngest/ai/applicantRankingAgent.ts"
    click WorkflowFns "https://github.com/webdevsimplified/job-board-ai/blob/main/src/services/inngest/functions/jobListingApplication.ts"
    click ResendEmail "https://github.com/webdevsimplified/job-board-ai/blob/main/src/services/resend/client.ts"
    click UploadThingSvc "https://github.com/webdevsimplified/job-board-ai/blob/main/src/services/uploadthing/client.ts"
    click SharedUI "https://github.com/webdevsimplified/job-board-ai/tree/main/src/components"
    click Middleware "https://github.com/webdevsimplified/job-board-ai/blob/main/src/middleware.ts"
    click EnvClient "https://github.com/webdevsimplified/job-board-ai/blob/main/src/data/env/client.ts"
    click EnvServer "https://github.com/webdevsimplified/job-board-ai/blob/main/src/data/env/server.ts"
    click JobListings "https://github.com/webdevsimplified/job-board-ai/tree/main/src/features/jobListings"
    click JobApp "https://github.com/webdevsimplified/job-board-ai/tree/main/src/features/jobListingApplications"
    click Organizations "https://github.com/webdevsimplified/job-board-ai/tree/main/src/features/organizations"
    click Users "https://github.com/webdevsimplified/job-board-ai/tree/main/src/features/users"

    %% Styles
    classDef client fill:#D0E6FF,stroke:#0366d6,color:#0366d6
    classDef server fill:#D0F5D0,stroke:#28a745,color:#28a745
    classDef external fill:#FFE4D0,stroke:#d93f0b,color:#d93f0b
    classDef db fill:#F0D0FF,stroke:#6f42c1,color:#6f42c1
```
