# vinhloc30796/creativecontact-app architecture

> Architecture diagram of the GitHub repository vinhloc30796/creativecontact-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vinhloc30796/creativecontact-app
- Repository: https://github.com/vinhloc30796/creativecontact-app

## Overview

##### Main System Components

a) Frontend Layer:
- Next.js App Router (with route groups: auth, protected, public)
- Client-side Components
- Server Components
- UI Components Library
- i18n Internationalization System

b) Backend Layer:
- API Routes (/app/api/*)
- Server Actions (/app/actions/*)
- Authentication System
- Email Service
- File Upload System

c) Database & Storage:
- Supabase Database
- S3-compatible Storage (for artwork assets and profile pictures)
- Drizzle ORM Layer

##### Key Relationships to Highlight

- Client-Server Communication
- API Routes Flow
- Authentication Flow
- Data Flow between Components
- File Upload Flow
- Database Interactions

##### Detailed Component Breakdown

🟦 Frontend Components:
- Public Pages (blue)
- Protected Pages (green)
- Auth Pages (yellow)
- Shared Components (gray)

🟥 Backend Services:
- API Routes
- Server Actions
- Authentication Services
- Email Service
- File Management

🟨 Data Layer:
- Database Tables
- Storage Buckets
- ORM Layer

##### Specific Implementation Details

Specialized sections for:

a) Authentication Flow:
- Magic Link Authentication
- Staff Access
- Protected Routes

b) Event Management:
- Registration System
- Check-in System
- Event Slots

c) Portfolio System:
- Artwork Management
- Credit System
- Asset Management

d) User Management:
- Profile System
- Contact Management
- Skills System

##### Integration Points

External service integrations:
- Supabase
- Email Service
- Storage Service
- i18n System

**[Client Layer]**
- ↕️
**[Next.js App Router]**
- ↕️
**[Server Components/Actions]**
- ↕️
**[API Layer]**
- ↕️
**[Service Layer]**
- ↕️
**[Data Access Layer]**
- ↕️
**[Database & Storage]**

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Web Browser"]
    end

    subgraph NextApp["Next.js Application"]
        direction TB
        subgraph Routes["Route Groups"]
            AuthRoutes["Auth Routes"]:::auth
            ProtectedRoutes["Protected Routes"]:::protected
            PublicRoutes["Public Routes"]:::public
        end

        subgraph Components
            UILib["UI Component Library"]:::ui
            AuthComponents["Auth Components"]:::auth
            UploadComponents["Upload Components"]:::upload
        end

        subgraph I18N["Internationalization"]
            I18NCore["i18n Core"]:::i18n
            Translations["Translations"]:::i18n
            I18NConfig["i18n Config"]:::i18n
        end
    end

    subgraph Backend
        direction TB
        subgraph API["API Layer"]
            APIRoutes["API Routes"]:::api
            ServerActions["Server Actions"]:::server
        end

        subgraph Services
            AuthService["Authentication Service"]:::service
            EmailService["Email Service"]:::service
            FileService["File Upload Service"]:::service
            UserService["User Service"]:::service
        end

        subgraph Features
            PortfolioSystem["Portfolio System"]:::feature
            EventSystem["Event Management"]:::feature
            UserManagement["User Management"]:::feature
        end
    end

    subgraph Data
        direction TB
        subgraph Storage
            S3Storage["S3-compatible Storage"]:::storage
            EmailTemplates["Email Templates"]:::storage
        end

        subgraph Database
            SupabaseDB["Supabase Database"]:::db
            DrizzleORM["Drizzle ORM"]:::db
            DBSchema["Database Schema"]:::db
            Migrations["Database Migrations"]:::db
        end
    end

    Browser --> Routes
    Routes --> Components
    Routes --> I18N
    Routes --> API
    API --> Services
    Services --> Features
    Features --> Database
    Services --> Storage

    %% Component Mappings
    click AuthRoutes "https://github.com/vinhloc30796/creativecontact-app/tree/main/app/(auth)/"
    click ProtectedRoutes "https://github.com/vinhloc30796/creativecontact-app/tree/main/app/(protected)/"
    click PublicRoutes "https://github.com/vinhloc30796/creativecontact-app/tree/main/app/(public)/"
    click UILib "https://github.com/vinhloc30796/creativecontact-app/tree/main/components/ui/"
    click I18NCore "https://github.com/vinhloc30796/creativecontact-app/tree/main/lib/i18n/"
    click Translations "https://github.com/vinhloc30796/creativecontact-app/tree/main/public/translations/"
    click I18NConfig "https://github.com/vinhloc30796/creativecontact-app/blob/main/i18nConfig.ts"
    click APIRoutes "https://github.com/vinhloc30796/creativecontact-app/tree/main/app/api/"
    click ServerActions "https://github.com/vinhloc30796/creativecontact-app/tree/main/app/actions/"
    click AuthComponents "https://github.com/vinhloc30796/creativecontact-app/tree/main/components/auth/"
    click AuthService "https://github.com/vinhloc30796/creativecontact-app/tree/main/utils/supabase/"
    click EmailService "https://github.com/vinhloc30796/creativecontact-app/tree/main/emails/templates/"
    click EmailTemplates "https://github.com/vinhloc30796/creativecontact-app/tree/main/emails/components/"
    click UploadComponents "https://github.com/vinhloc30796/creativecontact-app/tree/main/components/uploads/"
    click FileService "https://github.com/vinhloc30796/creativecontact-app/tree/main/utils/supabase/"
    click DBSchema "https://github.com/vinhloc30796/creativecontact-app/tree/main/drizzle/schema/"
    click Migrations "https://github.com/vinhloc30796/creativecontact-app/tree/main/supabase/migrations/"
    click DrizzleORM "https://github.com/vinhloc30796/creativecontact-app/blob/main/drizzle.config.ts"
    click PortfolioSystem "https://github.com/vinhloc30796/creativecontact-app/tree/main/app/(protected)/portfolio/"
    click EventSystem "https://github.com/vinhloc30796/creativecontact-app/tree/main/app/(public)/(event)/"
    click UserManagement "https://github.com/vinhloc30796/creativecontact-app/tree/main/app/(protected)/profile/"
    click UserService "https://github.com/vinhloc30796/creativecontact-app/blob/main/services/user-service.ts"

    %% Styling
    classDef auth fill:#FFE873
    classDef protected fill:#90EE90
    classDef public fill:#87CEEB
    classDef ui fill:#D3D3D3
    classDef i18n fill:#DDA0DD
    classDef api fill:#FF6B6B
    classDef server fill:#4169E1
    classDef service fill:#FFA07A
    classDef feature fill:#98FB98
    classDef storage fill:#DEB887
    classDef db fill:#B8860B
    classDef upload fill:#20B2AA
```
