# rh0is/genio-tech architecture

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

- Interactive diagram: https://gitdiagram.com/rh0is/genio-tech
- Repository: https://github.com/rh0is/genio-tech

## Overview

##### Project Type and Purpose
- The README clearly states “GENIO-TECH – E-Learning Website,” confirming that we’re dealing with a full-stack web application.
- The file structure confirms it is a Django project, with key components like a main project directory (GENIO), a dedicated app (genioapp), and support for static content (CSS, JS, images) and templates.
- The use of pip install django_countries implies that form handling and localized country inputs or validations are integrated into the site.

##### File Structure for Architectural Clues
- Top-Level Directories:
- GENIO: Contains configuration files (settings.py, urls.py, asgi.py, wsgi.py) which set up the project’s middleware, routing, and server interface.
- genioapp: The core Django app — holding models, views, forms, migrations, admin configurations, and even a context processor. This implies adherence to Django’s MTV (Model-Template-View) pattern.
- static and templates directories: These store client-side assets like CSS, JavaScript, and HTML, which will form the presentation layer.
- .github/workflows: Indicates CI/CD pipelines for Django and main GENIO projects.
- Specialized Content:
- The presence of video scripts (e.g., AgoraRTC_N-4.11.0.js, room.js) and payment scripts (e.g., sq-apple-pay.js, sq-card-pay.js) under the static/js folder shows integration of real-time communication and payment processing.
- The directory structure under templates shows multiple pages for courses, payment, class rooms, login, and profiles.
- A database file (db.sqlite3) suggests SQLite is being used for development.

##### Main Components and Their Relationships

a. Client-Side (Frontend):
- Users interact through a browser that renders HTML templates from the templates directory.
- CSS files and JavaScript (including specialized scripts for video conferencing and payments) enhance the interactive user experience.
- The client initiates HTTP requests (GET/POST) to the Django views.

b. Django Web Application (Backend):
- GENIO: Main project configuration, URL routing, and setting up ASGI/WSGI for handling requests.
- genioapp: Contains the core business logic — models, views, form handling, and context processors.
- The backend utilizes Django’s MTV pattern to process requests, perform validations (like using django_countries for country validations), and send responses.
- Custom filters (in templatetags) and various migration scripts show a well-organized data model and ongoing database evolution.

c. Database:
- SQLite is used as the development database (db.sqlite3); in production, this may be switched to a more scalable option.
- Models in genioapp/models.py are persisted and managed through Django’s ORM, with migrations indicating versioned schema changes.

d. External Services:
- Real-time communication is handled via Agora SDK (as seen with the AgoraRTC and Agora RTM files).
- Payment processing functionality is integrated through JavaScript modules (e.g., sq-apple-pay.js, sq-card-pay.js) suggesting a third-party payment platform is involved.
- The CI/CD pipeline using GitHub workflows ensures continuous integration and deployment.

##### Architectural Patterns and Design Principles
- Django’s MTV pattern is central – Models for data, Templates for the view, and Views for business logic.
- Separation of concerns is clear, with templates, static files, and back-end logic separated into distinct directories.
- Use of configuration files (.github/workflows, settings.py) shows a well-defined deployment and testing strategy.
- External integrations (payment gateway and video conferencing) show modular extension points that are maintained within the static assets and integrated via the Django views.

- Underneath, illustrate the Data Storage (SQLite DB) representing persistence.
- Off to the side or as integrations, add External Services: Payment Gateway and Real-Time Communication (Agora).
- From the Client to the Django Server, showing HTTP requests/responses.
- From the Django Server to the Database, indicating CRUD operations.
- From the Client to External services (or the Django backend mediating these interactions) for payments and video calls.
- Use labels for each component:
- Clearly label “Frontend (Templates, Static Files)” vs. “Backend (Django GENIO & genioapp)” and “Database (SQLite).”
- External integrations such as “Payment Processing (Square Payment scripts)” and “Video/Chat Service (Agora SDK).”

## Diagram (Mermaid)

```mermaid
graph TD
    A["User Browser"]:::client

    subgraph "Frontend Layer"
        T["Templates (HTML Pages)"]:::frontend
        S["Static Assets (CSS,JS,Images)"]:::frontend
    end

    subgraph "Backend Layer"
        DCP["Django Project Config (GENIO)"]:::backend
        CBL["Core Business Logic (genioapp)"]:::backend
    end

    DB["SQLite Database"]:::db
    CICD["CI/CD Pipeline"]:::cicd
    E1["Square Payment Gateway"]:::external
    E2["Agora Video Service"]:::external

    A -->|"HTTP_Request"| DCP
    A -->|"HTTP_Request"| CBL
    CBL -->|"DB_Operations"| DB
    CBL -->|"Render_HTML"| T
    CBL -->|"Serve_Assets"| S
    S -->|"Integrates_Payments"| E1
    S -->|"Integrates_Video"| E2
    CICD -->|"Deploys"| DCP
    CICD -->|"Deploys"| CBL

    click DCP "https://github.com/rh0is/genio-tech/blob/main/GENIO/settings.py"
    click CBL "https://github.com/rh0is/genio-tech/blob/main/genioapp/models.py"
    click T "https://github.com/rh0is/genio-tech/blob/main/templates/genioapp/index.html"
    click S "https://github.com/rh0is/genio-tech/tree/main/genioapp/static/genioapp"
    click E1 "https://github.com/rh0is/genio-tech/blob/main/genioapp/static/genioapp/js/payments/sq-apple-pay.js"
    click E2 "https://github.com/rh0is/genio-tech/blob/main/genioapp/static/genioapp/js/videoApp/AgoraRTC_N-4.11.0.js"
    click DB "https://github.com/rh0is/genio-tech/blob/main/db.sqlite3_courses_levels_and_instructors_added"
    click CICD "https://github.com/rh0is/genio-tech/blob/main/.github/workflows/django.yml"

    classDef client fill:#AED6F1,stroke:#1F618D,stroke-width:2px;
    classDef frontend fill:#ABEBC6,stroke:#27AE60,stroke-width:2px;
    classDef backend fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef db fill:#F5B7B1,stroke:#C0392B,stroke-width:2px;
    classDef cicd fill:#D2B4DE,stroke:#8E44AD,stroke-width:2px;
    classDef external fill:#FAD7A0,stroke:#D35400,stroke-width:2px;
```
