# hofnarrxx/auto-log architecture

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

- Interactive diagram: https://gitdiagram.com/hofnarrxx/auto-log
- Repository: https://github.com/hofnarrxx/auto-log

## Overview

1. This repository is a full-stack application split into two major deployable parts: a Spring Boot backend under `backend/` and an Angular frontend under `frontend/`. The backend exposes the API and handles persistence, security, and file-access orchestration; the frontend is the browser UI.

2. The backend is organized as a conventional layered Java application: `controller` for HTTP endpoints, `service` for business logic, `repository` for database access, and `model` for persisted domain objects. DTOs live in a separate `dto` package, so API payloads are not the same as persistence entities.

3. Authentication and authorization are a central backend subsystem. `AuthController`, `AuthService`, `JwtService`, `JwtAuthenticationFilter`, `SecurityConfig`, `CustomUserDetailsService`, and `CustomOAuth2UserService` together support email/password auth, JWT-based API access, OAuth2 login, and refresh-token handling. `RefreshToken` and `RefreshTokenRepository` show that long-lived session renewal is part of the architecture.

4. The core domain is vehicle log management. The main entities are `User`, `Vehicle`, `Fuel`, `Maintenance`, `MaintenanceAttachment`, `ShareLink`, and related enums/value types like `Currency`, `MaintenanceCategory`, and auth-provider types. Controllers and services are grouped around these business areas: vehicles, fuel entries, maintenance records, and sharing/public access.

5. Persistence is handled through repository interfaces such as `VehicleRepository`, `FuelRepository`, `MaintenanceRepository`, `MaintenanceAttachmentRepository`, `ShareLinkRepository`, `UserRepository`, and `AuthProviderRepository`. This indicates a database-backed system with service-to-repository boundaries rather than direct controller-to-database access.

6. File storage is a separate boundary from the database. `R2Config`, `R2Properties`, `VehicleImageService`, and `MaintenanceAttachmentService` indicate integration with S3-compatible object storage via R2-style configuration. The API exposes upload/download URL DTOs for vehicle images and maintenance attachments, so the backend likely generates signed URLs and the browser talks to object storage directly for file transfer.

7. Public sharing is modeled as its own subsystem. `ShareLinkController`, `ShareLinkService`, `PublicVehicleAccessController`, and `PublicVehicleAccessService` support shareable, read-only vehicle views without requiring a normal authenticated user session. This is a distinct access path from the owner-focused dashboard APIs.

8. The backend’s HTTP surface is split by concern: `VehicleController`, `FuelController`, `MaintenanceController`, `MetadataController`, `AuthController`, `ShareLinkController`, and `PublicVehicleAccessController`. This suggests a REST API with separate endpoints for CRUD, lookup/metadata, public access, and auth flows.

9. Error handling is centralized. Custom exceptions such as `VehicleNotFoundException`, `FuelNotFoundException`, `MaintenanceNotFoundException`, `ShareLinkNotFoundException`, `EmailAlreadyExistsException`, and validation exceptions are mapped through `GlobalExceptionHandler`, giving the frontend consistent failure responses.

10. The frontend is an Angular single-page app structured around feature areas. `app.routes.ts`, `auth-guard.ts`, and `auth-interceptor.ts` define route protection and API request wiring, while `app-layout` provides the authenticated shell. This separates global app behavior from feature-specific screens.

11. Frontend features mirror the backend domain: authentication (`login`, `register`), a main `dashboard`, vehicle management (`vehicle-form`, `vehicle-dashboard` with details/fuel/maintenance tabs), `settings`, and shared-public vehicle views under `features/share`. The presence of `vehicle-store.ts` suggests local state management for vehicle workflows.

12. API access from the browser is mediated through a small auth layer in `frontend/src/app/core/auth`, which likely attaches JWTs to requests and blocks unauthenticated routes. `auth-api.ts` is the explicit frontend boundary to backend auth endpoints.

13. The frontend also contains a `currency.service.ts`, which reflects backend currency handling as part of the vehicle-cost workflows. Static translations under `public/i18n/en.json` and `pl.json` indicate localized UI text, which matters for the diagram only as a presentation concern.

14. Tooling and runtime boundaries are straightforward: Maven/Spring Boot on the backend, Angular on the frontend, with tests present in both trees. `application.yml` is the backend configuration entry point, while Angular’s `package.json`/`angular.json` define the client build and runtime setup.

15. For an architecture diagram, the main flows are: browser → Angular routes/components → auth interceptor/guards → Spring Boot REST controllers → services → repositories/database; and browser → signed upload/download URLs → object storage for vehicle images and maintenance attachments. Public share links form a second, unauthenticated read-only path into the backend.

Main entry points: [`frontend/src/app/app.routes.ts`](https://github.com/hofnarrxx/auto-log/blob/main/frontend/src/app/app.routes.ts) (Routes), [`backend/src/main/java/com/hofnarrxx/autolog/dto`](https://github.com/hofnarrxx/auto-log/tree/main/backend/src/main/java/com/hofnarrxx/autolog/dto) (DTOs), [`frontend/src/app/core/auth`](https://github.com/hofnarrxx/auto-log/tree/main/frontend/src/app/core/auth) (Auth layer), [`frontend/src/app/features/vehicle`](https://github.com/hofnarrxx/auto-log/tree/main/frontend/src/app/features/vehicle) (Vehicle UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_backend["Backend"]
  node_backend_app(("Autolog app<br/>spring boot entry"))
  node_backend_api["HTTP API<br/>rest controllers"]
  node_backend_auth{{"Auth stack<br/>security"}}
  node_backend_vehicle["Vehicle domain<br/>service layer"]
  node_backend_fuel["Fuel domain<br/>service layer"]
  node_backend_maintenance["Maintenance domain<br/>service layer"]
  node_backend_share["Sharing<br/>public access"]
  node_backend_persistence[("Repositories<br/>data access")]
  node_backend_models["Domain model<br/>entities enums"]
  node_backend_dto["DTOs<br/>api contracts"]
  node_backend_storage[("Object storage<br/>r2 integration")]
  node_backend_errors{{"Error handling<br/>exception mapping"}}
end

subgraph group_frontend["Frontend"]
  node_frontend_app(("Angular app<br/>spa entry<br/>[app.ts]"))
  node_frontend_routes["Routes<br/>routing<br/>[app.routes.ts]"]
  node_frontend_auth{{"Auth layer<br/>guards interceptor"}}
  node_frontend_shell["App shell<br/>layout"]
  node_frontend_auth_features["Auth screens<br/>feature area"]
  node_frontend_vehicle["Vehicle UI<br/>feature area"]
  node_frontend_dashboard["Dashboard<br/>feature screen"]
  node_frontend_share["Shared view<br/>feature area"]
  node_frontend_settings["Settings<br/>feature screen"]
end

node_frontend_app -->|"uses"| node_frontend_routes
node_frontend_routes -->|"navigates to"| node_frontend_auth_features
node_frontend_routes -->|"navigates to"| node_frontend_dashboard
node_frontend_routes -->|"navigates to"| node_frontend_vehicle
node_frontend_routes -->|"navigates to"| node_frontend_share
node_frontend_routes -->|"navigates to"| node_frontend_settings
node_frontend_routes -->|"wraps"| node_frontend_shell
node_frontend_routes -->|"protects"| node_frontend_auth
node_frontend_auth -->|"calls"| node_backend_api
node_frontend_share -->|"reads"| node_backend_share
node_frontend_vehicle -->|"calls"| node_backend_api
node_frontend_dashboard -->|"calls"| node_backend_api
node_frontend_settings -->|"calls"| node_backend_api
node_backend_app -->|"hosts"| node_backend_api
node_backend_api -->|"delegates"| node_backend_auth
node_backend_api -->|"delegates"| node_backend_vehicle
node_backend_api -->|"delegates"| node_backend_fuel
node_backend_api -->|"delegates"| node_backend_maintenance
node_backend_api -->|"delegates"| node_backend_share
node_backend_vehicle -->|"stores"| node_backend_persistence
node_backend_fuel -->|"stores"| node_backend_persistence
node_backend_maintenance -->|"stores"| node_backend_persistence
node_backend_share -->|"stores"| node_backend_persistence
node_backend_auth -->|"stores"| node_backend_persistence
node_backend_vehicle -->|"uses"| node_backend_models
node_backend_fuel -->|"uses"| node_backend_models
node_backend_maintenance -->|"uses"| node_backend_models
node_backend_auth -->|"uses"| node_backend_models
node_backend_vehicle -->|"transfers"| node_backend_dto
node_backend_fuel -->|"transfers"| node_backend_dto
node_backend_maintenance -->|"transfers"| node_backend_dto
node_backend_auth -->|"transfers"| node_backend_dto
node_backend_share -->|"transfers"| node_backend_dto
node_backend_vehicle -->|"orchestrates"| node_backend_storage
node_backend_maintenance -->|"orchestrates"| node_backend_storage
node_backend_api -->|"maps errors"| node_backend_errors

click node_backend_app "https://github.com/hofnarrxx/auto-log/blob/main/backend/src/main/java/com/hofnarrxx/autolog/AutologApplication.java"
click node_backend_dto "https://github.com/hofnarrxx/auto-log/tree/main/backend/src/main/java/com/hofnarrxx/autolog/dto"
click node_frontend_app "https://github.com/hofnarrxx/auto-log/blob/main/frontend/src/app/app.ts"
click node_frontend_routes "https://github.com/hofnarrxx/auto-log/blob/main/frontend/src/app/app.routes.ts"
click node_frontend_auth "https://github.com/hofnarrxx/auto-log/tree/main/frontend/src/app/core/auth"
click node_frontend_shell "https://github.com/hofnarrxx/auto-log/tree/main/frontend/src/app/core/layout/app-layout"
click node_frontend_auth_features "https://github.com/hofnarrxx/auto-log/tree/main/frontend/src/app/features/auth"
click node_frontend_vehicle "https://github.com/hofnarrxx/auto-log/tree/main/frontend/src/app/features/vehicle"
click node_frontend_dashboard "https://github.com/hofnarrxx/auto-log/tree/main/frontend/src/app/features/dashboard"
click node_frontend_share "https://github.com/hofnarrxx/auto-log/tree/main/frontend/src/app/features/share"
click node_frontend_settings "https://github.com/hofnarrxx/auto-log/tree/main/frontend/src/app/features/settings"

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_backend_app,node_backend_api,node_backend_auth,node_backend_vehicle,node_backend_fuel,node_backend_maintenance,node_backend_share,node_backend_persistence,node_backend_models,node_backend_dto,node_backend_storage,node_backend_errors toneBlue
class node_frontend_app,node_frontend_routes,node_frontend_auth,node_frontend_shell,node_frontend_auth_features,node_frontend_vehicle,node_frontend_dashboard,node_frontend_share,node_frontend_settings toneAmber
```

## Components

### Backend

Spring Boot API, domain logic, persistence, security, and storage orchestration.

- [Autolog app](https://github.com/hofnarrxx/auto-log/blob/main/backend/src/main/java/com/hofnarrxx/autolog/AutologApplication.java): spring boot entry · Backend application bootstrap and runtime entry point. · `backend/src/main/java/com/hofnarrxx/autolog/AutologApplication.java`
- **HTTP API**: rest controllers · Primary authenticated REST surface for auth, vehicles, fuel, maintenance, metadata, and sharing.
- **Auth stack**: security · JWT, OAuth2, user details, refresh tokens, and security configuration.
- **Vehicle domain**: service layer · Vehicle CRUD and image URL orchestration.
- **Fuel domain**: service layer · Fuel entry management and related API operations.
- **Maintenance domain**: service layer · Maintenance records, categories, and attachment workflows.
- **Sharing**: public access · Share-link creation and unauthenticated read-only vehicle access.
- **Repositories**: data access · Database repositories for users, vehicles, fuel, maintenance, tokens, and share links.
- **Domain model**: entities enums · Persisted entities and value types for users, vehicles, fuel, maintenance, attachments, tokens, and currencies.
- [DTOs](https://github.com/hofnarrxx/auto-log/tree/main/backend/src/main/java/com/hofnarrxx/autolog/dto): api contracts · Request/response payloads for auth, vehicles, fuel, maintenance, share links, and upload/download URLs. · `backend/src/main/java/com/hofnarrxx/autolog/dto`
- **Object storage**: r2 integration · R2-style signed upload/download URL generation for vehicle images and maintenance attachments.
- **Error handling**: exception mapping · Central exception translation to consistent API responses.

### Frontend

Angular SPA with route-level features and client-side auth wiring.

- [Angular app](https://github.com/hofnarrxx/auto-log/blob/main/frontend/src/app/app.ts): spa entry · Browser application bootstrap and root shell. · `frontend/src/app/app.ts`
- [Routes](https://github.com/hofnarrxx/auto-log/blob/main/frontend/src/app/app.routes.ts): routing · Top-level route configuration and feature navigation. · `frontend/src/app/app.routes.ts`
- [Auth layer](https://github.com/hofnarrxx/auto-log/tree/main/frontend/src/app/core/auth): guards interceptor · Route protection and authenticated API request wiring. · `frontend/src/app/core/auth`
- [App shell](https://github.com/hofnarrxx/auto-log/tree/main/frontend/src/app/core/layout/app-layout): layout · Authenticated layout container and shared UI framing. · `frontend/src/app/core/layout/app-layout`
- [Auth screens](https://github.com/hofnarrxx/auto-log/tree/main/frontend/src/app/features/auth): feature area · Login and registration UI. · `frontend/src/app/features/auth`
- [Vehicle UI](https://github.com/hofnarrxx/auto-log/tree/main/frontend/src/app/features/vehicle): feature area · Vehicle form and dashboard with details, fuel, and maintenance tabs. · `frontend/src/app/features/vehicle`
- [Dashboard](https://github.com/hofnarrxx/auto-log/tree/main/frontend/src/app/features/dashboard): feature screen · Main post-login landing page and summary workspace. · `frontend/src/app/features/dashboard`
- [Shared view](https://github.com/hofnarrxx/auto-log/tree/main/frontend/src/app/features/share): feature area · Unauthenticated public vehicle read-only experience. · `frontend/src/app/features/share`
- [Settings](https://github.com/hofnarrxx/auto-log/tree/main/frontend/src/app/features/settings): feature screen · User preferences and account settings UI. · `frontend/src/app/features/settings`

## Connections

- Angular app → Routes: uses · Root app delegates navigation to route configuration.
- Routes → Auth screens: navigates to · Routes expose login and registration screens.
- Routes → Dashboard: navigates to · Routes expose the main dashboard.
- Routes → Vehicle UI: navigates to · Routes expose vehicle workflows and subviews.
- Routes → Shared view: navigates to · Routes expose public shared-vehicle views.
- Routes → Settings: navigates to · Routes expose settings screens.
- Routes → App shell: wraps · Protected routes render inside the app shell.
- Routes → Auth layer: protects · Route guards gate authenticated areas.
- Auth layer → HTTP API: calls · Auth layer invokes backend auth endpoints and attaches JWTs.
- Shared view → Sharing: reads · Shared vehicle screens fetch public access data.
- Vehicle UI → HTTP API: calls · Vehicle workflows use authenticated API endpoints.
- Dashboard → HTTP API: calls · Dashboard data comes from backend API resources.
- Settings → HTTP API: calls · Settings flows use backend API resources.
- Autolog app → HTTP API: hosts · Application bootstraps the REST API surface.
- HTTP API → Auth stack: delegates · Auth controller and security filter chain handle login, OAuth2, JWT, and refresh flows.
- HTTP API → Vehicle domain: delegates · Vehicle controller routes to vehicle service logic.
- HTTP API → Fuel domain: delegates · Fuel controller routes to fuel service logic.
- HTTP API → Maintenance domain: delegates · Maintenance controller routes to maintenance service logic.
- HTTP API → Sharing: delegates · Share-link and public-access controllers handle sharing flows.
- Vehicle domain → Repositories: stores · Vehicle operations persist through repositories.
- Fuel domain → Repositories: stores · Fuel operations persist through repositories.
- Maintenance domain → Repositories: stores · Maintenance operations persist through repositories.
- Sharing → Repositories: stores · Share link and public access lookups use repositories.
- Auth stack → Repositories: stores · Users, auth providers, and refresh tokens are persisted.
- Vehicle domain → Domain model: uses · Vehicle services operate on persisted domain entities.
- Fuel domain → Domain model: uses · Fuel services operate on persisted domain entities.
- Maintenance domain → Domain model: uses · Maintenance services operate on persisted domain entities.
- Auth stack → Domain model: uses · Security services use users, auth providers, and refresh tokens.
- Vehicle domain → DTOs: transfers · Vehicle APIs expose request/response DTOs.
- Fuel domain → DTOs: transfers · Fuel APIs expose request/response DTOs.
- Maintenance domain → DTOs: transfers · Maintenance APIs expose request/response DTOs and file URL payloads.
- Auth stack → DTOs: transfers · Auth flows exchange token and credential DTOs.
- Sharing → DTOs: transfers · Share APIs expose public access DTOs.
- Vehicle domain → Object storage: orchestrates · Vehicle image uploads/downloads are handled via signed URL storage integration.
- Maintenance domain → Object storage: orchestrates · Maintenance attachments use signed URL storage integration.
- HTTP API → Error handling: maps errors · Controllers rely on centralized exception handling.
