# kolithabandara/sample-ecommerce-site architecture

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

- Interactive diagram: https://gitdiagram.com/kolithabandara/sample-ecommerce-site
- Repository: https://github.com/kolithabandara/sample-ecommerce-site

## Overview

##### And outline the key components
- External Clients: Represent front-end applications or external systems consuming the REST API.
- API Gateway / Entry Point: Although not explicitly separated, note that the Spring Boot application (GodzillaEcomSiteApplication) is the entry point for incoming HTTP requests.
- Business Services: Represent the service layer (CategoryService and its implementation, CategoryServiceImpl) for business logic.
- Domain Models: Show domain classes (like Category) that represent the data structures.
- Security: Add an element or overlay that illustrates the use of Spring Security 6 and JWT for authenticating and authorizing requests.

##### Relationships and Data Flow
- For security, illustrate a flow where incoming requests first pass through a security filter (JWT verification via Spring Security) before hitting the controllers.

##### Architectural Patterns and Design Principles
- A layered architecture (Presentation → Business → Data Access → Database).
- That the project uses RESTful APIs to decouple the client and server.
- How Spring Boot’s convention-over-configuration simplifies integration (including dependency management via Maven).
- If desired, note any cross-cutting concerns such as security, exception handling, and logging that are integrated into the system.

##### Specify Relevant Technologies and Frameworks
- Spring Boot for application bootstrapping.
- Spring Data JPA for persistence.
- Spring Security 6 and JWT for authentication/authorization.
- Maven as the build and dependency management tool.
- AWS for deployment and production hosting.

## Diagram (Mermaid)

```mermaid
flowchart TD
    ExternalClient("External Client"):::client

    subgraph "Security & Entry"
        Security("JWT Security Filter"):::security
        EntryPoint("API Entry Point (GodzillaEcomSiteApplication)"):::entry
    end

    subgraph "Presentation Layer"
        Controller("API Controller (CategoryController)"):::controller
    end

    subgraph "Business Layer"
        ServiceInterface("Service Interface (CategoryService)"):::service
        ServiceImpl("Service Implementation (CategoryServiceImpl)"):::service
    end

    subgraph "Data Access Layer"
        Repository("Repository (CategoryRepository)"):::repository
        Domain("Domain Model (Category)"):::domain
        Database("Database"):::database
    end

    AWS("AWS Deployment"):::aws

    ExternalClient -->|"HTTP_Request"| Security
    Security -->|"Verified"| EntryPoint
    EntryPoint -->|"Routes_Request"| Controller
    Controller -->|"Invokes"| ServiceInterface
    ServiceInterface -->|"Delegates_to"| ServiceImpl
    ServiceImpl -->|"Calls"| Repository
    Repository -->|"Interacts_with"| Database
    Repository -->|"Maps_to"| Domain
    EntryPoint -->|"Deployed_on"| AWS
    Database -->|"Hosted_on"| AWS

    click EntryPoint "https://github.com/kolithabandara/sample-ecommerce-site/blob/main/godzilla-ecom-site/src/main/java/edu/godzilla/godzilla_ecom_site/GodzillaEcomSiteApplication.java"
    click Controller "https://github.com/kolithabandara/sample-ecommerce-site/blob/main/godzilla-ecom-site/src/main/java/edu/godzilla/godzilla_ecom_site/controller/CategoryController.java"
    click ServiceInterface "https://github.com/kolithabandara/sample-ecommerce-site/blob/main/godzilla-ecom-site/src/main/java/edu/godzilla/godzilla_ecom_site/service/CategoryService.java"
    click ServiceImpl "https://github.com/kolithabandara/sample-ecommerce-site/blob/main/godzilla-ecom-site/src/main/java/edu/godzilla/godzilla_ecom_site/service/CategoryServiceImpl.java"
    click Repository "https://github.com/kolithabandara/sample-ecommerce-site/blob/main/godzilla-ecom-site/src/main/java/edu/godzilla/godzilla_ecom_site/repositories/CategoryRepository.java"
    click Domain "https://github.com/kolithabandara/sample-ecommerce-site/blob/main/godzilla-ecom-site/src/main/java/edu/godzilla/godzilla_ecom_site/model/Category.java"
    click Database "https://github.com/kolithabandara/sample-ecommerce-site/blob/main/godzilla-ecom-site/src/main/resources/application.properties"

    classDef client fill:#ffcc00,stroke:#333,stroke-width:2px;
    classDef security fill:#ff6666,stroke:#333,stroke-width:2px;
    classDef entry fill:#66ccff,stroke:#333,stroke-width:2px;
    classDef controller fill:#ccffcc,stroke:#333,stroke-width:2px;
    classDef service fill:#ffff99,stroke:#333,stroke-width:2px;
    classDef repository fill:#99ccff,stroke:#333,stroke-width:2px;
    classDef domain fill:#ffcc99,stroke:#333,stroke-width:2px;
    classDef database fill:#dddddd,stroke:#333,stroke-width:2px;
    classDef aws fill:#ccffcc,stroke:#333,stroke-width:2px;
```
