How lbbedendo/diecast-collector-api works
Project Type & Purpose
• This is a backend REST API (“Diecast Collector API”) built with the Micronaut Framework in Java.
• Its purpose is to manage a diecast car collection (Automakers, Brands, Collections, Models) and expose CRUD‐style endpoints plus a dashboard.
Key Architectural Characteristics
• Layered architecture (Controller → Service → Repository → Database)
• Dependency Injection via Micronaut
• Database migrations via Flyway
• Typesafe SQL via jOOQ code generation during the Gradle build
• Deployment in Docker (Dockerfile + docker‐compose.yaml)
• Integration tests using Testcontainers
Main Components
A. Client Layer
• React Web App (or Insomnia/API client)
B. API Layer
• Micronaut HTTP Server
• Controllers:
– AutomakerController
– BrandController
– CollectionController
– ModelController
– DashboardController
• DTOs & Filters (request/response objects)
C. Business Logic Layer
• Services: AutomakerService, BrandService, CollectionService, ModelService, DashboardService
D. Data Access Layer
• Micronaut Data Repositories: AutomakerRepository, BrandRepository, CollectionRepository, ModelRepository
• jOOQ generated classes
E. Persistence
• PostgreSQL database
• Flyway migrations (V2__ddl.sql located under src/main/resources/db/migration)
F. Build & Deployment
• Gradle wrapper & build.gradle
• Docker: Dockerfile + docker-compose.yaml (PostgreSQL + App container)
• Testcontainers for integration tests
Relationships & Data Flow
1) Client issues HTTP requests →
2) Micronaut Router dispatches to the appropriate Controller →
3) Controller transforms request into DTOs and invokes Service →
4) Service encapsulates business rules and calls Repository →
5) Repository (Micronaut Data or jOOQ) executes SQL against PostgreSQL →
6) Flyway runs DB migrations at startup →
7) Response returns back up the chain to the client.
Architectural Patterns & Principles
• Layered Separation of Concerns (Controller / Service / Repository)
• Configuration‐as‐Code (application.yml, micronaut-cli.yml)
• Convention over Configuration via Micronaut
• Continuous Integration via Gradle and Docker
• Test Isolation with Testcontainers