How josdem/vetlog-spring-boot works
1. This is a single Spring Boot monolith for pet/veterinary record management. The core user stories are: register users, manage pets and vet logs, list pets for adoption, and adopt a pet. It is not an API-only service; the main UI is server-rendered.
2. The presentation layer is built around Spring MVC controllers and Thymeleaf templates. Controllers such as UserController, PetController, PetLogController, AdoptionController, LoginController, RecoveryController, VetController, LocationController, and GoogleMapController route browser requests to views under src/main/resources/templates. Static assets live under src/main/resources/static.
3. Form handling is separated from domain entities using command objects and binders. The command package contains request/view models like UserCommand, PetCommand, PetLogCommand, RecoveryPasswordCommand, ChangePasswordCommand, and adoption/telephone-related commands. Custom binders in binder convert request input into domain types, and validators enforce input rules before service logic runs.
4. The core business domain centers on User, Pet, PetLog, Vaccination, Breed, PetAdoption, PetImage, PetMedicine, RegistrationCode, and Location. These models represent account data, pet history, adoption state, photos, and location metadata.
5. Persistence is repository-driven. The repository package uses Spring Data repositories for the main aggregates, while Flyway migrations in src/main/resources/db/migration evolve the schema. This indicates a relational database as the system of record, with versioned SQL migrations rather than schema generation.
6. The service layer holds the main orchestration logic. Services such as PetService, PetLogService, UserService, AdoptionService, RegistrationService, RecoveryService, VaccinationService, BreedService, LocationService, and TelephoneService sit between controllers and repositories. Their impl counterparts contain the concrete workflows.
7. There are several important integration boundaries. EmailService integrates with a third-party mailer service mentioned in the README, GoogleStorageWriter and PetImageService handle pet image storage, and GoogleService/RestService support external HTTP-based lookups such as Google-related data or geolocation. ClientConfiguration and related properties classes centralize those connection settings.
8. Security is a first-class subsystem. WebSecurityConfig, UserDetailsServiceImpl, and the Role enum define authentication and authorization. Recovery and password-change flows are separate features, backed by RecoveryController, RecoveryService, and password-related command/validator classes.
9. Vaccination logic uses a strategy pattern. VaccinationStrategyConfig selects between CatVaccinationStrategy and DogVaccinationStrategy, allowing pet-type-specific vaccination schedules and formatting without hard-coding the rules into controllers or repositories.
10. Cross-cutting concerns are handled outside the main business flow. AfterThrowingAdvice and the exception package provide centralized error handling, while helpers/utilities such as LocaleResolver, TemplateLocaleResolver, VaccinationHelper, UserUtil, and formatters keep presentation and business classes smaller. Internationalization is supported through messages.properties and messages_es.properties.
11. Operationally, the project is built with Gradle, has Docker support, and includes GitHub Actions CI. The structure and tests suggest a well-layered, heavily unit-tested codebase with clear separation between UI, business logic, persistence, and external services.
Main entry points: controller Controllers · service Services · config Configuration · model Models
Components 19
Web UI
Spring MVC controllers, templates, and browser-facing flows.
- Controllers · Browser-facing request handlers for users, pets, adoption, recovery, location, and vet views.
src/main/java/com/josdem/vetlog/controller - Thymeleaf · Rendered HTML templates for forms, lists, login, recovery, maps, and adoption pages.
src/main/resources/templates - Static Assets · CSS, JavaScript, images, and theme resources served directly to the browser.
src/main/resources/static
Application
Use-case orchestration, validation, binders, and commands.
- Commands · Request and view models that decouple forms from entities.
src/main/java/com/josdem/vetlog/command - Binders · Custom binders that convert incoming form data into domain-friendly types.
src/main/java/com/josdem/vetlog/binder - Validators · Validation layer for user, pet, adoption, and password flows.
src/main/java/com/josdem/vetlog/validator - Services · Main use-case orchestration across users, pets, logs, adoption, recovery, and vaccination.
src/main/java/com/josdem/vetlog/service - Service Impl · Concrete service workflows and coordination logic.
src/main/java/com/josdem/vetlog/service/impl
Domain
Core entities, repositories, and business rules.
- Models · Core domain objects for users, pets, logs, adoption, vaccines, images, medicine, codes, and locations.
src/main/java/com/josdem/vetlog/model - Repositories · Spring Data repositories for the main aggregates.
src/main/java/com/josdem/vetlog/repository - Enums · Shared domain state such as roles, pet status, vaccination status, and units.
src/main/java/com/josdem/vetlog/enums
Integrations
External services, storage, mail, and HTTP lookups.
- Email Service · Outbound email integration used by recovery and registration flows.
src/main/java/com/josdem/vetlog/service/EmailService.java - Image Storage · Pet image upload and storage integration.
src/main/java/com/josdem/vetlog/client/GoogleStorageWriter.java - HTTP/Google · Google and REST-based lookups such as geolocation and related data.
src/main/java/com/josdem/vetlog/service/GoogleService.java
Infrastructure
Security, configuration, migrations, and cross-cutting concerns.
- VetlogApplication · Spring Boot entrypoint.
src/main/java/com/josdem/vetlog/VetlogApplication.java - Security · Authentication, authorization, and user details loading.
src/main/java/com/josdem/vetlog/config/WebSecurityConfig.java - Configuration · Application, client, template, Google, Gmail, and strategy configuration.
src/main/java/com/josdem/vetlog/config - Advice & Errors · Centralized exception handling and after-throwing advice.
src/main/java/com/josdem/vetlog/advice - Flyway Migrations · Versioned SQL migrations for the relational database schema.
src/main/resources/db/migration
Connections 22
- VetlogApplication → Controllers: starts · Bootstraps the web application.
- Controllers → Thymeleaf: renders · Controllers return server-rendered views.
- Controllers → Commands: binds · Controllers populate command objects for forms and views.
- Controllers → Binders: uses · Custom binders prepare request data.
- Controllers → Validators: validates · Input is validated before business logic executes.
- Binders → Models: maps to · Binders convert request values into domain types.
- Validators → Commands: checks · Validators enforce command object constraints.
- Controllers → Services: delegates · Controllers hand off use cases to services.
- Services → Service Impl: implements · Service interfaces are realized by concrete workflows.
- Service Impl → Repositories: persists · Services read and write through repositories.
- Repositories → Models: stores · Repositories manage core aggregates.
- Models → Enums: uses · Entities depend on shared enum state.
- Services → Email Service: sends mail · Recovery and registration notifications.
- Services → Image Storage: stores images · Pet photos are uploaded externally.
- Services → HTTP/Google: calls out · External data and geolocation lookups.
- Services → Security: secured by · Authentication and authorization gate the app.
- Configuration → Email Service: configures · Mail client settings.
- Configuration → HTTP/Google: configures · HTTP/client and Google settings.
- Configuration → Image Storage: configures · Storage credentials and client options.
- Advice & Errors → Controllers: handles failures · Centralized controller-adjacent error handling.
- Flyway Migrations → Repositories: supports · Migrations define the schema used by repositories.
- Controllers → Static Assets: serves · Controllers and templates are complemented by static assets.