How joaofnds/pbd works
Project type and purpose
• This is a single Go “service” (monolith) that exposes an HTTP API and runs background workers.
• It follows a hexagonal (ports-and-adapters) architecture: core domain modules (user, order, calendar, etc.), each with its own “module,” “service,” “repository,” “HTTP controller” and “adapter” packages.
• It orchestrates dependencies via Uber’s Fx, reads configuration via Viper, logs with Zap, collects metrics with Prometheus, traces with OpenTelemetry, and integrates with third-party auth (Casdoor/Casbin) and feature-flag services.
File structure
• cmd/app: the main HTTP server process
• cmd/worker: background worker process
• config/: Viper-driven configuration
• adapter/: all external interfaces—HTTP (Fiber), metrics, logging, tracing, persistence (Postgres via Gorm, Mongo, Redis), queue client/server (Asynq), message bus (Watermill), authn (Casdoor), authz (Casbin), feature flags
• domain packages (user, order, booking, calendar, customer, event, phone, kv, worker, authn, authz, etc.): each defines DTOs, services, repositories, HTTP controllers, module wiring
• test/: e2e and unit-test harnesses
• Dockerfile & docker-compose: containerization & local infra for Postgres, Redis, Mongo, Prometheus, Grafana
Key points from README
• Core features: DI (Fx), config (Viper), logging (Zap), metrics (Prom), tracing (OTel), health checks, feature flags, validation, HTTP (Fiber), CQRS/eventing (Watermill), background tasks (Asynq), testing (Ginkgo/Gomega), migrations (Goose), storage adapters, CI/CD / semantic versioning, distroless container