# vedantchimote/curiositees architecture

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

- Interactive diagram: https://gitdiagram.com/vedantchimote/curiositees
- Repository: https://github.com/vedantchimote/curiositees

## Overview

##### Project Type and Purpose
- This is a full-stack, multi-module e-commerce application.
- Backend and Admin UI are built with Spring Boot (Java/Maven), using Spring MVC + Thymeleaf for server-side pages and REST endpoints.
- A shared library module (CuriositeesCommon) holds domain entities and exceptions.
- A separate ReactJS folder holds the customer-facing SPA code.
- Persistence is via Spring Data JPA/Hibernate against a MySQL database.
- Static file storage is used for images (user photos, brand logos, category/product images).
- CI/CD pipelines (GitHub Actions) build Docker images and publish to DockerHub; deployment target is Azure.

##### File Structure
- Top-level directories:
- curiositees-backend (multi-module Maven: CuriositeesCommon, CuriositeesWebParent→ CuriositeesBackend & CuriositeesFrontend)
- curiositees-frontend (ReactJS SPA)
- CuriositeesCommon: shared JAR with entity and exception classes.
- CuriositeesWebParent: parent POM for common deps, modules:
- CuriositeesBackend: Spring Boot Admin/UI + REST.
- CuriositeesFrontend: Spring Boot customer UI (Thymeleaf).
- Config & build: Maven wrappers, application.properties, Dockerfiles, docker-compose.yml.
- CI/CD: .github/workflows for backend & frontend Docker build/publish, Maven publish.

##### Main Components
- CuriositeesCommon Module (JAR)
- CuriositeesBackend Service & Admin UI (Spring Boot)
- CuriositeesFrontend Service & Customer UI (Spring Boot)
- ReactJS Frontend (SPA, Node or static hosting)
- MySQL Database
- File Storage (local folders under user-photos, brand-logos, category-images, product-images)
- SMTP Mail Server (for verification emails)
- CI/CD Pipeline (GitHub Actions)
- DockerHub Registry
- Azure Hosting Environment

##### Relationships & Data Flows
- Browser → ReactJS SPA → REST API endpoints exposed by CuriositeesBackend (or CuriositeesFrontend if customer UI is server-side)
- Admin user → Spring MVC controllers in CuriositeesBackend → Service → Repository → MySQL
- Both backend and frontend modules depend on the CuriositeesCommon library for domain models
- File uploads (user photos, logos) handled by controllers → stored in local disk folders → served as static resources
- Service layer → uses Spring Data JPA/Hibernate to read/write MySQL
- Service layer → invokes JavaMailSender (SMTP) for email notifications
- GitHub Actions → build JARs → Docker build → push images to DockerHub → Azure pull→ deploy containers
- Docker-Compose (local dev) wires CuriositeesBackend + MySQL

##### Architectural Patterns & Design Principles
- Layered architecture: Controller → Service → Repository
- Multi-module Maven for separation of concerns (Common, Backend, Frontend)
- MVC pattern for server-side UI (Thymeleaf)
- RESTful API for ReactJS SPA
- Shared library for DRY domain model code
- Containerization (Docker) for environment consistency
- CI/CD automation for build/test/deploy

##### Don’t Overthink – Capture All Components
- Every Maven module, even if it’s a simple shared library.
- Don’t omit file-storage folders – treat them as part of the persistence layer.
- Both local Docker-Compose and cloud deploy paths.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Application Modules
    subgraph "Application Modules"
        CCommon["CuriositeesCommon (JAR)"]:::app
        CBackend["CuriositeesBackend (Spring Boot)"]:::app
        CFrontend["CuriositeesFrontend (Spring Boot)"]:::app
        React["ReactJS SPA"]:::app
    end

    %% Infrastructure
    subgraph "Infrastructure"
        MySQL["MySQL Database"]:::infra
        FileStorage["File Storage"]:::infra
        SMTP["SMTP Mail Server"]:::infra
        Azure["Azure Hosting Environment"]:::infra
    end

    %% File Storage Details
    subgraph "File Storage"
        UP["User Photos"]:::infra
        BL["Brand Logos"]:::infra
        CI["Category Images"]:::infra
        PI["Product Images"]:::infra
    end
    FileStorage --> UP
    FileStorage --> BL
    FileStorage --> CI
    FileStorage --> PI

    %% Mail Configuration
    subgraph "Mail Configuration"
        Props["application.properties"]:::app
        MailPage["mail_server.html"]:::app
        MailTemplates["mail_templates"]:::app
    end
    Props -.-> SMTP
    MailPage -.-> SMTP
    MailTemplates -.-> SMTP

    %% Runtime Flows
    React -->|HTTP/REST| CBackend
    BrowserAdmin(["Admin Browser"]) -->|HTTP| CBackend
    BrowserCustomer(["Customer Browser"]) -->|HTTP| CFrontend
    CBackend -->|JDBC| MySQL
    CFrontend -->|JDBC| MySQL
    CBackend -->|reads/writes files| FileStorage
    CFrontend -->|reads/writes files| FileStorage
    CBackend -->|SMTP| SMTP

    %% Module Dependencies
    CBackend -.-> CCommon
    CFrontend -.-> CCommon

    %% Local Development
    subgraph "Local Dev (Docker-Compose)"
        DCompose["Docker-Compose"]:::pipeline
        DCompose --> CBackend
        DCompose --> MySQL
    end

    %% CI/CD Pipeline
    subgraph "CI/CD Pipeline"
        GHActions["GitHub Actions"]:::pipeline
        DockerHub["DockerHub Registry"]:::pipeline
        BWF["Backend Docker CI/CD"]:::pipeline
        FWF["Frontend Docker CI/CD"]:::pipeline
        MP["Maven Publish"]:::pipeline
    end
    BWF --> GHActions
    FWF --> GHActions
    MP --> GHActions
    GHActions -->|push images| DockerHub
    DockerHub -->|pull & deploy| Azure
    GHActions -->|deploy| Azure
    Azure --> React

    %% Click Events
    click CCommon "https://github.com/vedantchimote/curiositees/tree/main/curiositees-backend/curiositees/CuriositeesCommon"
    click CBackend "https://github.com/vedantchimote/curiositees/tree/main/curiositees-backend/curiositees/CuriositeesWebParent/CuriositeesBackend"
    click CFrontend "https://github.com/vedantchimote/curiositees/tree/main/curiositees-backend/curiositees/CuriositeesWebParent/CuriositeesFrontend"
    click React "https://github.com/vedantchimote/curiositees/blob/main/curiositees-frontend/ReactJS Code Here.txt"
    click DCompose "https://github.com/vedantchimote/curiositees/blob/main/curiositees-backend/curiositees/CuriositeesWebParent/CuriositeesBackend/docker-compose.yml"
    click UP "https://github.com/vedantchimote/curiositees/tree/main/curiositees-backend/curiositees/CuriositeesWebParent/CuriositeesBackend/user-photos"
    click BL "https://github.com/vedantchimote/curiositees/tree/main/curiositees-backend/curiositees/CuriositeesWebParent/brand-logos"
    click CI "https://github.com/vedantchimote/curiositees/tree/main/curiositees-backend/curiositees/CuriositeesWebParent/category-images"
    click PI "https://github.com/vedantchimote/curiositees/tree/main/curiositees-backend/curiositees/CuriositeesWebParent/product-images"
    click Props "https://github.com/vedantchimote/curiositees/blob/main/curiositees-backend/curiositees/CuriositeesWebParent/CuriositeesBackend/src/main/resources/application.properties"
    click MailPage "https://github.com/vedantchimote/curiositees/blob/main/curiositees-backend/curiositees/CuriositeesWebParent/CuriositeesBackend/src/main/resources/templates/settings/mail_server.html"
    click MailTemplates "https://github.com/vedantchimote/curiositees/tree/main/curiositees-backend/curiositees/CuriositeesWebParent/CuriositeesBackend/src/main/resources/templates/settings/mail_templates"
    click BWF "https://github.com/vedantchimote/curiositees/blob/main/.github/workflows/curiositees-backend-docker-cicd.yml"
    click FWF "https://github.com/vedantchimote/curiositees/blob/main/.github/workflows/curiositees-frontend-docker-cicd.yml"
    click MP "https://github.com/vedantchimote/curiositees/blob/main/.github/workflows/maven-publish.yml"

    %% Styles
    classDef app fill:#a3d5ff,stroke:#333,stroke-width:1px
    classDef infra fill:#b2f2b6,stroke:#333,stroke-width:1px
    classDef pipeline fill:#ffd699,stroke:#333,stroke-width:1px
```
