# freetailhackers/rodeo architecture

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

- Interactive diagram: https://gitdiagram.com/freetailhackers/rodeo
- Repository: https://github.com/freetailhackers/rodeo

## Overview

##### Main System Components

a) Frontend Layer:
- SvelteKit application structure (identified by src/routes directory)
- Public assets (static directory)
- Client-side components (src/lib/components)

b) Backend Layer:
- Server-side routes (/src/routes with +page.server.ts files)
- Authentication system (Lucia auth, identified by src/lib/lucia.ts)
- tRPC API layer (src/lib/trpc)
- File handling system (S3 integration via s3Handler.ts)

c) Database Layer:
- PostgreSQL database (indicated by Prisma schema)
- Prisma ORM layer

d) External Services:
- OAuth providers (GitHub, Google)
- S3-compatible storage
- Email service

##### Key Architectural Patterns to Highlight

Important architectural elements:

a) Authentication Flow:
- Social login paths
- Email verification
- Password reset flow
- Session management

b) Core Features:
- Application management
- User management
- Event scheduling
- Team formation
- Scanning/Check-in system
- Announcements system

- Blue: Frontend components
- Green: Backend services
- Yellow: External services
- Purple: Database layer
- Red: Authentication flows

**Symbols:**
- Rectangles: Major components
- Hexagons: External services

##### Component Relationships

Key interactions:

a) Client-Server Communication:
- tRPC router connections
- Server-side rendering paths
- API endpoints

b) Data Flow:
- User authentication flows
- File upload/download paths
- Event management processes
- Application submission flow

##### Implementation Details

Technical elements:

- SvelteKit framework structure
- Prisma ORM layer
- tRPC API implementation
- Lucia auth integration
- S3 storage connection

This architecture should emphasize the scalable and modular nature of the application, showing how it can handle the various phases of a hackathon from registration through to completion.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        FA[Frontend Application]:::frontend
        SC[Static Content]:::frontend
        CC[Client Components]:::frontend
        AD[Admin Dashboard]:::frontend
        click FA "https://github.com/FreetailHackers/rodeo/tree/master/src/routes"
        click SC "https://github.com/FreetailHackers/rodeo/tree/master/static/"
        click CC "https://github.com/FreetailHackers/rodeo/tree/master/src/lib/components/"
        click AD "https://github.com/FreetailHackers/rodeo/tree/master/src/routes/admin/"
    end

    subgraph Core_Features
        AM[Application Management]:::feature
        UM[User Management]:::feature
        EM[Event Management]:::feature
        TS[Team System]:::feature
        CS[Check-in System]:::feature
        AS[Announcements System]:::feature
        QM[Question Management]:::feature
        SM[Settings Management]:::feature
        click AM "https://github.com/FreetailHackers/rodeo/tree/master/src/routes/apply/"
        click UM "https://github.com/FreetailHackers/rodeo/tree/master/src/routes/users/"
        click EM "https://github.com/FreetailHackers/rodeo/tree/master/src/routes/admin/homepage/schedule/"
        click TS "https://github.com/FreetailHackers/rodeo/blob/master/src/lib/trpc/routes/team.ts"
        click CS "https://github.com/FreetailHackers/rodeo/tree/master/src/routes/scan/"
        click AS "https://github.com/FreetailHackers/rodeo/blob/master/src/lib/trpc/routes/announcements.ts"
        click QM "https://github.com/FreetailHackers/rodeo/blob/master/src/lib/trpc/routes/questions.ts"
        click SM "https://github.com/FreetailHackers/rodeo/blob/master/src/lib/trpc/routes/settings.ts"
    end

    subgraph Backend
        TR[tRPC Router]:::backend
        AH[Auth Handler]:::backend
        FS[File Storage Handler]:::backend
        ES[Email Service]:::backend
        click TR "https://github.com/FreetailHackers/rodeo/tree/master/src/lib/trpc/"
        click AH "https://github.com/FreetailHackers/rodeo/blob/master/src/lib/lucia.ts"
        click FS "https://github.com/FreetailHackers/rodeo/blob/master/src/lib/s3Handler.ts"
        click ES "https://github.com/FreetailHackers/rodeo/blob/master/src/lib/trpc/email.ts"
    end

    subgraph Auth_Flow
        AF[Authentication Flow]:::auth
        OA[OAuth Providers]:::external
        click AF "https://github.com/FreetailHackers/rodeo/tree/master/src/routes/login/"
    end

    subgraph Database
        DB[(PostgreSQL)]:::database
        PR[Prisma ORM]:::database
        click PR "https://github.com/FreetailHackers/rodeo/blob/master/prisma/schema.prisma"
    end

    subgraph External
        S3[S3 Storage]:::external
        ES2[Email Provider]:::external
    end

    %% Frontend Connections
    FA --> TR
    FA --> AF
    CC --> TR
    AD --> TR

    %% Core Feature Connections
    AM --> TR
    UM --> TR
    EM --> TR
    TS --> TR
    CS --> TR
    AS --> TR
    QM --> TR
    SM --> TR

    %% Backend Connections
    TR --> PR
    AH --> PR
    FS --> S3
    ES --> ES2

    %% Auth Flow
    AF --> AH
    AF --> OA
    OA --> AH

    %% Database Connections
    PR --> DB

    %% Styling
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef database fill:#9b59b6,stroke:#8e44ad,color:white
    classDef external fill:#f1c40f,stroke:#f39c12,color:black
    classDef auth fill:#e74c3c,stroke:#c0392b,color:white
    classDef feature fill:#1abc9c,stroke:#16a085,color:white
```
