# avipaut/kursach-master architecture

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

- Interactive diagram: https://gitdiagram.com/avipaut/kursach-master
- Repository: https://github.com/avipaut/kursach-master

## Overview

##### Project type and purpose
- This is a monolithic full-stack web application built with the Flask framework in Python.
- Purpose: a project management dashboard with Kanban boards, chat, calendar (with Zoom integrations), document management, KPI construction, reporting, notifications and user management.

##### File structure
- app.py: the Flask application factory / entry point.
- config/: application configuration (e.g., Zoom API credentials).
- instance/: holds the SQLite database (main.db), environment-specific files.
- migrations/: Alembic scripts for database schema evolution.
- routes/: Flask Blueprints, each file implements one area of functionality (auth, kanban, chat, documents, kpi, reports, etc).
- templates/: Jinja2 HTML templates, organized by feature.
- static/: CSS, JavaScript, images, audio, and file uploads.
- exports/: pre-generated export files (PDF, JSON) to illustrate reporting output.
- uploaded_documents/: local storage for user-uploaded files, with .trash subfolders.
- requirements.txt: Python dependencies (Flask, SQLAlchemy, Alembic, Zoom SDK, etc).
- .github/workflows/python-publish.yml: CI/CD for packaging or publishing.

##### Insights from README
- Minimal description (“our first full project”) implies that all features are in one deployable Flask app.
- No extra microservices—everything runs as one codebase, communicates with one database, and stores files locally.

a. Main components
- Client (Web browser/mobile)
- Web Server / Load Balancer (e.g., Nginx or Gunicorn in front of Flask)
- Flask Application
– Blueprints for auth, kanban, chat, calendar, documents, KPI, reports, notifications
– SQLAlchemy ORM layer
– Zoom integration module (config_zoom.py, zoom_service route)
– Alembic migrations
- Relational Database (SQLite in this setup; could be PostgreSQL in production)
- File Storage (local filesystem under uploaded_documents/)
- Static Asset Server (serves CSS/JS/images/audio under static/)
- External Service: Zoom API
b. Relationships and data flows
1. User’s browser → HTTP(S) → Web Server
2. Web Server forwards requests to Flask app
3. Flask app routes to appropriate Blueprint
4. Blueprint handlers:
– Query/update database via SQLAlchemy
– Read/write files in uploaded_documents/
– Call Zoom REST API for meeting/calendar actions
– Trigger export routines (PDF, JSON) writing to exports/
5. Database responds with data; Flask renders templates or returns JSON
6. Browser receives HTML/JS/CSS and opens real-time connections for chat (e.g., long polling or websockets)
7. Notifications subsystem pushes events to browser (via server-sent events or polling)
c. Architectural patterns and principles
- Monolithic MVC-like structure:
- Models (routes/models.py, SQLAlchemy classes)
- Views (templates/)
- Controllers (routes/*.py blueprints)
- Blueprint modularization: each area of functionality isolated into its own module
- Configuration-per-environment using config/ and instance/
- Database versioning with Alembic (migrations/versions)
- Separation of static assets and dynamic routes
d. Key technologies
- Python 3 + Flask
- SQLAlchemy ORM + SQLite (for local) / PostgreSQL (for production)
- Alembic for migrations
- Jinja2 templating
- Zoom SDK / REST API integration
- Frontend: Vanilla JS + CSS modules under static/js and static/css
- PDF generation libraries (implied by exports/pdf_…)

##### Capturing essential details
- Alembic migration tool’s interaction with the database as a side-flow (development/deployment only).
- Configuration lookup: config/config_zoom.py + instance/ folder for secrets.
- “Exports” component for reporting outputs.
- File upload/download paths from browser to uploaded_documents/ directory.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Client Side
    subgraph "Client Side"
        direction TB
        Browser["User Browser"]:::external
        Browser -->|"HTTP(S) Request"| WebServer
        Browser -->|"WebSocket/Long Polling"| ChatModule
        Browser -->|"WebSocket/Server-Sent Events"| NotificationsModule
    end

    %% Server Side
    subgraph "Server Side"
        direction TB
        WebServer["Nginx/Gunicorn"]:::internal
        WebServer -->|"forwards requests"| AppEntry

        %% Flask Application Entry
        AppEntry["Flask App (app.py)"]:::internal
        click AppEntry "https://github.com/avipaut/kursach-master/blob/master/app.py"

        %% Configuration & Instance
        ConfigDir["Config Directory"]:::storage
        click ConfigDir "https://github.com/avipaut/kursach-master/tree/master/config/"
        ConfigZoom["Zoom Config"]:::storage
        click ConfigZoom "https://github.com/avipaut/kursach-master/blob/master/config/config_zoom.py"
        InstanceDir["Instance Directory"]:::storage
        click InstanceDir "https://github.com/avipaut/kursach-master/tree/master/instance/"
        DBFile["SQLite Database (main.db)"]:::storage
        click DBFile "https://github.com/avipaut/kursach-master/blob/master/instance/main.db"

        AppEntry --> ConfigDir
        AppEntry --> InstanceDir

        %% Migrations
        Migrations["Alembic Migrations"]:::storage
        click Migrations "https://github.com/avipaut/kursach-master/tree/master/migrations/"
        MigrationsVersions["Migration Versions"]:::storage
        click MigrationsVersions "https://github.com/avipaut/kursach-master/tree/master/migrations/versions/"
        Migrations --> MigrationsVersions
        AppEntry --> Migrations

        %% ORM Models
        Models["ORM Models Layer"]:::internal
        click Models "https://github.com/avipaut/kursach-master/blob/master/routes/models.py"
        AppEntry --> Models

        %% Blueprints
        subgraph "Flask Blueprints" 
            direction TB
            AuthModule["Auth Blueprint"]:::internal
            click AuthModule "https://github.com/avipaut/kursach-master/blob/master/routes/auth.py"
            KanbanModule["Kanban Blueprint"]:::internal
            click KanbanModule "https://github.com/avipaut/kursach-master/blob/master/routes/kanban.py"
            ChatModule["Chat Blueprint"]:::internal
            click ChatModule "https://github.com/avipaut/kursach-master/blob/master/routes/chat.py"
            CalendarModule["Calendar Blueprint"]:::internal
            click CalendarModule "https://github.com/avipaut/kursach-master/blob/master/routes/calendar.py"
            ZoomService["Zoom Integration Service"]:::internal
            click ZoomService "https://github.com/avipaut/kursach-master/blob/master/routes/zoom_service.py"
            DocumentsModule["Documents Blueprint"]:::internal
            click DocumentsModule "https://github.com/avipaut/kursach-master/blob/master/routes/documents.py"
            TrashModule["Trash Module"]:::internal
            click TrashModule "https://github.com/avipaut/kursach-master/blob/master/routes/trash.py"
            KPIModule["KPI Blueprint"]:::internal
            click KPIModule "https://github.com/avipaut/kursach-master/blob/master/routes/kpi.py"
            ReportsModule["Reporting Blueprint"]:::internal
            click ReportsModule "https://github.com/avipaut/kursach-master/blob/master/routes/reports.py"
            NotificationsModule["Notifications Blueprint"]:::internal
            click NotificationsModule "https://github.com/avipaut/kursach-master/blob/master/routes/notifications.py"
            CardAssignModule["Card Assignment Module"]:::internal
            click CardAssignModule "https://github.com/avipaut/kursach-master/blob/master/routes/card_assignment.py"
            DashboardModule["Dashboard Module"]:::internal
            click DashboardModule "https://github.com/avipaut/kursach-master/blob/master/routes/dashboard.py"
            AdminPanelModule["Admin Panel Module"]:::internal
            click AdminPanelModule "https://github.com/avipaut/kursach-master/blob/master/routes/admin_panel.py"
            ProfileModule["Profile Module"]:::internal
            click ProfileModule "https://github.com/avipaut/kursach-master/blob/master/routes/profile.py"
            ConfigBlueprint["Config Blueprint"]:::internal
            click ConfigBlueprint "https://github.com/avipaut/kursach-master/blob/master/routes/config.py"
        end

        %% Exports and Static
        ExportsDir["Exports Directory"]:::storage
        click ExportsDir "https://github.com/avipaut/kursach-master/tree/master/exports/"
        StaticAssets["Static Assets Server"]:::static
        click StaticAssets "https://github.com/avipaut/kursach-master/tree/master/static/css/, static/js/, static/img/, static/sounds/, static/uploads/"

        FileStorage["Uploaded Documents Storage"]:::storage
        click FileStorage "https://github.com/avipaut/kursach-master/tree/master/uploaded_documents/"

        Requirements["Dependencies (requirements.txt)"]:::storage
        click Requirements "https://github.com/avipaut/kursach-master/blob/master/requirements.txt"
        CICD["CI/CD Workflow"]:::storage
        click CICD "https://github.com/avipaut/kursach-master/blob/master/.github/workflows/python-publish.yml"

        %% Connections within server
        AppEntry --> AuthModule
        AppEntry --> KanbanModule
        AppEntry --> ChatModule
        AppEntry --> CalendarModule
        AppEntry --> ZoomService
        AppEntry --> DocumentsModule
        AppEntry --> TrashModule
        AppEntry --> KPIModule
        AppEntry --> ReportsModule
        AppEntry --> NotificationsModule
        AppEntry --> CardAssignModule
        AppEntry --> DashboardModule
        AppEntry --> AdminPanelModule
        AppEntry --> ProfileModule
        AppEntry --> ConfigBlueprint

        %% Blueprint interactions
        AuthModule --> Models
        KanbanModule --> Models
        ChatModule --> Models
        CalendarModule --> Models
        ZoomService -->|"REST API"| ZoomAPI
        DocumentsModule --> Models
        TrashModule --> DocumentsModule
        KPIModule --> Models
        ReportsModule --> Models
        ReportsModule --> ExportsDir
        NotificationsModule --> Models
        CardAssignModule --> Models
        DashboardModule --> Models
        AdminPanelModule --> Models
        ProfileModule --> Models
        ConfigBlueprint --> ConfigDir

        %% Storage interactions
        AuthModule --> DBFile
        KanbanModule --> DBFile
        ChatModule --> DBFile
        CalendarModule --> DBFile
        DocumentsModule --> FileStorage
        TrashModule --> FileStorage
        KPIModule --> DBFile
        ReportsModule --> DBFile
        NotificationsModule --> DBFile
        CardAssignModule --> DBFile
        DashboardModule --> DBFile
        AdminPanelModule --> DBFile
        ProfileModule --> DBFile
        Models --> DBFile

        %% Static and exports
        Browser -->|"fetches assets"| StaticAssets
        AppEntry --> StaticAssets

    end

    %% External Services
    ZoomAPI["Zoom REST API"]:::external

    %% Class Definitions
    classDef internal fill:#cde5ff,stroke:#0366d6,color:#0366d6;
    classDef storage fill:#d4f4dd,stroke:#22863a,color:#22863a;
    classDef external fill:#ffe9c6,stroke:#d73a49,color:#d73a49;
    classDef static fill:#e1e4e8,stroke:#6a737d,color:#6a737d;
```
