# chaise-cc/chaise-talent architecture

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

- Interactive diagram: https://gitdiagram.com/chaise-cc/chaise-talent
- Repository: https://github.com/chaise-cc/chaise-talent

## Overview

##### High-Level Components

a. Frontend Layer:
- Website Section (public facing)
- Authentication System
- Dashboard Interface
- Onboarding Flows
- Admin Panel
- Blog System

b. Backend Layer:
- Next.js API Routes
- Authentication Services
- PocketBase Integration
- Email Service
- OTP/Verification System

c. Database Layer:
- PocketBase Database (indicated by pocketbase.ts utility)

##### Key Architectural Elements

**Client Layer (Browser)**

- ▼
**Frontend Layer (Next.js App Router)**

- Public Routes (Website, Blog)

- Protected Routes
- Dashboard
- Admin Panel
- Onboarding

- Authentication Layer
- Login/Signup
- OAuth (Google)
- Session Management

**API Layer (Next.js API Routes)**

- Auth Services
- User Services
- Service Management
- Profile Management

**Service Layer**

- PocketBase Services
- Email Services
- OTP Services

**Database Layer (PocketBase)**

##### Important Relationships to Highlight

- Authentication flow between client, API, and PocketBase
- Data flow for user onboarding
- Service creation and management pipeline
- File upload and storage mechanisms
- Real-time notification system

##### Additional Notes

- Numbered sequence flows for critical paths
- Document microservices and their interactions
- Error handling and fallback mechanisms
- Caching strategies and data persistence

Remember to include annotations for:
- Authentication flows
- File upload mechanisms
- Real-time features
- External service integrations
- Database relationships
- Caching strategies
- Security measures

This will provide a comprehensive view of the system while maintaining clarity and usefulness for the development team.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        direction TB
        WebSection["Website Section"]
        AuthSystem["Authentication System"]
        DashInterface["Dashboard Interface"]
        OnboardFlow["Onboarding Flows"]
        AdminPanel["Admin Panel"]
        BlogSystem["Blog System"]
        UIComp["UI Components"]
        CustomComp["Custom Components"]
    end

    subgraph Server
        direction TB
        APIRoutes["API Routes"]
        AuthServices["Authentication Services"]
        AuthProvider["Authentication Provider"]
        EmailServ["Email Service"]
        OTPSystem["OTP/Verification System"]
        UserMgmt["User Management"]
        FormValid["Form Validation"]
    end

    subgraph Storage
        direction TB
        PBIntegration[("PocketBase Integration")]
        FileStore[("File Storage")]
    end

    %% Connections
    WebSection --> APIRoutes
    AuthSystem --> AuthServices
    DashInterface --> APIRoutes
    OnboardFlow --> APIRoutes
    AdminPanel --> APIRoutes
    BlogSystem --> APIRoutes

    APIRoutes --> PBIntegration
    AuthServices --> PBIntegration
    AuthServices --> AuthProvider
    AuthServices --> EmailServ
    AuthServices --> OTPSystem
    
    UserMgmt --> PBIntegration
    FormValid --> APIRoutes

    APIRoutes --> FileStore

    %% Click Events
    click WebSection "https://github.com/chaise-cc/chaise-talent/tree/main/src/app/(pages)/(website)"
    click AuthSystem "https://github.com/chaise-cc/chaise-talent/tree/main/src/app/(pages)/(auth)"
    click DashInterface "https://github.com/chaise-cc/chaise-talent/tree/main/src/app/(pages)/(dashboard)"
    click OnboardFlow "https://github.com/chaise-cc/chaise-talent/tree/main/src/app/(pages)/(onboarding)"
    click AdminPanel "https://github.com/chaise-cc/chaise-talent/tree/main/src/app/(pages)/(admin)"
    click BlogSystem "https://github.com/chaise-cc/chaise-talent/tree/main/src/app/(pages)/(blog)"
    click APIRoutes "https://github.com/chaise-cc/chaise-talent/tree/main/src/app/api"
    click AuthServices "https://github.com/chaise-cc/chaise-talent/blob/main/src/app/_actions/auth.action.ts"
    click EmailServ "https://github.com/chaise-cc/chaise-talent/tree/main/src/utils/emails"
    click OTPSystem "https://github.com/chaise-cc/chaise-talent/tree/main/src/utils/OTPs"
    click PBIntegration "https://github.com/chaise-cc/chaise-talent/blob/main/src/lib/pocketbase.ts"
    click FileStore "https://github.com/chaise-cc/chaise-talent/tree/main/public/images"
    click UserMgmt "https://github.com/chaise-cc/chaise-talent/tree/main/src/utils/pb"
    click FormValid "https://github.com/chaise-cc/chaise-talent/tree/main/src/lib/zod"
    click AuthProvider "https://github.com/chaise-cc/chaise-talent/blob/main/src/app/_providers/auth.provider.tsx"
    click UIComp "https://github.com/chaise-cc/chaise-talent/tree/main/src/components/ui"
    click CustomComp "https://github.com/chaise-cc/chaise-talent/tree/main/src/components/custom"

    %% Styling
    classDef client fill:#a8dadc,stroke:#457b9d
    classDef server fill:#457b9d,stroke:#1d3557
    classDef storage fill:#e63946,stroke:#1d3557
    
    class WebSection,AuthSystem,DashInterface,OnboardFlow,AdminPanel,BlogSystem,UIComp,CustomComp client
    class APIRoutes,AuthServices,AuthProvider,EmailServ,OTPSystem,UserMgmt,FormValid server
    class PBIntegration,FileStore storage

    %% Legend
    subgraph Legend
        direction TB
        Client1[Client Components]:::client
        Server1[Server Components]:::server
        Storage1[Storage Components]:::storage
    end
```
