How dogukanttopcuoglu/beatflow works
1. Repository shape
BeatFlow is a Go monorepo organized around two kinds of units: deployable services under apps/ and reusable technical packages under packages/go/. The root go.work ties the modules together so services can consume shared libraries without copying code.
2. Current deployed service boundary
The only implemented application is apps/auth-service, which is the first backend microservice. It is a standalone Go module with its own go.mod, build entrypoint, and internal package tree, so it can be built and run independently of the rest of the repo.
3. Auth service internal layering
auth-service is split into a small layered structure:
- cmd/api/main.go is the executable entrypoint and startup orchestration.
- internal/app holds application wiring.
- internal/config handles service-specific configuration.
- internal/handler/health contains the current HTTP handler and route definitions.
- internal/transport/httpadapter acts as the HTTP adapter between the transport layer and the internal handler/app logic.
4. Request flow in the current code
The visible runtime flow is simple: the API process starts in main.go, loads config, wires the app, registers HTTP routes, and serves a health endpoint through the HTTP adapter. There is no visible domain persistence or async processing in the current code; the auth service is still a skeleton focused on process bootstrapping and liveness checks.
5. Shared technical packages
packages/go/config and packages/go/logger are cross-service modules intended for non-domain concerns only. They centralize configuration loading and structured logging so each service does not reimplement those basics. This is the main shared boundary in the repo.
6. Docs as the architecture contract
The docs/ tree is not runtime code, but it is architecturally important because it defines the intended platform shape: microservices, CQRS/consistency, event-driven communication, resilience patterns, observability, security, testing, and deployment strategy. For diagramming, treat these docs as the source of truth for planned system boundaries and infrastructure choices.
7. Target platform and external dependencies
The documentation and ADRs describe a backend platform that will eventually use PostgreSQL, Redis, Elasticsearch, S3, RabbitMQ, Kafka, and possibly Couchbase. These are not implemented in the current code tree, but they define the expected data and integration boundaries for future services like user-service, beat-service, order-service, and others listed in the README.
8. Deployment topology
deployments/docker-compose/docker-compose.yml supports local development and likely spins up the service and its dependencies in a Docker-based environment. The docs also indicate a Kubernetes + Argo CD target for production delivery, so the intended deployment model is containerized services managed through GitOps.
9. Quality and operability boundaries
The repo includes tests at both the service level and package level, especially around health handling, config, and logger behavior. This suggests the architecture values early validation of bootstrap, config, and observability plumbing before business features land.
10. How to draw the architecture diagram
The most accurate current diagram is: a root Go workspace feeding one deployable microservice (auth-service) plus shared technical packages (config, logger), surrounded by docs that define the future microservice ecosystem and infrastructure. Keep the current runtime box narrow: an HTTP API with a health endpoint and internal layering, while showing the broader platform dependencies as planned/target-state components rather than active code paths.
Main entry points: auth-service Auth service · main.go API entry · go.work Go workspace · app.go App wiring
Components 20
Workspace
Go workspace that ties services and shared packages together.
- Go workspace · Root Go workspace linking repo modules.
go.work
Auth Service
Current deployable backend service and its internal runtime layers.
- Auth service · Standalone first backend microservice.
apps/auth-service - API entry · Executable entrypoint and startup orchestration.
apps/auth-service/cmd/api/main.go - App wiring · Application assembly and dependency wiring.
apps/auth-service/internal/app/app.go - Service config · Auth-service configuration loading and shaping.
apps/auth-service/internal/config/config.go - Health handler · Current HTTP handler for liveness and health checks.
apps/auth-service/internal/handler/health/handler.go - Health routes · Route definitions for the health endpoint.
apps/auth-service/internal/handler/health/routes.go - HTTP adapter · Bridges HTTP transport to internal handler and app logic.
apps/auth-service/internal/transport/httpadapter/handler.go
Shared Packages
Reusable technical packages consumed by services.
- Config pkg · Reusable configuration loading package.
packages/go/config - Logger pkg · Reusable structured logging package.
packages/go/logger
Docs
Architecture and delivery guidance that defines the intended platform shape.
- Arch docs · Core architecture guidance for the planned platform.
docs/architecture - ADRs · Architecture decision records capturing major platform choices.
docs/adr - Deploy docs · CI/CD, GitOps, and Kubernetes delivery strategy.
docs/deployment - Observability · Observability strategy and runtime visibility guidance.
docs/observability - Security · Security strategy and boundary guidance.
docs/security - Testing · Testing strategy and validation approach.
docs/testing - Product · Vision and requirements that shape the repo roadmap.
docs/product
Target Platform
Planned data, messaging, and infrastructure boundaries described by the docs.
- Data stores · Planned persistent storage boundaries such as PostgreSQL, Redis, Elasticsearch, S3, and Couchbase.
- Messaging · Planned event and queue boundaries such as RabbitMQ and Kafka.
- GitOps · Planned Kubernetes and Argo CD delivery model.
Connections 23
- Go workspace → Auth service: includes · Workspace ties the service module into the monorepo.
- Go workspace → Config pkg: includes · Workspace ties the shared config module into the monorepo.
- Go workspace → Logger pkg: includes · Workspace ties the shared logger module into the monorepo.
- Auth service → API entry: starts at · Service runtime begins in the API entrypoint.
- API entry → App wiring: wires · Entrypoint assembles the application graph.
- API entry → Service config: loads · Entrypoint loads service configuration.
- API entry → HTTP adapter: serves via · Entrypoint starts the HTTP transport layer.
- App wiring → Health handler: registers · Application wiring connects the health handler.
- App wiring → Service config: uses · Application wiring depends on service configuration.
- HTTP adapter → Health handler: adapts · HTTP adapter forwards requests to the health handler.
- Health handler → Health routes: exposes · Health handler owns the route definitions.
- Auth service → Config pkg: reuses · Service uses shared configuration plumbing.
- Auth service → Logger pkg: reuses · Service uses shared logging plumbing.
- Arch docs → Data stores: describes · Architecture docs define the planned data boundaries.
- Arch docs → Messaging: describes · Architecture docs define the planned async boundaries.
- ADRs → GitOps: commits to · ADRs commit the repo to Kubernetes and Argo CD delivery.
- Deploy docs → GitOps: specifies · Deployment docs detail the GitOps delivery model.
- Observability → Auth service: covers · Observability guidance applies to service runtime.
- Security → Auth service: covers · Security guidance applies to service runtime.
- Testing → Config pkg: covers · Testing guidance applies to shared bootstrap concerns.
- Testing → Logger pkg: covers · Testing guidance applies to shared observability concerns.
- Product → Auth service: frames · Product guidance frames the current service roadmap.
- Product → Arch docs: informs · Product requirements feed the architecture direction.