# muperdev/collabute architecture

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

- Interactive diagram: https://gitdiagram.com/muperdev/collabute
- Repository: https://github.com/muperdev/collabute

## Overview

##### Project type and purpose
- This is a full-stack web application built on Next.js 14 (App Router) with React and TypeScript.
- It serves as a “Development Assistant” platform featuring user authentication, a multi-step AI-powered wizard, coding challenges, GitHub data integration, and a user dashboard (projects, issues, payments, KYC, etc.).

##### File structure
- Top-level folders:
- app/ → Next.js pages and server components
- app/api/ → serverless API routes
- components/ → reusable UI components, organized by feature (auth, dashboard, wizard, etc.)
- lib/ → server-side business logic (actions, auth handlers, data fetchers)
- providers/ → React Context providers (UserContext, Theme, Email)
- styles/ & tailwind.config.ts → global and utility styles
- Configuration files: next.config.mjs, tsconfig.json, .env.example, postcss.config.mjs
- No explicit ORM/DB folder; data access likely via lib/auth-server.ts and lib/create-user.ts to a database defined in env.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend (Client)" 
        direction TB
        BrowserUI["Browser UI<br/>(Client Components & Providers)"]:::client
        Providers["Context Providers<br/>(User, Theme, Email)"]:::client
        Pages["Next.js Client Pages"]:::client
    end

    %% Next.js App Server 
    subgraph "Next.js Application Server" 
        direction TB
        ServerComponents["Server Components<br/>(app/page, about-us, auth, wizard, dashboard)"]:::server
        API["API Routes<br/>(challenge, wizard-AI)"]:::server
    end

    %% Service Layer
    subgraph "Business Logic Service Layer (lib/)" 
        direction TB
        AuthActions["Auth Actions<br/>(signin, signup)"]:::server
        UserLogic["User & Project Logic<br/>(create-user, get-user, get-project(s))"]:::server
        GitHubData["GitHub Data Fetcher"]:::server
        AIUtils["AI Utilities"]:::server
    end

    %% Data Layer
    Database["Database"]:::database

    %% External Services
    subgraph "External Services" 
        direction TB
        GitHubAPI["GitHub API"]:::external
        AIServices["AI Services"]:::external
    end

    %% Static Assets & Styles
    subgraph "Static Assets & Styles" 
        direction TB
        PublicAssets["public/"]:::external
        GlobalStyles["app/globals.css<br/>styles/ & tailwind.config.ts"]:::external
    end

    %% Type Definitions
    subgraph "Type Definitions (types/)" 
        direction TB
        Types["Shared Types"]:::external
    end

    %% Relationships
    BrowserUI -->|renders| ServerComponents
    BrowserUI -->|fetches data via| API
    Providers --> BrowserUI
    Pages --> BrowserUI

    ServerComponents -->|calls| AuthActions
    ServerComponents -->|calls| UserLogic
    API -->|invokes| AuthActions
    API -->|invokes| UserLogic
    API -->|invokes| GitHubData
    API -->|invokes| AIUtils

    AuthActions -->|reads/writes| Database
    UserLogic -->|reads/writes| Database
    GitHubData -->|requests| GitHubAPI
    AIUtils -->|requests| AIServices

    ServerComponents -->|serves static files| PublicAssets
    ServerComponents -->|loads styles| GlobalStyles

    %% Click Events - Frontend
    click BrowserUI "https://github.com/muperdev/collabute/blob/production/app/layout.tsx"
    click Providers "https://github.com/muperdev/collabute/blob/production/app/provider.tsx"
    click Providers "https://github.com/muperdev/collabute/blob/production/app/providers/EmailContext.tsx"
    click Providers "https://github.com/muperdev/collabute/blob/production/app/providers/ThemeProvider.tsx"
    click Providers "https://github.com/muperdev/collabute/blob/production/app/providers/UserContext.tsx"
    click Pages "https://github.com/muperdev/collabute/blob/production/app/page.tsx"
    click Pages "https://github.com/muperdev/collabute/blob/production/app/about-us/page.tsx"
    click Pages "https://github.com/muperdev/collabute/blob/production/app/auth/page.tsx"
    click Pages "https://github.com/muperdev/collabute/blob/production/app/wizard/page.tsx"
    click Pages "https://github.com/muperdev/collabute/blob/production/app/dashboard/layout.tsx"

    %% Click Events - API Layer
    click API "https://github.com/muperdev/collabute/blob/production/app/api/challenge/technical/route.ts"
    click API "https://github.com/muperdev/collabute/blob/production/app/api/challenge/time-management/route.ts"
    click API "https://github.com/muperdev/collabute/blob/production/app/api/wizard-competitors-ai/route.ts"
    click API "https://github.com/muperdev/collabute/blob/production/app/api/wizard-features-ai/route.ts"
    click API "https://github.com/muperdev/collabute/blob/production/app/api/wizard-industry-ai/route.ts"

    %% Click Events - Service Layer
    click AuthActions "https://github.com/muperdev/collabute/blob/production/lib/actions/signin-action.ts"
    click AuthActions "https://github.com/muperdev/collabute/blob/production/lib/actions/signup-action.ts"
    click AuthActions "https://github.com/muperdev/collabute/blob/production/lib/auth-server.ts"
    click UserLogic "https://github.com/muperdev/collabute/blob/production/lib/create-user.ts"
    click UserLogic "https://github.com/muperdev/collabute/blob/production/lib/get-user.ts"
    click UserLogic "https://github.com/muperdev/collabute/blob/production/lib/get-project.ts"
    click UserLogic "https://github.com/muperdev/collabute/blob/production/lib/get-projects.ts"
    click GitHubData "https://github.com/muperdev/collabute/blob/production/lib/get-github-data.ts"
    click AIUtils "https://github.com/muperdev/collabute/blob/production/lib/utils/ai.ts"

    %% Click Events - Static & Styles
    click PublicAssets "https://github.com/muperdev/collabute/tree/production/public/"
    click GlobalStyles "https://github.com/muperdev/collabute/blob/production/app/globals.css"
    click GlobalStyles "https://github.com/muperdev/collabute/tree/production/styles/"
    click GlobalStyles "https://github.com/muperdev/collabute/blob/production/tailwind.config.ts"

    %% Click Events - Types
    click Types "https://github.com/muperdev/collabute/blob/production/types/auth.types.ts"
    click Types "https://github.com/muperdev/collabute/blob/production/types/github.ts"
    click Types "https://github.com/muperdev/collabute/blob/production/types/wizard.ts"

    %% Styles
    classDef client fill:#cce5ff,stroke:#1f78b4,color:#000
    classDef server fill:#d4edda,stroke:#2e7d32,color:#000
    classDef external fill:#fff3cd,stroke:#c58900,color:#000
    classDef database fill:#f8d7da,stroke:#c62828,color:#000
```
