# rivj11/app-miscelanea architecture

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

- Interactive diagram: https://gitdiagram.com/rivj11/app-miscelanea
- Repository: https://github.com/rivj11/app-miscelanea

## Overview

##### Project Type and Purpose
- This is a desktop “full‑stack” inventory management application written in Python.
- Purpose: allow users to log in, manage products, record sales, generate PDF invoices, and view reports, all backed by a local SQLite database and a Tkinter GUI.

##### File Structure
- Top‑level files:
– LICENSE, README.md – documentation.
– main.py – application entry point.
– requirements.txt – Python dependencies.
- database/ – database initialization and data‑access layer:
– setup_db.py – creates tables in SQLite.
– __init_db.py – helper for DB connection.
– operations.py – CRUD operations for products, sales, users.
- gui/ – user interface layer built with Tkinter:
– splash_screen.py – initial loading screen.
– login_window.py – authentication.
– main_window.py – primary UI for inventory, sales, reporting.

##### README for Additional Insights
- Tech stack: Python 3.11, Tkinter, SQLite, Pillow, ReportLab, fpdf2, pandas, openpyxl.
- Key features call out authentication, PDF invoice generation, admin panel, reports.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User interaction
    User["User"]:::ext -->|"Click/Login/Manage"| Splash

    subgraph "GUI Layer"
        direction TB
        Splash["SplashScreen"]:::gui
        Login["LoginWindow"]:::gui
        MainWin["MainWindow"]:::gui
    end

    %% Controller
    Controller["main.py (Controller)"]:::ctrl

    %% Data Layer
    subgraph "Data Access Layer"
        direction TB
        Ops["operations.py"]:::db
        InitDB["__init_db.py"]:::db
        SetupDB["setup_db.py"]:::db
    end

    %% Database
    DB[(SQLite Database File)]:::db

    %% External Modules
    subgraph "External Modules"
        direction TB
        PDFMod["PDF Generation Module"]:::ext
        PandasMod["pandas/openpyxl Module"]:::ext
    end

    %% Assets and Docs
    Assets["assets/"]:::ext
    Docs["README.md & LICENSE"]:::docs
    Req["requirements.txt"]:::docs

    %% Flows
    Splash -->|"LaunchLogin"| Login
    Login -->|"OnSuccess"| MainWin
    MainWin -->|"UI Events"| Controller
    Splash -->|"Load Assets"| Assets
    MainWin -->|"Load Icons"| Assets

    Controller -->|"QueryProducts / RecordSale"| Ops
    Controller -->|"InitConnection"| InitDB
    Controller -->|"EnsureSchema"| SetupDB
    Ops -->|"Execute SQL"| DB
    InitDB -->|"Connect"| DB
    SetupDB -->|"CreateTables"| DB

    Controller -->|"GenerateInvoicePDF"| PDFMod
    PDFMod -.->|"Write PDF File"| Disk[(Disk)]:::ext

    Controller -->|"ExportData"| PandasMod
    PandasMod -.->|"Write Excel/CSV"| Disk

    %% Documentation and Dependencies
    Docs
    Req

    %% Click Events
    click Splash "https://github.com/rivj11/app-miscelanea/blob/main/gui/splash_screen.py"
    click Login "https://github.com/rivj11/app-miscelanea/blob/main/gui/login_window.py"
    click MainWin "https://github.com/rivj11/app-miscelanea/blob/main/gui/main_window.py"
    click Controller "https://github.com/rivj11/app-miscelanea/blob/main/main.py"
    click Ops "https://github.com/rivj11/app-miscelanea/blob/main/database/operations.py"
    click InitDB "https://github.com/rivj11/app-miscelanea/blob/main/database/__init_db.py"
    click SetupDB "https://github.com/rivj11/app-miscelanea/blob/main/database/setup_db.py"
    click Assets "https://github.com/rivj11/app-miscelanea/tree/main/assets/"
    click Req "https://github.com/rivj11/app-miscelanea/blob/main/requirements.txt"
    click Docs "https://github.com/rivj11/app-miscelanea/blob/main/README.md"

    %% Styles
    classDef gui fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef db fill:#90EE90,stroke:#000,stroke-width:1px
    classDef ext fill:#FFA500,stroke:#000,stroke-width:1px
    classDef ctrl fill:#9370DB,stroke:#000,stroke-width:1px
    classDef docs fill:#D3D3D3,stroke:#000,stroke-width:1px
```
