# satyam-code45/workwave architecture

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

- Interactive diagram: https://gitdiagram.com/satyam-code45/workwave
- Repository: https://github.com/satyam-code45/workwave

## Overview

##### Project type and purpose
- This is a full-stack, server-centric web application built on Next.js (App Router).
- It’s essentially a job board platform: users can sign up (via NextAuth), post jobs, browse and favourite listings, pay to feature jobs (Stripe), and background‐process tasks (Inngest) like email notifications (Resend) and file uploads (UploadThing).

##### File structure
- Top-level “app” directory: Next.js app-router pages & layouts.
- (auth) subfolder for authentication UI & flow.
- pages under app/(auth)/login, app/onboarding, app/post-job, app/my-jobs, app/job/[jobId], app/favourites, app/payment.
- app/api: serverless routes (NextAuth, Inngest, UploadThing, Stripe webhook).
- app/utils: client-side helper modules (db, auth, stripe, inngest client, Zod schemas).
- “components”: UI components split into forms, general UI, rich text editor, theme provider, primitive “ui” library.
- “prisma”: database schema and migrations (likely PostgreSQL).
- “lib”: utility scripts (e.g., Resend email integration).
- Configuration: next.config.ts, tsconfig.json, Tailwind, ESLint.

##### Important architectural patterns & third-party integrations
- App Router with nested layouts for auth gating.
- Serverless API routes handle authentication (NextAuth), payments (Stripe webhook), background tasks (Inngest), file uploads (UploadThing).
- Prisma ORM for DB access.
- Background workers triggered by Inngest functions.
- External services: Stripe (payments & webhooks), UploadThing (file uploads), Resend (email), maybe Google/GitHub OAuth providers.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Layers
    subgraph "Frontend Layer"
        direction TB
        Browser["User Browser"]:::frontend
        LoginPage["Login Page"]:::frontend
        AuthLayout["Auth Layout"]:::frontend
        OnboardingPage["Onboarding Flow"]:::frontend
        HomePage["Home Listings"]:::frontend
        JobDetailPage["Job Detail"]:::frontend
        FavouritesPage["Favourites"]:::frontend
        PostJobPage["Post Job"]:::frontend
        MyJobsPage["My Jobs"]:::frontend
        EditJobPage["Edit Job"]:::frontend
        DeleteJobPage["Delete Job"]:::frontend
        PaymentSuccess["Payment Success"]:::frontend
        PaymentCancel["Payment Cancel"]:::frontend
    end

    subgraph "Backend Layer"
        direction TB
        NextServer["Next.js App Server"]:::backend
        subgraph "API Routes"
            direction TB
            AuthAPI["Auth API Route"]:::backend
            WebhookAPI["Stripe Webhook Route"]:::backend
            InngestAPI["Inngest API Route"]:::backend
            UploadAPI["UploadThing API Route"]:::backend
        end
    end

    subgraph "Utils & ORM"
        direction TB
        AuthUtils["Auth Utils"]:::backend
        StripeUtils["Stripe Utils"]:::backend
        DBUtils["DB Utils"]:::backend
        InngestClient["Inngest Client"]:::backend
        ZodSchemas["Zod Schemas"]:::backend
    end

    subgraph "Data Layer"
        direction TB
        Prisma["Prisma ORM"]:::backend
        Database["PostgreSQL"]:::db
    end

    subgraph "Background Jobs"
        direction TB
        InngestWorker["Inngest Worker"]:::background
    end

    subgraph "External Services"
        direction TB
        Stripe["Stripe"]:::external
        UploadThing["UploadThing"]:::external
        Resend["Resend Email"]:::external
        OAuth["OAuth Providers"]:::external
    end

    %% Flows
    Browser -->|"HTTPS (SSR & API)"| NextServer
    Browser -->|"OAuth Redirect"| OAuth
    NextServer --> AuthAPI
    NextServer --> WebhookAPI
    NextServer --> InngestAPI
    NextServer --> UploadAPI
    NextServer --> AuthUtils
    NextServer --> StripeUtils
    NextServer --> DBUtils
    NextServer --> InngestClient
    NextServer --> ZodSchemas
    NextServer --> Prisma
    AuthAPI --> OAuth
    WebhookAPI --> Stripe
    WebhookAPI --> InngestWorker
    UploadAPI --> UploadThing
    InngestAPI --> InngestWorker
    InngestWorker --> Resend
    InngestWorker --> Prisma
    Prisma --> Database
    Stripe -->|Webhook POST| WebhookAPI

    %% User actions (simplified)
    Browser --> LoginPage
    Browser --> OnboardingPage
    Browser --> HomePage
    Browser --> JobDetailPage
    Browser --> FavouritesPage
    Browser --> PostJobPage
    Browser --> MyJobsPage
    Browser --> EditJobPage
    Browser --> DeleteJobPage
    Browser --> PaymentSuccess
    Browser --> PaymentCancel

    %% Click Events
    click Browser "https://github.com/satyam-code45/workwave/tree/main/app/"
    click LoginPage "https://github.com/satyam-code45/workwave/blob/main/app/(auth)/login/page.tsx"
    click AuthLayout "https://github.com/satyam-code45/workwave/blob/main/app/(auth)/layout.tsx"
    click OnboardingPage "https://github.com/satyam-code45/workwave/blob/main/app/onboarding/page.tsx"
    click HomePage "https://github.com/satyam-code45/workwave/blob/main/app/page.tsx"
    click JobDetailPage "https://github.com/satyam-code45/workwave/blob/main/app/job/[jobId]/page.tsx"
    click FavouritesPage "https://github.com/satyam-code45/workwave/blob/main/app/favourites/page.tsx"
    click PostJobPage "https://github.com/satyam-code45/workwave/blob/main/app/post-job/page.tsx"
    click MyJobsPage "https://github.com/satyam-code45/workwave/blob/main/app/my-jobs/page.tsx"
    click EditJobPage "https://github.com/satyam-code45/workwave/blob/main/app/my-jobs/[jobId]/edit/page.tsx"
    click DeleteJobPage "https://github.com/satyam-code45/workwave/blob/main/app/my-jobs/[jobId]/delete/page.tsx"
    click PaymentSuccess "https://github.com/satyam-code45/workwave/blob/main/app/payment/success/page.tsx"
    click PaymentCancel "https://github.com/satyam-code45/workwave/blob/main/app/payment/cancel/page.tsx"
    click AuthAPI "https://github.com/satyam-code45/workwave/blob/main/app/api/auth/[...nextauth]/route.ts"
    click WebhookAPI "https://github.com/satyam-code45/workwave/blob/main/app/api/webhook/stripe/route.ts"
    click InngestAPI "https://github.com/satyam-code45/workwave/blob/main/app/api/inngest/route.ts"
    click UploadAPI "https://github.com/satyam-code45/workwave/blob/main/app/api/uploadthing/route.ts"
    click AuthUtils "https://github.com/satyam-code45/workwave/blob/main/app/utils/auth.ts"
    click StripeUtils "https://github.com/satyam-code45/workwave/blob/main/app/utils/stripe.ts"
    click DBUtils "https://github.com/satyam-code45/workwave/blob/main/app/utils/db.ts"
    click InngestClient "https://github.com/satyam-code45/workwave/blob/main/app/utils/inngest/client.ts"
    click ZodSchemas "https://github.com/satyam-code45/workwave/blob/main/app/utils/zodschema.ts"
    click Prisma "https://github.com/satyam-code45/workwave/blob/main/prisma/schema.prisma"
    click Database "https://github.com/satyam-code45/workwave/tree/main/prisma/migrations/"
    click UploadThing "https://github.com/satyam-code45/workwave/blob/main/components/general/UploadThingReexported.tsx"
    click Resend "https://github.com/satyam-code45/workwave/blob/main/lib/resend.ts"
    click OAuth "https://github.com/satyam-code45/workwave/blob/main/app/api/auth/[...nextauth]/route.ts"

    %% Styles
    classDef frontend fill:#CFE3FF,stroke:#0366d6;
    classDef backend fill:#D1F3C6,stroke:#228B22;
    classDef db fill:#C6F3F0,stroke:#20B2AA;
    classDef background fill:#FFE4B5,stroke:#FFA500;
    classDef external fill:#F0F0F0,stroke:#808080;
```
