# codinginflow/nextjs-15-ai-resume-builder architecture

> Architecture diagram of the GitHub repository codinginflow/nextjs-15-ai-resume-builder, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/codinginflow/nextjs-15-ai-resume-builder
- Repository: https://github.com/codinginflow/nextjs-15-ai-resume-builder

## Overview

##### Main Components
- Frontend Interface: Represent the Next.js application’s UI, which is built using components under src/app (with clear route groups for authentication, billing, resume editor, etc.), components from src/components (including the premium UI and common UI components), and styling via Tailwind CSS and Shadcn UI.
- Authentication Module: Highlight (auth) routes under src/app/(auth) along with corresponding pages/sign-in and sign-up. This handles user login, registration, and session management.
- Resume Editor and Editor Flow: Separate out the editor interface (in src/app/(main)/editor) that handles multi-step forms, drag-and-drop, auto-save functionality, and dynamic form arrays.
- Billing and Subscription Module: Identify the billing sub-routes under src/app/(main)/billing, the relevant buttons/actions, and account subscription tier management, making it clear how the UI interacts with Stripe.
- API Layer and Webhook Integration: Mark the API endpoints under src/app/api (e.g., stripe-webhook) that are responsible for processing Stripe callbacks and possibly other server-side logic.
- Database and ORM Integration: Illustrate the database layer by referencing the prisma/schema.prisma, indicating that the app uses Prisma as its ORM for Postgres.
- External Services:
- Stripe: For handling payment and subscription workflow.
- ChatGPT API: For AI auto-fill capabilities in resume building.
- Vercel Blob: For file uploads.

##### Architectural Patterns and Design Principles
- Separation of Concerns: The app clearly separates authentication, billing, resume editing, and utility libraries to maintain modularity.
- Component-Based UI: With components spread across ui, hooks, and lib directories, the design promotes reusability.
- API-Driven Development: Using Next.js API routes to decouple the client from server operations.
- Integration with External Services: Stripe and ChatGPT integrations are modularized in the lib directory.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend UI Subgraph
    subgraph "Frontend UI (Next.js App)"
        F["Frontend UI (Next.js App)"]
        Auth["Authentication Module"]
        Editor["Resume Editor & Editor Flow"]
        Billing["Billing & Subscription Module"]
        F --> Auth
        F --> Editor
        F --> Billing
        %% Authentication Subcomponents
        Auth --> SignIn["Sign-In Page"]
        Auth --> SignUp["Sign-Up Page"]
        %% Resume Editor Subcomponent
        Editor --> REditor["Resume Editor Page"]
        %% Billing Subcomponents
        Billing --> SubButton["GetSubscriptionButton"]
        Billing --> ManButton["ManageSubscriptionButton"]
        Billing --> ABilling["Billing Actions"]
    end

    %% Backend API & Business Logic Subgraph
    subgraph "Backend API & Business Logic"
        API["Backend API Endpoints (Stripe Webhook)"]
        API --> APIChild["Stripe Webhook Handler"]
        F -->|"APIcalls"| API
    end

    %% Database Subgraph
    subgraph "Database"
        DB["Database (Postgres via Prisma)"]
        DB --> PrismaSchema["Prisma Schema"]
        DB --> PrismaLib["Prisma Client"]
    end

    %% External Services Subgraph
    subgraph "External Services"
        Stripe["Stripe"]
        ChatGPT["ChatGPT API"]
        Vercel["Vercel Blob Storage"]
        Stripe --> SubLogic["Subscription Logic"]
    end

    %% Inter-component Connections
    API -->|"PrismaQueries"| DB
    Billing -->|"InitiateBilling"| Stripe
    API -->|"ProcessWebhook"| Stripe
    Editor -->|"TriggerAIAutofill"| ChatGPT
    Editor -->|"FileUpload"| Vercel

    %% Click Events
    click F "https://github.com/codinginflow/nextjs-15-ai-resume-builder/tree/Final-project/src/app"
    click Auth "https://github.com/codinginflow/nextjs-15-ai-resume-builder/tree/Final-project/src/app/(auth)"
    click SignIn "https://github.com/codinginflow/nextjs-15-ai-resume-builder/blob/Final-project/src/app/(auth)/sign-in/[[...sign-in]]/page.tsx"
    click SignUp "https://github.com/codinginflow/nextjs-15-ai-resume-builder/blob/Final-project/src/app/(auth)/sign-up/[[...sign-up]]/page.tsx"
    click Editor "https://github.com/codinginflow/nextjs-15-ai-resume-builder/tree/Final-project/src/app/(main)/editor"
    click REditor "https://github.com/codinginflow/nextjs-15-ai-resume-builder/blob/Final-project/src/app/(main)/editor/ResumeEditor.tsx"
    click Billing "https://github.com/codinginflow/nextjs-15-ai-resume-builder/tree/Final-project/src/app/(main)/billing"
    click SubButton "https://github.com/codinginflow/nextjs-15-ai-resume-builder/blob/Final-project/src/app/(main)/billing/GetSubscriptionButton.tsx"
    click ManButton "https://github.com/codinginflow/nextjs-15-ai-resume-builder/blob/Final-project/src/app/(main)/billing/ManageSubscriptionButton.tsx"
    click ABilling "https://github.com/codinginflow/nextjs-15-ai-resume-builder/blob/Final-project/src/app/(main)/billing/actions.ts"
    click API "https://github.com/codinginflow/nextjs-15-ai-resume-builder/tree/Final-project/src/app/api/stripe-webhook"
    click APIChild "https://github.com/codinginflow/nextjs-15-ai-resume-builder/blob/Final-project/src/app/api/stripe-webhook/route.ts"
    click DB "https://github.com/codinginflow/nextjs-15-ai-resume-builder/tree/Final-project/prisma"
    click PrismaSchema "https://github.com/codinginflow/nextjs-15-ai-resume-builder/blob/Final-project/prisma/schema.prisma"
    click PrismaLib "https://github.com/codinginflow/nextjs-15-ai-resume-builder/blob/Final-project/src/lib/prisma.ts"
    click ChatGPT "https://github.com/codinginflow/nextjs-15-ai-resume-builder/blob/Final-project/src/lib/openai.ts"
    click Stripe "https://github.com/codinginflow/nextjs-15-ai-resume-builder/blob/Final-project/src/lib/stripe.ts"
    click SubLogic "https://github.com/codinginflow/nextjs-15-ai-resume-builder/blob/Final-project/src/lib/subscription.ts"

    %% Styles
    classDef frontend fill:#BBDEFB,stroke:#0D47A1,color:#000;
    classDef backend fill:#C8E6C9,stroke:#1B5E20,color:#000;
    classDef database fill:#F0F4C3,stroke:#827717,color:#000;
    classDef external fill:#FFECB3,stroke:#FF6F00,color:#000;
    class F,Auth,Editor,Billing,SignIn,SignUp,REditor,SubButton,ManButton,ABilling frontend;
    class API,APIChild backend;
    class DB,PrismaSchema,PrismaLib database;
    class Stripe,ChatGPT,Vercel,SubLogic external;
```
