# bcstudentsoftwaredevteam/celts architecture

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

- Interactive diagram: https://gitdiagram.com/bcstudentsoftwaredevteam/celts
- Repository: https://github.com/bcstudentsoftwaredevteam/celts

## Overview

Based on our analysis, CELTS is a Flask-based web application designed to manage programs (primarily CELTS programs) using an MVC-like structure. The project organizes its code into controllers, business logic, data models, templates, and static assets. It also utilizes a MySQL database and includes a robust testing suite with continuous integration via GitHub Actions, along with development support using VSCode devcontainers.

##### Main Components
- Web Server & Application Layer:
- Flask application – include the WSGI entry point (app.wsgi and run.py).
- “app” directory that further divides into:
▪ Controllers: With subdirectories for admin, events, main, minor, and serviceLearning. These handle HTTP requests and routing.
▪ Business Logic: The “app/logic” directory encapsulates business rules such as login management, event processing, file handling, and email management.
▪ Data Models: The “app/models” directory contains all ORM models for interfacing with the MySQL database and supporting migrations.
▪ Templates & Static Assets: Show the “app/templates” and “app/static” folders that serve the user interface (HTML, CSS, JavaScript, images, and files).

- Database:
- The MySQL database is central to persisting application data. Include migration and reset scripts from the “database” directory (with Peewee migrations in mind).

- Development/Dev Container:
- Development environment provided by the .devcontainer folder, including Dockerfiles and docker-compose, which help standardize the development setup.

- Testing and CI/CD:
- Testing framework (pytest) along with the “tests” directory (unit tests, UI tests, and test data).
- Integrate a block for GitHub Actions (from .github/workflows) that automatically runs tests on pushes and pull requests.

##### Relationships and Interactions
- Incoming HTTP requests hit the Flask application's controllers.
- Controllers invoke the business logic (in app/logic) to process requests.
- Business logic interacts with the data models to perform CRUD operations on the MySQL database.
- The templating engine (Jinja2) renders views using files from “app/templates” and static content from “app/static”.
- An external dependency such as the email handler (using Gmail or slack) that the business logic communicates with for notifications.

##### Architectural Patterns and Technologies
- MVC-Like Pattern: Clearly separate Controllers, Models, and Views.
- Use of Peewee Migrations: Note how the project updates its database schema.
- Database connectivity details – for example, MySQL configuration sourced from YAML files in “app/config”.

## Diagram (Mermaid)

```mermaid
graph TD
    A("Client Request"):::client

    subgraph "Flask Application Layer"
        subgraph "WSGI Entry Points"
            W1("app.wsgi"):::wsgi
            W2("run.py"):::wsgi
        end
        C("Controllers (Admin,Events,Main,Minor,ServiceLearning)"):::controller
        L("Business Logic"):::logic
        DM("Data Models"):::model
        subgraph "View Layer"
            T("Templates"):::template
            S("Static Assets"):::static
        end
    end

    DB("MySQL Database"):::database
    CM("Configuration Management"):::config

    subgraph "Dev & Testing Environment"
        DVC("Dev Container (.devcontainer)"):::dev
        subgraph "Testing & CI/CD"
            TS("Tests (pytest)"):::test
            GA("GitHub Actions (.github/workflows)"):::ci
        end
    end

    EN("Email Notification (Gmail/Slack)"):::external

    %% Connections
    A -->|"HTTP_Request"| C
    W1 --> C
    W2 --> C
    C -->|"calls"| L
    L -->|"CRUD_Operation"| DM
    DM -->|"DB_Queries"| DB
    L -->|"Render"| T
    L -->|"Render"| S
    L -->|"LoadConfig"| CM
    L -->|"Notify"| EN

    %% Integration arrows for development and testing
    TS ---|"runs_tests"| L
    GA ---|"CI_CD"| L
    DVC ---|"dev_setup"| W1
    DVC ---|"dev_setup"| W2

    %% Styles
    classDef client fill:#f9e79f,stroke:#d4ac0d,stroke-width:2px;
    classDef wsgi fill:#aed6f1,stroke:#2471a3,stroke-width:2px;
    classDef controller fill:#d5f5e3,stroke:#27ae60,stroke-width:2px;
    classDef logic fill:#fcf3cf,stroke:#f1c40f,stroke-width:2px;
    classDef model fill:#f5cba7,stroke:#e67e22,stroke-width:2px;
    classDef template fill:#e8daef,stroke:#8e44ad,stroke-width:2px;
    classDef static fill:#d6eaf8,stroke:#3498db,stroke-width:2px;
    classDef database fill:#fadbd8,stroke:#e74c3c,stroke-width:2px;
    classDef dev fill:#d6dbdf,stroke:#7f8c8d,stroke-width:2px;
    classDef test fill:#fbeee6,stroke:#e67e22,stroke-width:2px;
    classDef ci fill:#f0b27a,stroke:#d35400,stroke-width:2px;
    classDef config fill:#d0ece7,stroke:#16a085,stroke-width:2px;
    classDef external fill:#fdebd0,stroke:#e59866,stroke-width:2px;

    %% Click Events
    click W1 "https://github.com/bcstudentsoftwaredevteam/celts/blob/development/app.wsgi"
    click W2 "https://github.com/bcstudentsoftwaredevteam/celts/blob/development/run.py"
    click C "https://github.com/bcstudentsoftwaredevteam/celts/tree/development/app/controllers"
    click L "https://github.com/bcstudentsoftwaredevteam/celts/tree/development/app/logic"
    click DM "https://github.com/bcstudentsoftwaredevteam/celts/tree/development/app/models"
    click T "https://github.com/bcstudentsoftwaredevteam/celts/tree/development/app/templates"
    click S "https://github.com/bcstudentsoftwaredevteam/celts/tree/development/app/static"
    click DB "https://github.com/bcstudentsoftwaredevteam/celts/tree/development/database"
    click CM "https://github.com/bcstudentsoftwaredevteam/celts/tree/development/app/config"
    click DVC "https://github.com/bcstudentsoftwaredevteam/celts/blob/development/.devcontainer"
    click TS "https://github.com/bcstudentsoftwaredevteam/celts/tree/development/tests"
    click GA "https://github.com/bcstudentsoftwaredevteam/celts/tree/development/.github/workflows"
```
