How aguvilte/alp-evaluator works
Project type and purpose
• This is a Go‑based backend microservice named “alp‑evaluator.”
• It exposes HTTP endpoints under cmd/api (ping and prediction), implements business logic in internal/core, and interacts with external systems via repository adapters (OS commands and REST calls).
File structure
• Top‑level:
• cmd/api – entrypoint for the HTTP server (app.go, dependencies.go)
• cmd/main.go – optionally bootstraps other commands or invokes api
• internal/core – “hexagonal” core:
– domain/license_plate.go (entity)
– ports/{repositories.go,services.go} (interfaces)
– services/prediction_service.go (business logic)
• internal/handlers – transport layer (HTTP handlers)
– ping/handler.go
– prediction/handler.go
• internal/repositories – adapters:
– os/os.go (executes local OS commands)
– rest/rest.go (calls external REST service)
README
• Minimal README (“# alp‑evaluator”) – no extra architectural detail. All intelligence must come from file layout.
a. Main components
• HTTP Server (net/http or similar)
• Handlers (Ping, Prediction)
• Application Service (PredictionService)
• Domain Model (LicensePlate)
• Ports (ServicePort, RepositoryPort interfaces)
• Adapters/Repositories (OSAdapter, RESTAdapter)
• External Systems (Operating System, External License‑Plate API)
b. Relationships & interactions
1. Client → HTTP Server → Handler
2. Handler invokes PredictionService via ServicePort
3. PredictionService uses one or more RepositoryPort interfaces to fetch or process data
4. Each RepositoryPort is implemented by an adapter: OSAdapter calls local shell, RESTAdapter calls remote HTTP API
5. Results bubble back through the same path to the client
c. Architectural patterns
• Hexagonal (Ports & Adapters)
• Layered separation: Transport (handlers) → Application (services) → Domain → Infrastructure (adapters)
• Dependency Injection in cmd/api/dependencies.go
d. Key technologies/frameworks
• Go modules (go.mod/go.sum)
• net/http or a lightweight Go HTTP framework
• Standard library exec package (OS adapter)
• net/http client (REST adapter)
Essential details to capture
• Ports & Adapters boundaries explicitly
• Where dependency injection occurs (dependencies.go)
• Both repository implementations to emphasize pluggability