# javierrodriguezregueiro/traza-backend architecture

> Architecture diagram of the GitHub repository javierrodriguezregueiro/traza-backend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/javierrodriguezregueiro/traza-backend
- Repository: https://github.com/javierrodriguezregueiro/traza-backend

## Overview

TRAZA BACKEND is a single Kotlin/Gradle backend service, most likely built on Spring Boot, with a small but clear layered structure. The repository is currently more of a service skeleton than a full feature tree: the only visible business package is `domain`, and the only adapter code shown is REST-side error handling.

The application entry point is `dev.traza.TrazaApplication`. That is the main bootstrap for the runtime and the top of the dependency graph for the service.

The codebase is organized around a boundary between domain and delivery concerns. `src/main/kotlin/dev/traza/domain` holds core business concepts, and `src/main/kotlin/dev/traza/adapter/in/rest` holds HTTP-facing code. This suggests an adapter-style or hexagonal layering, where the domain is meant to stay independent of transport details.

The visible domain model is intentionally small: `DomainError` lives under `domain/error`. This indicates that business failures are represented explicitly in the domain layer rather than being mapped directly from HTTP or framework exceptions.

The REST adapter currently focuses on error translation. `DomainErrorExtensions.kt` and `GlobalExceptionHandler.kt` indicate that domain exceptions or error values are converted into HTTP responses in one centralized place, so controllers or endpoints can stay thin and avoid repeating error-mapping logic.

There is no visible persistence package in the tree, but `src/main/resources/db/migration` shows Flyway-style database migration support. That means schema changes are managed as part of application startup/deployment, with the database treated as an external resource initialized through versioned migrations.

Configuration is environment-based. `application.yml` provides the default runtime configuration, while `application-dev.yml` and `application-test.yml` separate local development and test settings. This points to a standard Spring profile-driven setup.

Operationally, the project includes container support via `Dockerfile` and `docker-compose.yml`, so the service is intended to run in an isolated container environment and likely depends on at least one external backing service during development.

Testing is present but minimal: `TrazaApplicationTest.kt` suggests a basic application context or startup test, and the test-specific config in `src/test/resources/application-test.yml` supports isolated test execution.

Build and quality tooling are part of the architecture too. The repo uses Gradle Kotlin DSL (`build.gradle.kts`, `settings.gradle.kts`) plus a version catalog, and it enforces static analysis with Detekt (`detekt.yml`). CI is wired through GitHub Actions (`.github/workflows/ci.yml`), so build, test, and lint checks are expected to run automatically.

Logging is configured separately in `logback-spring.xml`, which means application logs are treated as a first-class operational concern rather than relying on defaults.

For an architecture diagram, the main flows to show are: external client request enters the REST adapter, domain-level errors are normalized through the global exception handler into HTTP responses, and application startup is surrounded by configuration, logging, and Flyway database migration initialization. The rest of the business pipeline is not visible in this repository snapshot, so the diagram should stop at the currently implemented boundaries rather than inventing missing service or persistence layers.

Main entry points: [`src/main/kotlin/dev/traza/TrazaApplication.kt`](https://github.com/javierrodriguezregueiro/traza-backend/blob/main/src/main/kotlin/dev/traza/TrazaApplication.kt) (Traza App), [`src/main/kotlin/dev/traza/adapter/in/rest`](https://github.com/javierrodriguezregueiro/traza-backend/tree/main/src/main/kotlin/dev/traza/adapter/in/rest) (REST Adapter), [`src/main/kotlin/dev/traza/adapter/in/rest/GlobalExceptionHandler.kt`](https://github.com/javierrodriguezregueiro/traza-backend/blob/main/src/main/kotlin/dev/traza/adapter/in/rest/GlobalExceptionHandler.kt) (Exception Handler), [`.github/workflows/ci.yml`](https://github.com/javierrodriguezregueiro/traza-backend/blob/main/.github/workflows/ci.yml) (CI Workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_app(("Traza App<br/>Spring boot entrypoint"))
  node_domain{{"Domain<br/>business core"}}
  node_domain_error["Domain Error<br/>[DomainError.kt]"]
  node_rest_adapter["REST Adapter<br/>http adapter"]
  node_error_ext["Error Mapping<br/>rest mapping"]
  node_exception_handler["Exception Handler<br/>rest handler"]
  node_config_default["App Config<br/>runtime config<br/>[application.yml]"]
  node_config_dev["Dev Config<br/>profile config"]
  node_config_test["Test Config<br/>profile config"]
  node_db_migrations[("Migrations")]
  node_logging["Logback<br/>logging config<br/>[logback-spring.xml]"]
  node_test_app(("App Test<br/>startup test"))
end

subgraph group_ops["Ops"]
  node_gradle_build["Gradle Build<br/>build system<br/>[build.gradle.kts]"]
  node_versions["Versions<br/>catalog<br/>[libs.versions.toml]"]
  node_detekt["Detekt<br/>static analysis<br/>[detekt.yml]"]
  node_ci["CI Workflow<br/>github actions<br/>[ci.yml]"]
  node_dockerfile["Dockerfile<br/>container image"]
  node_compose["Compose<br/>local stack<br/>[docker-compose.yml]"]
end

node_app -->|"loads"| node_config_default
node_app -.->|"profiles"| node_config_dev
node_app -->|"uses"| node_logging
node_app -->|"applies"| node_db_migrations
node_app -->|"hosts"| node_rest_adapter
node_rest_adapter -->|"calls"| node_domain
node_domain -->|"defines"| node_domain_error
node_exception_handler -->|"handles"| node_domain_error
node_exception_handler -->|"uses"| node_error_ext
node_rest_adapter -->|"delegates"| node_exception_handler
node_test_app -->|"verifies"| node_app
node_gradle_build -->|"imports"| node_versions
node_ci -->|"runs"| node_gradle_build
node_ci -->|"checks"| node_detekt
node_dockerfile -->|"packages"| node_app
node_compose -->|"orchestrates"| node_dockerfile

click node_app "https://github.com/javierrodriguezregueiro/traza-backend/blob/main/src/main/kotlin/dev/traza/TrazaApplication.kt"
click node_domain "https://github.com/javierrodriguezregueiro/traza-backend/tree/main/src/main/kotlin/dev/traza/domain"
click node_domain_error "https://github.com/javierrodriguezregueiro/traza-backend/blob/main/src/main/kotlin/dev/traza/domain/error/DomainError.kt"
click node_rest_adapter "https://github.com/javierrodriguezregueiro/traza-backend/tree/main/src/main/kotlin/dev/traza/adapter/in/rest"
click node_error_ext "https://github.com/javierrodriguezregueiro/traza-backend/blob/main/src/main/kotlin/dev/traza/adapter/in/rest/DomainErrorExtensions.kt"
click node_exception_handler "https://github.com/javierrodriguezregueiro/traza-backend/blob/main/src/main/kotlin/dev/traza/adapter/in/rest/GlobalExceptionHandler.kt"
click node_config_default "https://github.com/javierrodriguezregueiro/traza-backend/blob/main/src/main/resources/application.yml"
click node_config_dev "https://github.com/javierrodriguezregueiro/traza-backend/blob/main/src/main/resources/application-dev.yml"
click node_config_test "https://github.com/javierrodriguezregueiro/traza-backend/blob/main/src/test/resources/application-test.yml"
click node_db_migrations "https://github.com/javierrodriguezregueiro/traza-backend/tree/main/src/main/resources/db/migration"
click node_logging "https://github.com/javierrodriguezregueiro/traza-backend/blob/main/src/main/resources/logback-spring.xml"
click node_test_app "https://github.com/javierrodriguezregueiro/traza-backend/blob/main/src/test/kotlin/dev/traza/TrazaApplicationTest.kt"
click node_gradle_build "https://github.com/javierrodriguezregueiro/traza-backend/blob/main/build.gradle.kts"
click node_versions "https://github.com/javierrodriguezregueiro/traza-backend/blob/main/gradle/libs.versions.toml"
click node_detekt "https://github.com/javierrodriguezregueiro/traza-backend/blob/main/detekt.yml"
click node_ci "https://github.com/javierrodriguezregueiro/traza-backend/blob/main/.github/workflows/ci.yml"
click node_dockerfile "https://github.com/javierrodriguezregueiro/traza-backend/tree/main/Dockerfile"
click node_compose "https://github.com/javierrodriguezregueiro/traza-backend/blob/main/docker-compose.yml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_domain,node_domain_error,node_rest_adapter,node_error_ext,node_exception_handler,node_config_default,node_config_dev,node_config_test,node_db_migrations,node_logging,node_test_app toneBlue
class node_gradle_build,node_versions,node_detekt,node_ci,node_dockerfile,node_compose toneAmber
```

## Components

### Runtime

Application code and execution paths

- [Traza App](https://github.com/javierrodriguezregueiro/traza-backend/blob/main/src/main/kotlin/dev/traza/TrazaApplication.kt): Spring boot entrypoint · Main application bootstrap for the backend service · `src/main/kotlin/dev/traza/TrazaApplication.kt`
- [Domain](https://github.com/javierrodriguezregueiro/traza-backend/tree/main/src/main/kotlin/dev/traza/domain): business core · Core business boundary for the service · `src/main/kotlin/dev/traza/domain`
- [Domain Error](https://github.com/javierrodriguezregueiro/traza-backend/blob/main/src/main/kotlin/dev/traza/domain/error/DomainError.kt): domain error · Explicit business failure model · `src/main/kotlin/dev/traza/domain/error/DomainError.kt`
- [REST Adapter](https://github.com/javierrodriguezregueiro/traza-backend/tree/main/src/main/kotlin/dev/traza/adapter/in/rest): http adapter · HTTP-facing delivery boundary · `src/main/kotlin/dev/traza/adapter/in/rest`
- [Error Mapping](https://github.com/javierrodriguezregueiro/traza-backend/blob/main/src/main/kotlin/dev/traza/adapter/in/rest/DomainErrorExtensions.kt): rest mapping · Maps domain errors to HTTP-facing forms · `src/main/kotlin/dev/traza/adapter/in/rest/DomainErrorExtensions.kt`
- [Exception Handler](https://github.com/javierrodriguezregueiro/traza-backend/blob/main/src/main/kotlin/dev/traza/adapter/in/rest/GlobalExceptionHandler.kt): rest handler · Centralized translation of exceptions into responses · `src/main/kotlin/dev/traza/adapter/in/rest/GlobalExceptionHandler.kt`
- [App Config](https://github.com/javierrodriguezregueiro/traza-backend/blob/main/src/main/resources/application.yml): runtime config · Default application configuration · `src/main/resources/application.yml`
- [Dev Config](https://github.com/javierrodriguezregueiro/traza-backend/blob/main/src/main/resources/application-dev.yml): profile config · Development profile overrides · `src/main/resources/application-dev.yml`
- [Test Config](https://github.com/javierrodriguezregueiro/traza-backend/blob/main/src/test/resources/application-test.yml): profile config · Test profile overrides · `src/test/resources/application-test.yml`
- [Migrations](https://github.com/javierrodriguezregueiro/traza-backend/tree/main/src/main/resources/db/migration): flyway migrations · Versioned database schema initialization · `src/main/resources/db/migration`
- [Logback](https://github.com/javierrodriguezregueiro/traza-backend/blob/main/src/main/resources/logback-spring.xml): logging config · Application logging configuration · `src/main/resources/logback-spring.xml`
- [App Test](https://github.com/javierrodriguezregueiro/traza-backend/blob/main/src/test/kotlin/dev/traza/TrazaApplicationTest.kt): startup test · Basic application context or startup validation · `src/test/kotlin/dev/traza/TrazaApplicationTest.kt`

### Ops

Build, container, CI, and runtime support

- [Gradle Build](https://github.com/javierrodriguezregueiro/traza-backend/blob/main/build.gradle.kts): build system · Kotlin DSL build and dependency setup · `build.gradle.kts`
- [Versions](https://github.com/javierrodriguezregueiro/traza-backend/blob/main/gradle/libs.versions.toml): catalog · Central dependency version catalog · `gradle/libs.versions.toml`
- [Detekt](https://github.com/javierrodriguezregueiro/traza-backend/blob/main/detekt.yml): static analysis · Code quality and lint rules · `detekt.yml`
- [CI Workflow](https://github.com/javierrodriguezregueiro/traza-backend/blob/main/.github/workflows/ci.yml): github actions · Automated build, test, and lint pipeline · `.github/workflows/ci.yml`
- [Dockerfile](https://github.com/javierrodriguezregueiro/traza-backend/tree/main/Dockerfile): container image · Container image definition for the service · `Dockerfile`
- [Compose](https://github.com/javierrodriguezregueiro/traza-backend/blob/main/docker-compose.yml): local stack · Local multi-container development setup · `docker-compose.yml`

## Connections

- Traza App → App Config: loads · Bootstraps with default runtime configuration
- Traza App → Dev Config: profiles · Can be overridden by development profile settings
- Traza App → Logback: uses · Initializes structured application logging
- Traza App → Migrations: applies · Runs schema migrations during startup
- Traza App → REST Adapter: hosts · Starts the HTTP delivery layer
- REST Adapter → Domain: calls · Delivers requests into business logic
- Domain → Domain Error: defines · Encapsulates business failure types
- Exception Handler → Domain Error: handles · Translates domain failures into responses
- Exception Handler → Error Mapping: uses · Shares error-to-response mapping helpers
- REST Adapter → Exception Handler: delegates · Centralizes REST error handling
- App Test → Traza App: verifies · Validates application startup behavior
- Gradle Build → Versions: imports · Resolves dependency versions from the catalog
- CI Workflow → Gradle Build: runs · Executes build and verification tasks
- CI Workflow → Detekt: checks · Enforces static analysis in automation
- Dockerfile → Traza App: packages · Builds a container image for the service
- Compose → Dockerfile: orchestrates · Runs the service in a local container stack
