How ardanlabs/service works
Main Components
• Frontend/API Layer:
• The “api” folder contains subdirectories for “frontends” (specifically an admin frontend built with web technologies like Vue.js) and service endpoints (e.g., auth, metrics, sales).
• The “api/tooling” directory covers command-line tools or admin utilities.
• Service Layer:
• Domain and Application Logic:
• The “app” directory contains domain-specific subdirectories (authapp, checkapp, homeapp, oauthapp, productapp, etc.) and SDK components. This layer implements business rules and service logic.
• Business Logic:
• The “business” directory further refines the domain logic into “domain” (homebus, productbus, userbus, vproductbus) with associated business rules and even test utilities.
• Foundation and Infrastructure:
• The “foundation” directory provides lower-level modules for handling cross-cutting concerns: Docker and deployment scripts, keystore management, logging, Open Telemetry (otel), web request handling, and background processing (workers).
• Deployment and Operational Aspects:
• Directories like “.circleci”, “zarf” (with Kubernetes and Docker configurations), and “makefile” support Continuous Integration/Deployment, containerization, and orchestration in Kubernetes.
Understand the Relationships & Flow
• The frontend (for example, the “admin” frontend) interacts with the backend API endpoints.
• API services (auth, metrics, sales) communicate with the underlying application (“app”) and business (“business”) layers. In many cases, the API layer is simply a presentation or interface layer that delegates to lower-level logic.
• The domain logic in “app” is structured to isolate business rules. In addition, the “business” layer may handle more refined or enterprise-level rules (for example, in “homebus” or “productbus”).
• Shared components in “foundation” provide utilities, middleware, and support services such as logging or metrics, ensuring that components are decoupled and follow best practices.
• The use of tooling and configuration (e.g., Docker configurations in “zarf”, CI/CD configs in “.circleci”, and the makefile for task automation) is integral for deployment and operational management.
Architectural Patterns & Key Practices Noted
• Domain Driven Design: Emphasis on distinct “domain” packages and clearly separated logic for each bounded context (auth, home, product, user, etc.).
• Data Oriented Architecture: The separation between raw/app, business, and sdk packages shows the importance of handling data and its transformations cleanly.
• Microservices and Separation of Concerns: The “api/services” directory shows how different service components (authentication, metrics, sales) are handled as independent units.
• Infrastructure as Code & Kubernetes Integration: The “zarf” directory with Kubernetes manifests and Dockerfiles highlights a containerized, orchestrated design.