# facubotta/filrouge2024 architecture

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

- Interactive diagram: https://gitdiagram.com/facubotta/filrouge2024
- Repository: https://github.com/facubotta/filrouge2024

## Overview

##### Main System Components

a) Frontend Layer:
- Next.js App Router Structure (evident from the /app directory)
- Client Components (/components directory)
- Theme System (light/dark mode)
- Authentication UI (@auth directory)
- Pages/Routes Structure

b) Backend Layer:
- Server Actions (organized in /actions directory)
- API Routes (/app/api)
- Authentication System (NextAuth.js)
- WebSocket Integration (socket.ts)

c) Database Layer:
- PostgreSQL Database (evident from Prisma schema)
- Prisma ORM
- Migration System

d) External Services:
- Google Calendar Integration
- Google Maps Integration (googleMapsProvider.ts)
- Authentication Providers (Google, Email)

##### Key Architectural Patterns to Highlight

- Server Components Architecture (Next.js 13+ pattern)
- Feature-based Directory Structure
- Server Actions Pattern
- Real-time Communication (WebSocket)

**┌─ Client Layer ─────────────────────┐**
- Next.js Pages                    │
- React Components                 │
- Theme System                     │
- ┬────────────────────┘
- ↕
**┌─ Server Layer ─────────────────────┐**
- ┌─ Next.js App Router ───┐         │
- Server Components    │         │
- Server Actions      │         │
- ┘          │
- ┌─ API Layer ──────────┐         │
- REST Endpoints     │         │
- WebSocket Server   │         │
- ┘          │
- ┬────────────────────┘
- ↕
**┌─ Data Layer ──────────────────────┐**
- Prisma ORM                      │
- PostgreSQL Database             │
- ┬────────────────────┘
- ↕
**┌─ External Services ───────────────┐**
- Google Calendar API             │
- Google Maps API                 │
- Authentication Providers        │
- ┘

##### Important Flows to Highlight

a) Authentication Flow:
- Path from login UI through NextAuth.js to external providers
- Session management

b) Event Management Flow:
- Event creation/update path
- Calendar synchronization
- Real-time updates

c) Messaging System:
- WebSocket connections
- Message storage and retrieval
- Real-time notifications

##### Additional Details

- Security boundaries
- Scalable components
- Caching layers where applicable

##### Specific Features to Emphasize

- Real-time messaging system
- Event management and calendar integration
- User rating and comment system
- Profile management
- Category-based event organization

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        NextRouter["Next.js App Router"]
        ClientComp["Client Components"]
        ThemeSystem["Theme System"]
        AuthUI["Authentication UI"]
        direction TB
    end

    subgraph Server
        ServerActions["Server Actions"]
        APIRoutes["API Routes"]
        WebSocket["WebSocket Server"]
        AuthSystem["Authentication System"]
        direction TB
    end

    subgraph Database
        Prisma["Prisma ORM"]
        PostgreSQL[(PostgreSQL)]
        direction TB
    end

    subgraph "External Services"
        GCalendar["Google Calendar API"]
        GMaps["Google Maps"]
        AuthProviders["Auth Providers"]
        direction TB
    end

    subgraph "Feature Modules"
        Messages["Message System"]
        Events["Event Management"]
        Users["User Management"]
        Tasks["Tasks System"]
        direction TB
    end

    %% Connections
    NextRouter --> ServerActions
    ClientComp --> ServerActions
    AuthUI --> AuthSystem
    ServerActions --> Prisma
    APIRoutes --> Prisma
    WebSocket --> Prisma
    Prisma --> PostgreSQL
    AuthSystem --> AuthProviders
    Events --> GCalendar
    Events --> GMaps

    %% Feature connections
    Messages --> WebSocket
    Events --> ServerActions
    Users --> ServerActions
    Tasks --> ServerActions

    %% Styling
    classDef frontend fill:#a8d1ff
    classDef server fill:#90EE90
    classDef database fill:#FFE5B4
    classDef external fill:#DDA0DD
    classDef feature fill:#98FB98

    class NextRouter,ClientComp,ThemeSystem,AuthUI frontend
    class ServerActions,APIRoutes,WebSocket,AuthSystem server
    class Prisma,PostgreSQL database
    class GCalendar,GMaps,AuthProviders external
    class Messages,Events,Users,Tasks feature

    %% Click events
    click NextRouter "https://github.com/FacuBotta/filrouge2024/tree/main/app"
    click ClientComp "https://github.com/FacuBotta/filrouge2024/tree/main/components"
    click ThemeSystem "https://github.com/FacuBotta/filrouge2024/blob/main/components/layouts/header/ThemeSwitcher.tsx"
    click AuthUI "https://github.com/FacuBotta/filrouge2024/tree/main/app/@auth"
    click ServerActions "https://github.com/FacuBotta/filrouge2024/tree/main/actions"
    click APIRoutes "https://github.com/FacuBotta/filrouge2024/tree/main/app/api"
    click WebSocket "https://github.com/FacuBotta/filrouge2024/blob/main/app/api/socket.ts"
    click AuthSystem "https://github.com/FacuBotta/filrouge2024/blob/main/app/api/auth/[...nextauth]"
    click Prisma "https://github.com/FacuBotta/filrouge2024/blob/main/database/prisma_schema.prisma"
    click GMaps "https://github.com/FacuBotta/filrouge2024/blob/main/lib/googleMapsProvider.ts"
    click Messages "https://github.com/FacuBotta/filrouge2024/tree/main/actions/messagesServerActions"
    click Events "https://github.com/FacuBotta/filrouge2024/tree/main/actions/eventsServerActions"
    click Users "https://github.com/FacuBotta/filrouge2024/tree/main/actions/userServerActions"
    click Tasks "https://github.com/FacuBotta/filrouge2024/tree/main/actions/TasksServerActions"
```
