# audioboxer217/tkd_registration_frontend architecture

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

- Interactive diagram: https://gitdiagram.com/audioboxer217/tkd_registration_frontend
- Repository: https://github.com/audioboxer217/tkd_registration_frontend

## Overview

##### Main Components

a. Client Layer:
- Web Browsers (Users and Admins)
- Static Assets (JS files in /static/js)
- HTML Templates (in /templates directory)

b. Frontend Application Layer:
- Flask Web Application (app.py)
- Form Processing Components
- Template Engine
- Authentication System (evident from login.html)

c. Backend Services Layer:
- Process Entries Service
- Badge Generation Service
- AWS-GDrive Sync Service

d. Data Storage Layer:
- DynamoDB Tables
- S3 Buckets (multiple buckets for different purposes)

e. Message Queue Layer:
- AWS SQS Queue

f. External Services:
- Stripe Payment Processing
- Google Drive API
- Challonge API
- Google Maps API (from environment variables)

**┌─ Client Tier ─────────────────────────┐**
- Web Browsers │ Static Assets │ Templates│
- ┴───────────────┴─────────┘
- ↓
**┌─ Frontend Application Tier ───────────┐**
- Flask App │ Forms │ Auth │ API Client │
- ┴───────┴──────┴───────────┘
- ↓
**┌─ Backend Services Tier ──────────────┐**
- Entry Processing │ Badges │ Sync     │
- ┘
- ↓
**┌─ Infrastructure Tier ───────────────┐**
- DynamoDB │ S3 │ SQS │ Email Service │
- ┴────┴─────┴──────────────┘

##### Key Flows to Highlight

a. Registration Flow:
- User → Frontend → Form Processing → SQS → Entry Processing → DynamoDB
- Payment Processing: Frontend → Stripe API → Backend Confirmation

b. Admin Flow:
- Admin → Frontend → Backend Services → Data Storage
- Badge Generation Flow
- AWS-GDrive Sync Flow

##### Important Details

- Environment configurations (shown in /envs directory)
- Security boundaries
- API integration points
- Data flow directions
- Error handling paths (evident from registration_error.html)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Web Browser"]
        StaticAssets["Static Assets"]:::static
        Templates["HTML Templates"]:::templates
    end

    subgraph Frontend
        Flask["Flask Application"]:::flask
        Forms["Form Processing"]:::forms
        Auth["Authentication System"]:::auth
        Admin["Admin Interface"]:::admin
        CompMgmt["Competitor Management"]:::comp
        CoachMgmt["Coach Management"]:::coach
        RegForms["Registration Forms"]:::reg
        ErrorHandler["Error Handling"]:::error
        SuccessHandler["Success Handling"]:::success
    end

    subgraph Backend
        EntryProcess["Entry Processing Service"]
        BadgeGen["Badge Generation Service"]
        GDriveSync["AWS-GDrive Sync Service"]
        TestFramework["Testing Framework"]:::test
        CICD["CI/CD Pipeline"]:::cicd
    end

    subgraph Infrastructure
        DynamoDB[(DynamoDB)]
        S3[(S3 Buckets)]
        SQS[("AWS SQS Queue")]
        EnvConfig["Environment Config"]:::env
    end

    subgraph External
        StripeAPI["Stripe Payment API"]
        GDriveAPI["Google Drive API"]
        ChallongeAPI["Challonge API"]
        GMapsAPI["Google Maps API"]
    end

    Browser --> StaticAssets
    Browser --> Templates
    Browser --> Flask
    
    Flask --> Forms
    Flask --> Auth
    Flask --> Admin
    Flask --> CompMgmt
    Flask --> CoachMgmt
    Flask --> RegForms
    Flask --> ErrorHandler
    Flask --> SuccessHandler
    
    Forms --> EntryProcess
    EntryProcess --> SQS
    EntryProcess --> DynamoDB
    
    Admin --> BadgeGen
    BadgeGen --> S3
    
    GDriveSync --> S3
    GDriveSync --> GDriveAPI
    
    Flask --> StripeAPI
    Flask --> ChallongeAPI
    Flask --> GMapsAPI

    classDef static fill:#d4d4d4,stroke:#333
    classDef templates fill:#f9f9f9,stroke:#333
    classDef flask fill:#3498db,stroke:#333
    classDef forms fill:#2ecc71,stroke:#333
    classDef auth fill:#e74c3c,stroke:#333
    classDef admin fill:#9b59b6,stroke:#333
    classDef comp fill:#f1c40f,stroke:#333
    classDef coach fill:#e67e22,stroke:#333
    classDef reg fill:#1abc9c,stroke:#333
    classDef error fill:#c0392b,stroke:#333
    classDef success fill:#27ae60,stroke:#333
    classDef test fill:#95a5a6,stroke:#333
    classDef cicd fill:#34495e,stroke:#333
    classDef env fill:#16a085,stroke:#333

    click Flask "https://github.com/audioboxer217/tkd_registration_frontend/blob/main/app.py"
    click StaticAssets "https://github.com/audioboxer217/tkd_registration_frontend/tree/main/static/js/"
    click Templates "https://github.com/audioboxer217/tkd_registration_frontend/tree/main/templates/"
    click Forms "https://github.com/audioboxer217/tkd_registration_frontend/blob/main/templates/partials/form_*.html"
    click Auth "https://github.com/audioboxer217/tkd_registration_frontend/blob/main/templates/login.html"
    click Admin "https://github.com/audioboxer217/tkd_registration_frontend/blob/main/templates/admin.html"
    click CompMgmt "https://github.com/audioboxer217/tkd_registration_frontend/blob/main/templates/competitors.html"
    click CoachMgmt "https://github.com/audioboxer217/tkd_registration_frontend/blob/main/templates/coaches.html"
    click RegForms "https://github.com/audioboxer217/tkd_registration_frontend/blob/main/templates/form.html"
    click EnvConfig "https://github.com/audioboxer217/tkd_registration_frontend/tree/main/envs/"
    click ErrorHandler "https://github.com/audioboxer217/tkd_registration_frontend/blob/main/templates/registration_error.html"
    click SuccessHandler "https://github.com/audioboxer217/tkd_registration_frontend/blob/main/templates/success.html"
    click CICD "https://github.com/audioboxer217/tkd_registration_frontend/blob/main/.github/workflows/main.yml"
    click TestFramework "https://github.com/audioboxer217/tkd_registration_frontend/blob/main/tests/test_website.py"
```
