# zephyrintel/sparesapp architecture

> Architecture diagram of the GitHub repository zephyrintel/sparesapp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zephyrintel/sparesapp
- Repository: https://github.com/zephyrintel/sparesapp

## Overview

##### Main Components

A. Client Layer:
- Web Browser Interface
- Bootstrap-based UI components
- Kit selector interface
- Component display views

B. Application Layer:
- Django Web Server
- URL Router/Controller
- Template Engine
- Kit Management Module
- Component Management Module

C. Data Layer:
- Azure SQL Database
- Model Relationships
- Data Access Layer

##### Connection and Flow Indicators

- HTTP/HTTPS requests from client to server
- Template rendering flow
- Database queries and responses
- Component relationships

##### Specific Implementation Details

- Web Browser -> Django URLs -> Views -> Models -> Azure SQL
- Templates <- Views
- Custom Template Tags -> Templates

B. Show the database schema relationships:
- Kits <-> KitParts <-> Level1Components <-> Level2Components

##### Additional Elements

Containers for:
- Authentication (planned feature)
- Azure Static Web Apps deployment
- GitHub Actions workflow

##### Technical Details

- Django version
- Bootstrap integration
- Azure SQL connection
- ODBC Driver specifications
- Template inheritance structure

Key Considerations:

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        Browser["Web Browser"]
        KitSelector["Kit Selector View"]:::ui
        CompDisplay["Component Display View"]:::ui
        KitComp["Kit Comparison View"]:::planned
        InvOpt["Inventory Optimization View"]:::planned
    end

    subgraph Django
        WebServer["Django Web Server"]:::server
        Router["URL Router"]:::core
        Views["Views Layer"]:::core
        Templates["Template Engine"]:::core
        CustomTags["Custom Template Tags"]:::core
        
        subgraph Modules
            KitMgmt["Kit Management Module"]:::module
            CompMgmt["Component Management Module"]:::module
        end
    end

    subgraph Database
        AzureSQL[(Azure SQL Database)]:::db
        KitsTable[("Kits Table")]:::table
        Level1[("Level1Components Table")]:::table
        Level2[("Level2Components Table")]:::table
        KitParts[("KitParts Table")]:::table
    end

    %% Relationships
    Browser --> Router
    Router --> Views
    Views --> Templates
    CustomTags --> Templates
    Templates --> Browser
    
    KitSelector --> Router
    CompDisplay --> Router
    
    Views --> KitMgmt
    Views --> CompMgmt
    
    KitMgmt --> AzureSQL
    CompMgmt --> AzureSQL
    
    KitsTable <--> KitParts
    KitParts <--> Level1
    Level1 <--> Level2

    %% Click Events
    click WebServer "https://github.com/zephyrintel/SparesApp/blob/main/SparesWebApp/settings.py"
    click Router "https://github.com/zephyrintel/SparesApp/blob/main/SparesWebApp/urls.py"
    click KitMgmt "https://github.com/zephyrintel/SparesApp/tree/main/kits/"
    click Views "https://github.com/zephyrintel/SparesApp/blob/main/kits/views.py"
    click CustomTags "https://github.com/zephyrintel/SparesApp/blob/main/kits/templatetags/custom_tags.py"
    click KitSelector "https://github.com/zephyrintel/SparesApp/blob/main/kits/templates/kits/kit_selector.html"

    %% Styles
    classDef ui fill:#2196F3,stroke:#1565C0,color:white
    classDef server fill:#4CAF50,stroke:#2E7D32,color:white
    classDef core fill:#81C784,stroke:#4CAF50,color:white
    classDef module fill:#A5D6A7,stroke:#81C784,color:black
    classDef db fill:#FF9800,stroke:#F57C00,color:white
    classDef table fill:#FFB74D,stroke:#FF9800,color:black
    classDef planned fill:#9E9E9E,stroke:#616161,color:white,stroke-dasharray: 5 5

    %% Legend
    subgraph Legend
        UI["UI Component"]:::ui
        Server["Server Component"]:::server
        Core["Core Component"]:::core
        Mod["Module"]:::module
        DB["Database"]:::db
        Table["Database Table"]:::table
        Plan["Planned Feature"]:::planned
    end
```
