How fiddelis/sher-lock works
Main Components
• API Service – This service (in the api-service directory) is responsible for handling parcel data and operations. It exposes endpoints through various controllers (e.g., ClientController, DrawerController, LockerController, ProductController, RegisterController, SiteController), interacts with a persistence layer (repositories and model classes), and includes producers (MailProducer) for triggering email notifications.
• Mail Service – This service (found under mail-service) subscribes as a consumer (MailConsumer) to messages (likely received via a messaging system or direct integration) and processes email delivery logic. It also handles QR Code generation using a utility (Qrcode), and exposes its own endpoint via a MailController.
• Static Web Frontend – The site-exemplo directory contains a simple HTML/CSS/JS website that serves as an example or entry point for users.
• Database – Although not explicitly named in the service directories, the presence of repository layers in both services and the Docker migration script (docker/migration/docker-database-initial.sql) strongly indicates a relational database (or possibly multiple databases) is used to manage persistent data.
• Docker & Deployment Scripts – The docker folder (with docker-compose.yml) and migration scripts suggest containerization and orchestrated deployment of these components.
Relationships and Interactions
• External Entities:
– Logistics Companies will interact with the system by depositing packages into the lockers.
– Customers receive a QR Code via email once a package is deposited.
– Clients / Users (via the static website or another client app) send requests to the API Service.
– API Service handles operations (e.g., registration, locker retrieval, product management) and writes data to or reads data from the Database.
– When a parcel is registered or needs notification, the API Service uses its MailProducer to send a notification message.
– The Mail Service (via its MailConsumer) receives the notification, processes the email (including generating a QR Code) and sends it to the customer.
• Internal Service Communication:
– Each microservice should show its internal layers (Controller → Service → Repository) and how they interact with the Database.
Important Architectural Patterns and Technologies
• Microservices Architecture – The separation into distinct services (api-service and mail-service) indicates a design focused on loose coupling and separation of concerns.
• Layered Architecture within each Service – Both services include a clear layering (Controller, Service, Repository, Model, and Utility).
• Messaging / Event-driven Communication – The use of a MailProducer in the API service and MailConsumer in the Mail service suggests an asynchronous messaging pattern to decouple email notifications from core business logic.
• Containerization and Orchestration – The Docker configurations imply the services are containerized, and docker-compose could be used to manage the multi-container deployment (API Service, Mail Service, and the Database).