# audioboxer217/tkd_registration_backend architecture

> Architecture diagram of the GitHub repository audioboxer217/tkd_registration_backend, 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_backend
- Repository: https://github.com/audioboxer217/tkd_registration_backend

## Overview

##### Project Type and Purpose
This is a backend service component of a larger Taekwondo tournament registration system, implemented as a serverless application using AWS services. The project follows a event-driven, microservices-style architecture.

##### Main Components

a. Core Processing Services:
- Process Entries Service (Main handler)
- Badge Generation Service
- AWS-Google Drive Sync Service

b. Storage Systems:
- Amazon DynamoDB (Registration data)
- S3 Buckets (Multiple buckets for badges, config, profile pictures)

c. Message Queue:
- Amazon SQS (For asynchronous processing)

d. External Service Integrations:
- Stripe API (Payment processing)
- Google Drive API (File synchronization)
- Challonge API (Tournament management)
- Email Service (SMTP)

**Top Layer: External Interfaces (APIs)**
**Middle Layer: Core Services**
**Bottom Layer: Storage & Infrastructure**

##### Key Architectural Patterns to Highlight

a. Serverless Architecture:
- Lambda functions for each service
- API Gateway as entry point

b. Event-Driven Pattern:
- SQS queue connections
- Event flow between services

c. Data Flow:
- Entry processing flow
- Badge generation pipeline
- Sync operations

##### Implementation Details

a. Components:
**┌─ API Gateway**
- Lambda Functions
- Process Entries
- Generate Badges
- Sync AWS-GDrive
- Storage
- DynamoDB
- S3 Buckets
- External Services
- Stripe
- Google Drive
- Challonge

b. Important Configurations:
- Environment variables connections
- Security boundaries
- AWS resource relationships

##### Documentation Elements

- Version/environment indicators
- Deployment paths (Zappa)
- Configuration dependencies

Remember to include the local development setup path as an alternative flow, showing how the system can be tested and developed locally using the virtual environment and configuration files.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef aws fill:#FF9900,stroke:#232F3E,color:black
    classDef service fill:#2374AB,stroke:#1B577B,color:white
    classDef storage fill:#60A561,stroke:#2F6C30,color:white
    classDef external fill:#666666,stroke:#333333,color:white
    classDef queue fill:#9D4EDD,stroke:#5A189A,color:white
    classDef config fill:#F4A261,stroke:#E76F51,color:black

    %% External APIs Layer
    subgraph External["External Services"]
        Stripe["Stripe API"]:::external
        GDrive["Google Drive API"]:::external
        Challonge["Challonge API"]:::external
        SMTP["Email Service (SMTP)"]:::external
    end

    %% API Gateway & Core Services
    APIGateway["API Gateway"]:::aws
    
    subgraph CoreServices["Core Processing Services"]
        ProcessEntries["Process Entries Service"]:::service
        BadgeGen["Badge Generation Service"]:::service
        SyncService["AWS-Google Drive Sync"]:::service
    end

    %% Message Queue
    SQS["Amazon SQS"]:::queue

    %% Storage Layer
    subgraph Storage["Storage Systems"]
        DynamoDB["DynamoDB"]:::storage
        S3Badges["S3 Badges Bucket"]:::storage
        S3Config["S3 Config Bucket"]:::storage
        S3Profiles["S3 Profile Pictures"]:::storage
    end

    %% Configuration and Development
    subgraph Config["Configuration & Development"]
        EnvConfig["Environment Config"]:::config
        TestInfra["Test Infrastructure"]:::config
        CICD["CI/CD Pipeline"]:::config
        DevTasks["Development Tasks"]:::config
    end

    %% Relationships
    APIGateway --> ProcessEntries
    ProcessEntries --> SQS
    SQS --> BadgeGen
    SQS --> SyncService
    
    ProcessEntries --> DynamoDB
    ProcessEntries --> Stripe
    ProcessEntries --> SMTP
    
    BadgeGen --> S3Badges
    BadgeGen --> S3Profiles
    
    SyncService --> GDrive
    SyncService --> S3Config
    
    ProcessEntries --> Challonge

    %% Click Events
    click ProcessEntries "https://github.com/audioboxer217/tkd_registration_backend/blob/main/process_entries.py"
    click BadgeGen "https://github.com/audioboxer217/tkd_registration_backend/blob/main/regen_badges.py"
    click SyncService "https://github.com/audioboxer217/tkd_registration_backend/blob/main/sync_aws_gdrive.py"
    click EnvConfig "https://github.com/audioboxer217/tkd_registration_backend/tree/main/envs/"
    click TestInfra "https://github.com/audioboxer217/tkd_registration_backend/tree/main/tests/"
    click CICD "https://github.com/audioboxer217/tkd_registration_backend/blob/main/.github/workflows/main.yml"
    click DevTasks "https://github.com/audioboxer217/tkd_registration_backend/tree/main/justfile"

    %% Legend
    subgraph Legend
        AWS["AWS Service"]:::aws
        CoreService["Core Service"]:::service
        StorageSystem["Storage"]:::storage
        ExternalAPI["External API"]:::external
        QueueSystem["Message Queue"]:::queue
        ConfigItem["Configuration"]:::config
    end
```
