# ijameela/sda-bootcamp-project architecture

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

- Interactive diagram: https://gitdiagram.com/ijameela/sda-bootcamp-project
- Repository: https://github.com/ijameela/sda-bootcamp-project

## Overview

##### Project Type and Purpose
- This is a Python-based chatbot application. The focus is on a backend (backend.py) and chatbot functionality (chatbot.py), with logging (chroma.log) and persistence provided via a SQLite database (chroma.sqlite3).
- The README specifies that this project is now at the stage of deploying the application on an Azure Virtual Machine. It involves manual setup of infrastructure components (e.g., network security group, virtual network, public IP address, subnet, disk, network interface) and setting up systemd service files for the database, frontend, and backend.

##### File Structure
- Top-Level Files: The main executable scripts (backend.py, chatbot.py), a requirements file (requirements.txt) for dependency management, and configuration files like .gitignore.
- Database Artifacts: A SQLite database file (chroma.sqlite3) reflecting the project's state persistence, and an associated log file (chroma.log) for tracking events.

a. Infrastructure Components on Azure:
- Azure Virtual Machine (Ubuntu 24.04 LTS) as the host.
- Network Components: Azure Virtual Network, Subnet, Public IP address, Network Interface, and a Network Security Group that controls inbound/outbound rules.
b. Application Components:
- Backend Service: Represented by backend.py. This component handles core business logic and likely acts as an API layer.
- Chatbot Engine: Represented by chatbot.py; it may interact with the backend to engage with user inputs.
- Database Service: Represented by chroma.sqlite3 (with chroma.log for logging) which stores persistent data. Even though it’s a file-based SQLite DB, it’s important to denote it as the persistence layer.
- Frontend (if applicable): Though not visible in the file tree, the README instructs deploying and running frontend services. It should be included as a distinct component that interacts with users either through a web portal or another UI.
c. Deployment and Service Management:

##### Relationships and Interactions
- User requests coming into the frontend (if applicable) and forwarded to the backend.
- The backend interacting with the chatbot component or vice versa.
- Both services interfacing with the SQLite database for reading/writing persistence data.
- How the VM’s network security group and associated network components safeguard access to these services.
- That these applications and services operate on one VM, but conceptually separate them to highlight modularity.

##### Architectural Patterns and Design Principles
- Though this is a small, mono-repository project, the division into core components (chatbot, backend, database, and implicit frontend) follows a modular separation.
- The manual configuration of Azure infrastructure stresses explicit separation and clear boundaries for security and manageability.
- That the system is built to facilitate both local debugging (as evident from a simple file structure) and production-like deployment on a VM.

##### Technologies and Frameworks
- Python as the main programming language.
- SQLite for the database.
- Systemd for service management.
- Azure’s virtual networking components and VM infrastructure.
- Any packages specified in requirements.txt (not listed here but ensure to reference them if they reveal additional libraries or frameworks).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Infrastructure Layer"
        INTERNET["Public Internet"]:::infra
        PUBLIC_IP["Azure Public IP"]:::infra
        NSG["Network Security Group"]:::infra
        VM["Azure VM (Ubuntu 24.04 LTS)"]:::infra
    end

    subgraph "Service Layer"
        FRONT["Frontend Service"]:::service
        BACK["Backend Service (backend.py)"]:::service
        CHAT["Chatbot Engine (chatbot.py)"]:::service
        DEPM["Dependency Management (requirements.txt)"]:::code
    end

    subgraph "Data Layer"
        DB["SQLite Database (chroma.sqlite3)"]:::data
        LOG["Chroma Log (chroma.log)"]:::data
    end

    INTERNET -->|"routes-to"| PUBLIC_IP
    PUBLIC_IP -->|"secured-by"| NSG
    NSG -->|"hosts"| VM

    VM --> FRONT
    VM --> BACK
    VM --> CHAT

    FRONT -->|"forwards-to"| BACK
    BACK -->|"calls"| CHAT

    BACK -->|"reads/writes"| DB
    CHAT -->|"reads/writes"| DB

    DB -->|"logs-to"| LOG

    DEPM -.-> BACK
    DEPM -.-> CHAT

    click BACK "https://github.com/ijameela/sda-bootcamp-project/blob/main/backend.py"
    click CHAT "https://github.com/ijameela/sda-bootcamp-project/blob/main/chatbot.py"
    click DB "https://github.com/ijameela/sda-bootcamp-project/blob/main/chroma.sqlite3"
    click LOG "https://github.com/ijameela/sda-bootcamp-project/blob/main/chroma.log"
    click DEPM "https://github.com/ijameela/sda-bootcamp-project/blob/main/requirements.txt"

    classDef infra fill:#AED6F1,stroke:#2471A3,stroke-width:2px;
    classDef service fill:#A9DFBF,stroke:#1D8348,stroke-width:2px;
    classDef data fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef code fill:#FAD7A0,stroke:#E67E22,stroke-width:2px;
```
