# dvelopp/springangularapp architecture

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

- Interactive diagram: https://gitdiagram.com/dvelopp/springangularapp
- Repository: https://github.com/dvelopp/springangularapp

## Overview

##### Main Components
- Client Layer (Frontend):
- Web Browser running the Angular Single Page Application (SPA)
- Static resources (HTML pages, CSS files, AngularJS controllers, directives, etc. located in src/main/webapp/resources)
- Third-party libraries (Angular, Bootstrap, jQuery and others managed via Bower)

- Web/API Layer (Backend Controllers):
- RESTful web services implemented in various packages (e.g., springAngularApp/system/ws, home/ws, users/ws, and navigation/ws)
- Controllers that handle login, configuration, home, and user management requests
- Integration of Spring Security (configured under system/configuration, especially in WebSecurityConfig.java) that secures access to resources and validates user rights

- Service/Business Layer:
- Service classes for business logic (found in packages such as system/service and users/service)
- User management functions such as creating, editing, deleting users and user groups
- Domain-specific validations (both in Spring (server-side validators) and Angular directives)

- Persistence/Domain/Data Access Layer:
- Domain model and entity classes (in packages like system/domain/entities, users/domain/entities)
- Repositories that abstract database operations (e.g., UserRepository, UserGroupRepository, etc.)
- Hibernate and JPA for ORM mapping, configured via SpringJpaConfig.java and application.properties
- Liquibase change logs (located under the changelogs directory) to manage database schema changes

- Configuration & Infrastructure:
- Application configuration files (e.g., src/main/resources/application.properties, Spring configuration under src/main/java/springAngularApp/configuration, and test configurations in src/test)
- Gradle build scripts (build.gradle, settings.gradle, and gradle/liquibase.gradle) which drive the build, dependency resolutions, and tests
- Docker integration (Dockerfile and docker-compose.yml) indicating containerized deployment aspects
- Static internationalization resources (message bundles in src/main/resources/messages and users-specific message properties)

##### Relationships and Interactions
- The User’s browser loads the Angular SPA from the static resources.
- Angular communicates via HTTP (AJAX) with the RESTful endpoints provided by Spring MVC controllers.
- The controllers handle incoming requests, applying Spring Security checks, and then delegate to the service layer.
- The Service layer performs business logic and interacts with the persistence layer (repositories) to query or update the database.
- Hibernate (using ORM) maps domain objects to database tables based on the configuration.
- In the deployment environment, Docker (with Dockerfile and docker-compose) encapsulates the application in containers, and Gradle handles builds/tests.

- “Frontend – AngularJS SPA” representing the client.
- “REST API Layer – Spring MVC Controllers” linking UI to backend business logic.
- “Service Layer – Business Logic (User Management, Security, etc.)”
- “Persistence Layer – Hibernate/JPA & Database” for data operations.
- “Infrastructure/Deployment” to note Docker, Gradle build process, and configuration management.
- Data flow from Client → REST API (HTTP/JSON)
- REST API → Services (invoking business logic)
- Services → Repositories (database operations)
d. Special flows such as:
- Authentication & Authorization between the client and API using Spring Security.
- Validation paths (server-side and Angular directives)
- Internationalization flows (loading message bundles)
- Infrastructure elements (configuration files, Docker components)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer"
        A["Frontend - AngularJS SPA"]:::frontend
    end

    %% REST API Layer
    subgraph "Web/API Layer (Controllers)"
        B["System Web Services"]:::api
        C["Home Web Services"]:::api
        D["Navigation Web Services"]:::api
        E["Users Web Services"]:::api
        F["Spring Security Config"]:::security
    end

    %% Service Layer
    subgraph "Service/Business Layer"
        G["System Services"]:::service
        H["Users Services"]:::service
    end

    %% Persistence / Domain Layer
    subgraph "Persistence/Domain Layer"
        I["System Domain Entities"]:::persistence
        J["Users Domain Entities"]:::persistence
        K["Users Repositories"]:::persistence
        L["JPA/Hibernate Config"]:::persistence
    end

    %% Configuration & Infrastructure
    subgraph "Configuration & Infrastructure"
        M["Application Properties"]:::config
        N["Build & Deployment Config"]:::config
    end

    %% Data Flow Connections from Client to APIs
    A -->|"HTTP/JSON"| B
    A -->|"HTTP/JSON"| C
    A -->|"HTTP/JSON"| D
    A -->|"HTTP/JSON"| E

    %% API Controllers delegate to Services
    B -->|"delegates"| G
    C -->|"delegates"| G
    D -->|"delegates"| G
    E -->|"delegates"| H

    %% Security Integration
    F -.->|"secures"| B
    F -.->|"secures"| C
    F -.->|"secures"| D
    F -.->|"secures"| E

    %% Service Layer calls Persistence Layer
    G -->|"calls"| I
    G -->|"calls"| J
    H -->|"calls"| K

    %% Persistence Mapping via JPA/Hibernate Config
    I -->|"mappedBy"| L
    J -->|"mappedBy"| L
    K -->|"mappedBy"| L

    %% Configuration flows into the system modules
    M -->|"configures"| B
    M -->|"configures"| G
    M -->|"configures"| I
    N -->|"buildsAndDeploys"| A

    %% Click Events
    click A "https://github.com/dvelopp/springangularapp/tree/master/src/main/webapp/resources"
    click B "https://github.com/dvelopp/springangularapp/tree/master/src/main/java/springAngularApp/system/ws"
    click C "https://github.com/dvelopp/springangularapp/tree/master/src/main/java/springAngularApp/home/ws"
    click D "https://github.com/dvelopp/springangularapp/tree/master/src/main/java/springAngularApp/navigation/ws"
    click E "https://github.com/dvelopp/springangularapp/tree/master/src/main/java/springAngularApp/users/ws"
    click G "https://github.com/dvelopp/springangularapp/tree/master/src/main/java/springAngularApp/system/service"
    click H "https://github.com/dvelopp/springangularapp/tree/master/src/main/java/springAngularApp/users/service"
    click I "https://github.com/dvelopp/springangularapp/tree/master/src/main/java/springAngularApp/system/domain/entities"
    click J "https://github.com/dvelopp/springangularapp/tree/master/src/main/java/springAngularApp/users/domain/entities"
    click K "https://github.com/dvelopp/springangularapp/tree/master/src/main/java/springAngularApp/users/domain/repositories"
    click F "https://github.com/dvelopp/springangularapp/blob/master/src/main/java/springAngularApp/system/configuration/WebSecurityConfig.java"
    click L "https://github.com/dvelopp/springangularapp/blob/master/src/main/java/springAngularApp/system/configuration/SpringJpaConfig.java"
    click M "https://github.com/dvelopp/springangularapp/blob/master/src/main/resources/application.properties"
    click N "https://github.com/dvelopp/springangularapp/blob/master/build.gradle, settings.gradle, gradle/liquibase.gradle, Dockerfile, docker-compose.yml"

    %% Styles
    classDef frontend fill:#A2D9CE,stroke:#1ABC9C,stroke-width:2px;
    classDef api fill:#F9E79F,stroke:#F1C40F,stroke-width:2px;
    classDef service fill:#D2B4DE,stroke:#8E44AD,stroke-width:2px;
    classDef persistence fill:#AED6F1,stroke:#3498DB,stroke-width:2px;
    classDef config fill:#FAD7A0,stroke:#E67E22,stroke-width:2px;
    classDef security fill:#F5B7B1,stroke:#E74C3C,stroke-width:2px;
```
