# sakethrdy/pharmacy-inventory-system architecture

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

- Interactive diagram: https://gitdiagram.com/sakethrdy/pharmacy-inventory-system
- Repository: https://github.com/sakethrdy/pharmacy-inventory-system

## Overview

##### Project type and purpose
- From the file tree and README (“Pharmacy-Inventory-System”), this is a monolithic full-stack web application (Spring Boot + Thymeleaf) for managing a pharmacy’s medicine inventory.

##### File structure
- Top-level “database” directory contains a Maven/Spring Boot module (pom.xml, mvnw)
- src/main/java/database:
- PharmacyInventoryApplication.java – the Spring Boot entry point
- PharmacyController.java – web layer (controllers/endpoints)
- Medicine.java – domain/model/entity
- src/main/resources:
- application.properties – data source configuration (likely H2 or external RDBMS)
- static/css/style.css – client assets
- templates/*.html – Thymeleaf views (add, search, update, delete, batch operations, AI suggestions, etc.)
- tests under src/test/java verify basic application startup

##### README for additional insights
- The README only gives the project name, so we infer architecture from conventions: MVC pattern, embedded web server, relational database.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% UI Layer
    subgraph "UI Layer"
        direction TB
        Browser["Web Browser"]:::ui
        subgraph "Thymeleaf Templates"
            direction TB
            Add["add.html"]:::ui
            AISuggest["ai-suggest.html"]:::ui
            Batch["batch.html"]:::ui
            Delete["delete.html"]:::ui
            Expired["expired.html"]:::ui
            Home["home.html"]:::ui
            Search["search.html"]:::ui
            Update["update.html"]:::ui
        end
        StyleCSS["style.css"]:::ui
    end

    %% Backend Layer
    subgraph "Backend Layer"
        direction TB
        App["PharmacyInventoryApplication"]:::backend
        Controller["PharmacyController"]:::backend
        Repository["Service/Repository Layer"]:::backend
        Entity["Medicine (Domain Model)"]:::backend
    end

    %% Database Layer
    subgraph "Database Layer"
        direction TB
        Database["Relational Database (H2/external)"]:::data
    end

    %% Configuration & Build
    subgraph "Config & Build"
        direction TB
        AppProps["application.properties"]:::config
        POM["pom.xml"]:::config
        MVNW["mvnw / mvnw.cmd"]:::config
    end

    %% Testing
    Tests["DatabaseApplicationTests"]:::test

    %% Flows
    Browser -->|"HTTP GET/POST"| Controller
    Controller -->|"uses Entity"| Entity
    Controller -->|"invokes"| Repository
    Repository -->|"JDBC/SQL"| Database
    Database -->|"Result Sets"| Repository
    Repository -->|"returns entities"| Controller
    Controller -->|"renders view"| Add
    Controller -->|"renders view"| AISuggest
    Controller -->|"renders view"| Batch
    Controller -->|"renders view"| Delete
    Controller -->|"renders view"| Expired
    Controller -->|"renders view"| Home
    Controller -->|"renders view"| Search
    Controller -->|"renders view"| Update
    Add -->|"+ CSS"| StyleCSS
    AISuggest -->|"+ CSS"| StyleCSS
    Batch -->|"+ CSS"| StyleCSS
    Delete -->|"+ CSS"| StyleCSS
    Expired -->|"+ CSS"| StyleCSS
    Home -->|"+ CSS"| StyleCSS
    Search -->|"+ CSS"| StyleCSS
    Update -->|"+ CSS"| StyleCSS
    Controller -->|"launched by"| App
    AppProps -->|"configures"| App
    POM -->|"build config"| App
    MVNW -->|"build scripts"| App
    Tests -->|"validates startup"| App

    %% Click Events
    click App "https://github.com/sakethrdy/pharmacy-inventory-system/blob/main/database/database/src/main/java/database/PharmacyInventoryApplication.java"
    click Controller "https://github.com/sakethrdy/pharmacy-inventory-system/blob/main/database/database/src/main/java/database/PharmacyController.java"
    click Entity "https://github.com/sakethrdy/pharmacy-inventory-system/blob/main/database/database/src/main/java/database/Medicine.java"
    click Add "https://github.com/sakethrdy/pharmacy-inventory-system/blob/main/database/database/src/main/resources/templates/add.html"
    click AISuggest "https://github.com/sakethrdy/pharmacy-inventory-system/blob/main/database/database/src/main/resources/templates/ai-suggest.html"
    click Batch "https://github.com/sakethrdy/pharmacy-inventory-system/blob/main/database/database/src/main/resources/templates/batch.html"
    click Delete "https://github.com/sakethrdy/pharmacy-inventory-system/blob/main/database/database/src/main/resources/templates/delete.html"
    click Expired "https://github.com/sakethrdy/pharmacy-inventory-system/blob/main/database/database/src/main/resources/templates/expired.html"
    click Home "https://github.com/sakethrdy/pharmacy-inventory-system/blob/main/database/database/src/main/resources/templates/home.html"
    click Search "https://github.com/sakethrdy/pharmacy-inventory-system/blob/main/database/database/src/main/resources/templates/search.html"
    click Update "https://github.com/sakethrdy/pharmacy-inventory-system/blob/main/database/database/src/main/resources/templates/update.html"
    click StyleCSS "https://github.com/sakethrdy/pharmacy-inventory-system/blob/main/database/database/src/main/resources/static/css/style.css"
    click AppProps "https://github.com/sakethrdy/pharmacy-inventory-system/blob/main/database/database/src/main/resources/application.properties"
    click POM "https://github.com/sakethrdy/pharmacy-inventory-system/blob/main/database/database/pom.xml"
    click MVNW "https://github.com/sakethrdy/pharmacy-inventory-system/tree/main/database/database/mvnw"
    click Tests "https://github.com/sakethrdy/pharmacy-inventory-system/blob/main/database/database/src/test/java/database/DatabaseApplicationTests.java"

    %% Styles
    classDef ui fill:#DAE8FC,stroke:#6C8EBF
    classDef backend fill:#D5E8D4,stroke:#82B366
    classDef data fill:#FFE6CC,stroke:#D79B00
    classDef config fill:#E1E1E1,stroke:#999999
    classDef test fill:#F8CECC,stroke:#B85450
```
