# softwaremill/bootzooka architecture

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

- Interactive diagram: https://gitdiagram.com/softwaremill/bootzooka
- Repository: https://github.com/softwaremill/bootzooka

## Overview

##### Main Components
- Backend Service: Represent the core Scala application (located in the “backend” directory) with its REST API endpoints, business logic, and supporting functionalities (such as user management, security, password-reset, email notifications, logging, and metrics).
- Frontend Web Application: Represent the “ui” directory as the modern web client built using TypeScript, React and Vite. This component provides the user interface, routing, and handles API calls to the backend.
- Database: Include PostgreSQL (as mentioned in both the README and Docker compose file) as the persistent data store.
- External Services: Capture external dependencies such as email providers (SMTP, Mailgun options in the backend’s email sender package), and any third-party observability/monitoring tools (Graphana and OpenTelemetry as per the README).
- Deployment & Orchestration: Include components for containerization (docker-compose) and deployment automation using Helm charts (directory “helm/bootzooka”).

##### Relationships and Interactions
- The Backend also interacts with external email services for sending notifications and may interact with metrics/observability tools for logging and monitoring.
- Additionally, indicate how deployment tools (Docker, Helm) package and deploy the application components, possibly in a container orchestration environment.

##### Architectural Patterns and Technologies
- MVC / Layered Architecture: The backend is organized into clear packages (configuration, security, admin, user, email, etc.), indicating separation of concerns.
- API-Driven Design: Emphasize the REST API layer provided by the backend.
- Microservices-readiness: Although it is a single application now, the modular structure (e.g., separate email, security, and user modules) could allow for scalable refactoring later.
- Testing and CI/CD: Represent test suites (backend/src/test and integration-tests) and integration pipelines (GitHub workflows) to indicate continuous integration.

## Diagram (Mermaid)

```mermaid
flowchart TD
  %% Frontend Layer
  subgraph "Presentation Layer"
    FE["Frontend Web Application (TypeScript/React/Vite)"]:::frontend
  end
  
  %% Backend Layer
  subgraph "Application Layer"
    BE["Backend Service (Scala REST API)"]:::backend
    ES["Email Service"]:::backend
    OM["Observability & Metrics"]:::backend
  end
  
  %% Data Layer
  subgraph "Data Layer"
    DB["PostgreSQL Database"]:::database
    DM["Database Migrations"]:::database
  end
  
  %% Deployment & Testing Layer
  subgraph "Deployment & Testing"
    DC["Docker Compose"]:::deployment
    IDC["Integration Docker Compose"]:::deployment
    HC["Helm Charts"]:::deployment
    BT["Backend Tests"]:::testing
    FT["Frontend Tests"]:::testing
    CICD["CI/CD Pipelines"]:::deployment
  end

  %% Connections between layers
  FE -->|"calls_API"| BE
  BE -->|"queries_DB"| DB
  DM -->|"applies_schema"| DB
  BE -->|"sends_email"| ES
  BE -->|"monitors"| OM
  
  %% Deployment and CI/CD interactions
  CICD -->|"runs"| BT
  CICD -->|"runs"| FT
  CICD -->|"deploys_via"| HC
  DC -->|"containers"| BE
  DC -->|"containers"| FE
  IDC -->|"test_env"| BE

  %% Styles
  classDef frontend fill:#DDEBF7,stroke:#6C8EBF,stroke-width:2px;
  classDef backend fill:#FCE4D6,stroke:#D97904,stroke-width:2px;
  classDef database fill:#E2EFDA,stroke:#5ABA4A,stroke-width:2px;
  classDef deployment fill:#FFF2CC,stroke:#D6B656,stroke-width:2px;
  classDef testing fill:#F8CBAD,stroke:#D9534F,stroke-width:2px;

  %% Click Events
  click BE "https://github.com/softwaremill/bootzooka/tree/master/backend/src/main/scala/com/softwaremill/bootzooka"
  click FE "https://github.com/softwaremill/bootzooka/tree/master/ui"
  click DM "https://github.com/softwaremill/bootzooka/tree/master/backend/src/main/resources/db/migration"
  click ES "https://github.com/softwaremill/bootzooka/tree/master/backend/src/main/scala/com/softwaremill/bootzooka/email"
  click OM "https://github.com/softwaremill/bootzooka/tree/master/backend/src/main/scala/com/softwaremill/bootzooka/metrics"
  click DC "https://github.com/softwaremill/bootzooka/blob/master/docker-compose.yml"
  click IDC "https://github.com/softwaremill/bootzooka/blob/master/integration-tests/docker-compose.yml"
  click HC "https://github.com/softwaremill/bootzooka/tree/master/helm/bootzooka"
  click BT "https://github.com/softwaremill/bootzooka/tree/master/backend/src/test"
  click FT "https://github.com/softwaremill/bootzooka/tree/master/ui/src/tests"
  click CICD "https://github.com/softwaremill/bootzooka/tree/master/.github/workflows"
```
