# alexisanzieu/flybooth architecture

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

- Interactive diagram: https://gitdiagram.com/alexisanzieu/flybooth
- Repository: https://github.com/alexisanzieu/flybooth

## Overview

##### Main Components Identification

The system should be divided into these key components:
- Client Application (Next.js Frontend)
- API Layer (Next.js API Routes)
- External Services Layer
- Database Layer

##### Detailed Component Breakdown

a. Client Application:
- Language Router ([lang] directory)
- Core Features (Upload, Gallery, Coverflow, Message)
- Shared Components (QR Code, Language Switcher, etc.)

b. API Layer:
- Cloudinary Integration
- Email Service
- Moderation Service
- Settings Management
- Short Link Generation
- Text Management

- Vercel (Deployment & API)
- Cloudinary (Image Storage)
- Resend (Email Service)
- Sightengine (Image Moderation)
- Turso (MySQL Database)
- Upstash (Redis)

##### Connection and Data Flow

- Client → API Routes (HTTP Requests)
- API Routes → External Services
- Database Connections (Redis for short links, MySQL for messages)
- Image Processing Flow (Upload → Cloudinary → Moderation)

##### Specific Implementation Details

Technical aspects:
- Internationalization flow (i18n)
- Authentication/Authorization flow
- Image processing pipeline
- Caching mechanism (Redis)

##### Additional Elements

Include:
- Version information
- Environment variables reference
- Security boundaries

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        LangRouter["Language Router"]
        
        subgraph CoreFeatures["Core Features"]
            Upload["Upload Component"]
            Gallery["Gallery Component"]
            Coverflow["Coverflow Component"]
            Message["Message Component"]
        end
        
        subgraph SharedComponents["Shared Components"]
            QRCode["QR Code"]
            LangSwitch["Language Switcher"]
            TextBoard["Text Board"]
            MotionBtn["Motion Button"]
        end
    end
    
    subgraph APILayer["API Layer"]
        CloudAPI["Cloudinary API"]
        EmailAPI["Email Service API"]
        ModAPI["Moderation API"]
        SettingsAPI["Settings API"]
        ShortLinkAPI["Short Link API"]
        TextAPI["Text Management API"]
        DeleteAPI["Image Deletion API"]
    end
    
    subgraph ExternalServices["External Services"]
        Vercel["Vercel"]
        Cloudinary["Cloudinary"]
        Resend["Resend"]
        SightEngine["Sightengine"]
    end
    
    subgraph DataStores["Data Stores"]
        Turso[(Turso MySQL)]
        Upstash[(Upstash Redis)]
    end
    
    subgraph Utils["Utilities"]
        DBConn["Database Connection"]
        RedisInt["Redis Integration"]
        DataFetch["Data Fetcher"]
        I18N["i18n Config"]
        Constants["Constants"]
        DateUtils["Date Utilities"]
    end

    %% Connections
    Client --> APILayer
    APILayer --> ExternalServices
    APILayer --> DataStores
    Utils --> DataStores
    Utils --> ExternalServices

    %% Click Events
    click LangRouter "https://github.com/AlexisAnzieu/flybooth/tree/main/app/[lang]"
    click Upload "https://github.com/AlexisAnzieu/flybooth/blob/main/app/[lang]/[flyboothId]/upload/page.tsx"
    click Gallery "https://github.com/AlexisAnzieu/flybooth/blob/main/app/[lang]/[flyboothId]/gallery/page.tsx"
    click Coverflow "https://github.com/AlexisAnzieu/flybooth/blob/main/app/[lang]/[flyboothId]/coverflow/page.tsx"
    click Message "https://github.com/AlexisAnzieu/flybooth/blob/main/app/[lang]/[flyboothId]/message/page.tsx"
    click QRCode "https://github.com/AlexisAnzieu/flybooth/blob/main/component/qr-code.tsx"
    click LangSwitch "https://github.com/AlexisAnzieu/flybooth/blob/main/component/language-switcher.tsx"
    click TextBoard "https://github.com/AlexisAnzieu/flybooth/blob/main/component/text-board.tsx"
    click MotionBtn "https://github.com/AlexisAnzieu/flybooth/blob/main/component/motion-button.tsx"
    click CloudAPI "https://github.com/AlexisAnzieu/flybooth/blob/main/app/api/cloudinary/route.ts"
    click EmailAPI "https://github.com/AlexisAnzieu/flybooth/blob/main/app/api/send-email/route.tsx"
    click ModAPI "https://github.com/AlexisAnzieu/flybooth/blob/main/app/api/moderation/route.ts"
    click SettingsAPI "https://github.com/AlexisAnzieu/flybooth/blob/main/app/api/settings/[setting]/route.ts"
    click ShortLinkAPI "https://github.com/AlexisAnzieu/flybooth/blob/main/app/api/short-link/route.ts"
    click TextAPI "https://github.com/AlexisAnzieu/flybooth/blob/main/app/api/texts/route.ts"
    click DeleteAPI "https://github.com/AlexisAnzieu/flybooth/blob/main/app/api/delete-images/route.ts"
    click DBConn "https://github.com/AlexisAnzieu/flybooth/blob/main/lib/db.ts"
    click RedisInt "https://github.com/AlexisAnzieu/flybooth/blob/main/lib/redis.ts"
    click DataFetch "https://github.com/AlexisAnzieu/flybooth/blob/main/lib/fetcher.ts"
    click I18N "https://github.com/AlexisAnzieu/flybooth/blob/main/i18n.js"
    click Constants "https://github.com/AlexisAnzieu/flybooth/blob/main/lib/constants.ts"
    click DateUtils "https://github.com/AlexisAnzieu/flybooth/blob/main/lib/date.ts"

    %% Styling
    classDef frontend fill:#2196F3,color:white
    classDef api fill:#9C27B0,color:white
    classDef external fill:#4CAF50,color:white
    classDef database fill:#FF9800,color:white
    classDef util fill:#607D8B,color:white

    class LangRouter,Upload,Gallery,Coverflow,Message,QRCode,LangSwitch,TextBoard,MotionBtn frontend
    class CloudAPI,EmailAPI,ModAPI,SettingsAPI,ShortLinkAPI,TextAPI,DeleteAPI api
    class Vercel,Cloudinary,Resend,SightEngine external
    class Turso,Upstash database
    class DBConn,RedisInt,DataFetch,I18N,Constants,DateUtils util
```
