# uob-team-project/team00 architecture

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

- Interactive diagram: https://gitdiagram.com/uob-team-project/team00
- Repository: https://github.com/uob-team-project/team00

## Overview

##### Main Components
- Frontend Component:
- Located under the src/main/webapp folder.
- Built with Angular (note the Angular CLI configuration files, webpack configurations, and numerous Angular components in folders like /app/home, /app/account, /app/admin, etc.).
- Handles user interface, routing, and client-side validations.
- Backend Component:
- Located under src/main/java.
- Built with Spring Boot—includes REST controllers (in src/main/java/bham/team/web/rest), services, repositories, domain models, configuration classes, and security.
- Uses JWT for stateless authentication and has configuration for caching, database integration (using Liquibase for migrations), and a security layer.
- Database and Persistence:
- Configured for both in-memory H2 (for development) and PostgreSQL (for production).
- Liquibase changelogs are located in src/main/resources/config/liquibase.
- External Services and Infrastructure:
- Docker configurations (in src/main/docker) for multiple services such as PostgreSQL, Prometheus, Grafana, and others. These files outline the container orchestration for a production or test scenario.
- CI/CD pipelines for GitHub and GitLab are defined (.github/workflows/main.yml and .gitlab-ci.yml).
- The project uses Maven for backend build and npm (with wrapper scripts) for frontend development.
- Development Environment Tools:
- Dev container configuration and support files (in .devcontainer).
- Additional tools for code style, testing (Jest for Angular, JUnit for Java), linting (eslint, prettier, checkstyle), and version control hooks (husky).

##### Relationships and Interactions Between Components
- The backend’s controllers delegate requests to service layers, which in turn interact with repository layers and finally persist or access data in the database.
- External integrations such as Grafana and Prometheus (visible in the docker folder) monitor the application’s health and performance.
- Authentication is implemented via JWT; hence, the security configuration and filters should be represented as a middleware component between client requests and backend processing.
- Build and deployment pipelines (Maven, npm, Docker, CI/CD pipelines) tie into the development lifecycle, so include these as supporting infrastructure.

##### Architectural Patterns and Design Principles
- Layered (n-tier) Architecture: Clearly separated layers for presentation (Angular UI), business (Spring services), persistence (repositories + Liquibase configurations), and integration.
- Separation of Concerns: Different directories and configuration files demonstrate well-modularized components.
- Containerization and DevOps Focus: Presence of Docker (for local, production, and monitoring) and CI/CD configuration files shows a design mindful of modern deployment practices.

##### Relevant Technologies and Frameworks
- Backend: Java 21 (Spring Boot), Maven, Spring Security (with JWT), Liquibase, and JHipster’s code generation conventions.
- Frontend: Angular (with Angular CLI and Webpack), TypeScript, and testing with Jest.
- Containerization: Docker Compose configurations that include services like PostgreSQL, Prometheus, Grafana.
- CI/CD: GitHub Actions and GitLab CI.
- Additional tools: ESLint, Prettier, Husky, and various configuration files for IDE/editor settings.

##### Instructing the Principal Software Engineer
- Labeled components for “Angular Frontend”, “Spring Boot Backend”, “Database (PostgreSQL/H2)”, “Monitoring Services (Prometheus, Grafana)”, “CI/CD (GitHub/GitLab Pipelines)”, and “Containerization (Docker Configurations)”.
- Annotations on security, showing that JWT is used for authentication, and include middleware components (Spring Security Filters).
- Be detailed:
- Don’t shy away from breaking down the backend into its layers (Controllers, Services, Repositories) and showing the Angular routes along with key components like account management, admin features, and the GDPR policy.
- To include the Docker infrastructure and build tools as these are central to the application’s deployment and development workflow.
- Since you’re addressing a principal software engineer, it is beneficial to have both high-level components (the overall client-server separation) as well as detailed sub-components (layered backend architecture, Angular module structure, and CI/CD pipelines).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Component
    A["Angular Frontend"]:::frontend
    click A "https://github.com/uob-team-project/team00/tree/main/src/main/webapp"

    %% Backend Components Subgraph
    subgraph "Spring Boot Backend"
        B1["REST Controllers"]:::backend
        click B1 "https://github.com/uob-team-project/team00/tree/main/src/main/java/bham/team/web/rest"
        B4b["Security (JWT)"]:::backend
        click B4b "https://github.com/uob-team-project/team00/tree/main/src/main/java/bham/team/security"
        B2["Business Logic (Services)"]:::backend
        click B2 "https://github.com/uob-team-project/team00/tree/main/src/main/java/bham/team/service"
        B3a["Repositories"]:::backend
        click B3a "https://github.com/uob-team-project/team00/tree/main/src/main/java/bham/team/repository"
        B3b["Domain"]:::backend
        click B3b "https://github.com/uob-team-project/team00/tree/main/src/main/java/bham/team/domain"
        B4a["Configuration"]:::backend
        click B4a "https://github.com/uob-team-project/team00/tree/main/src/main/java/bham/team/config"
    end

    %% Database and Liquibase
    D["Database (PostgreSQL/H2)"]:::database
    L["Liquibase Migrations"]:::database
    click L "https://github.com/uob-team-project/team00/tree/main/src/main/resources/config/liquibase"

    %% External Infrastructure and DevOps
    Doc["Docker Configurations"]:::external
    click Doc "https://github.com/uob-team-project/team00/tree/main/src/main/docker"
    C1["GitHub Actions"]:::external
    click C1 "https://github.com/uob-team-project/team00/blob/main/.github/workflows/main.yml"
    C2["GitLab CI"]:::external
    click C2 "https://github.com/uob-team-project/team00/blob/main/.gitlab-ci.yml"
    DV["Dev Container"]:::external
    click DV "https://github.com/uob-team-project/team00/blob/main/.devcontainer"

    %% Connections between Frontend and Backend
    A -->|"RESTCalls"| B1

    %% Backend internal flow
    B1 -->|"Delegates"| B2
    B1 -->|"SecuredBy"| B4b
    B2 -->|"DataOps"| B3a
    B2 -->|"DataModels"| B3b

    %% Persistence Flow
    B3a -->|"Persistence"| D
    B3b -->|"Persistence"| D
    L -->|"Migrates"| D

    %% External monitoring and deployment arrows
    B2 -->|"MonitoredBy"| Doc
    Doc -->|"Containers"| B1

    %% CI/CD Deployment flows
    C1 -->|"Deploys_to"| A
    C1 -->|"Deploys_to"| B1
    C2 -->|"Deploys_to"| A
    C2 -->|"Deploys_to"| B1

    %% Development Environment support
    DV -->|"Supports"| A
    DV -->|"Supports"| B1

    %% Styling
    classDef frontend fill:#bbdefb,stroke:#0d47a1,color:#0d47a1;
    classDef backend fill:#c8e6c9,stroke:#1b5e20,color:#1b5e20;
    classDef database fill:#fff9c4,stroke:#fbc02d,color:#f57f17;
    classDef external fill:#ffe0b2,stroke:#e65100,color:#bf360c;
```
