# dogukanttopcuoglu/beatflow architecture

> Architecture diagram of the GitHub repository dogukanttopcuoglu/beatflow, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dogukanttopcuoglu/beatflow
- Repository: https://github.com/dogukanttopcuoglu/beatflow

## Overview

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: [`apps/auth-service`](https://github.com/dogukanttopcuoglu/beatflow/tree/main/apps/auth-service) (Auth service), [`apps/auth-service/cmd/api/main.go`](https://github.com/dogukanttopcuoglu/beatflow/blob/main/apps/auth-service/cmd/api/main.go) (API entry), [`go.work`](https://github.com/dogukanttopcuoglu/beatflow/blob/main/go.work) (Go workspace), [`apps/auth-service/internal/app/app.go`](https://github.com/dogukanttopcuoglu/beatflow/blob/main/apps/auth-service/internal/app/app.go) (App wiring)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Workspace"]
  node_go_work["Go workspace<br/>[go.work]"]
end

subgraph group_service["Auth Service"]
  node_auth_service["Auth service"]
  node_auth_main["API entry<br/>bootstrap<br/>[main.go]"]
  node_auth_app["App wiring<br/>composition<br/>[app.go]"]
  node_auth_config["Service config<br/>[config.go]"]
  node_health_handler["Health handler<br/>http handler<br/>[handler.go]"]
  node_health_routes["Health routes<br/>[routes.go]"]
  node_http_adapter["HTTP adapter<br/>transport adapter<br/>[handler.go]"]
end

subgraph group_shared["Shared Packages"]
  node_shared_config["Config pkg<br/>shared library"]
  node_shared_logger["Logger pkg<br/>shared library"]
end

subgraph group_docs["Docs"]
  node_arch_docs["Arch docs<br/>architecture docs"]
  node_adr_docs["ADRs<br/>decision records"]
  node_deploy_docs["Deploy docs<br/>delivery docs"]
  node_obs_docs["Observability<br/>operability docs"]
  node_sec_docs["Security"]
  node_test_docs["Testing<br/>quality docs"]
  node_prod_docs["Product"]
end

subgraph group_target["Target Platform"]
  node_target_data[("Data stores<br/>planned infra")]
  node_target_messaging["Messaging<br/>planned infra"]
  node_target_delivery["GitOps<br/>planned infra"]
end

node_go_work -->|"includes"| node_auth_service
node_go_work -->|"includes"| node_shared_config
node_go_work -->|"includes"| node_shared_logger
node_auth_service -->|"starts at"| node_auth_main
node_auth_main -->|"wires"| node_auth_app
node_auth_main -->|"loads"| node_auth_config
node_auth_main -->|"serves via"| node_http_adapter
node_auth_app -->|"registers"| node_health_handler
node_auth_app -->|"uses"| node_auth_config
node_http_adapter -->|"adapts"| node_health_handler
node_health_handler -->|"exposes"| node_health_routes
node_auth_service -->|"reuses"| node_shared_config
node_auth_service -->|"reuses"| node_shared_logger
node_arch_docs -->|"describes"| node_target_data
node_arch_docs -->|"describes"| node_target_messaging
node_adr_docs -->|"commits to"| node_target_delivery
node_deploy_docs -->|"specifies"| node_target_delivery
node_obs_docs -->|"covers"| node_auth_service
node_sec_docs -->|"covers"| node_auth_service
node_test_docs -->|"covers"| node_shared_config
node_test_docs -->|"covers"| node_shared_logger
node_prod_docs -->|"frames"| node_auth_service
node_prod_docs -->|"informs"| node_arch_docs

click node_go_work "https://github.com/dogukanttopcuoglu/beatflow/blob/main/go.work"
click node_auth_service "https://github.com/dogukanttopcuoglu/beatflow/tree/main/apps/auth-service"
click node_auth_main "https://github.com/dogukanttopcuoglu/beatflow/blob/main/apps/auth-service/cmd/api/main.go"
click node_auth_app "https://github.com/dogukanttopcuoglu/beatflow/blob/main/apps/auth-service/internal/app/app.go"
click node_auth_config "https://github.com/dogukanttopcuoglu/beatflow/blob/main/apps/auth-service/internal/config/config.go"
click node_health_handler "https://github.com/dogukanttopcuoglu/beatflow/blob/main/apps/auth-service/internal/handler/health/handler.go"
click node_health_routes "https://github.com/dogukanttopcuoglu/beatflow/blob/main/apps/auth-service/internal/handler/health/routes.go"
click node_http_adapter "https://github.com/dogukanttopcuoglu/beatflow/blob/main/apps/auth-service/internal/transport/httpadapter/handler.go"
click node_shared_config "https://github.com/dogukanttopcuoglu/beatflow/tree/main/packages/go/config"
click node_shared_logger "https://github.com/dogukanttopcuoglu/beatflow/tree/main/packages/go/logger"
click node_arch_docs "https://github.com/dogukanttopcuoglu/beatflow/tree/main/docs/architecture"
click node_adr_docs "https://github.com/dogukanttopcuoglu/beatflow/tree/main/docs/adr"
click node_deploy_docs "https://github.com/dogukanttopcuoglu/beatflow/tree/main/docs/deployment"
click node_obs_docs "https://github.com/dogukanttopcuoglu/beatflow/tree/main/docs/observability"
click node_sec_docs "https://github.com/dogukanttopcuoglu/beatflow/tree/main/docs/security"
click node_test_docs "https://github.com/dogukanttopcuoglu/beatflow/tree/main/docs/testing"
click node_prod_docs "https://github.com/dogukanttopcuoglu/beatflow/tree/main/docs/product"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_go_work toneBlue
class node_auth_service,node_auth_main,node_auth_app,node_auth_config,node_health_handler,node_health_routes,node_http_adapter toneAmber
class node_shared_config,node_shared_logger toneMint
class node_arch_docs,node_adr_docs,node_deploy_docs,node_obs_docs,node_sec_docs,node_test_docs,node_prod_docs toneRose
class node_target_data,node_target_messaging,node_target_delivery toneIndigo
```

## Components

### Workspace

Go workspace that ties services and shared packages together.

- [Go workspace](https://github.com/dogukanttopcuoglu/beatflow/blob/main/go.work): workspace · Root Go workspace linking repo modules. · `go.work`

### Auth Service

Current deployable backend service and its internal runtime layers.

- [Auth service](https://github.com/dogukanttopcuoglu/beatflow/tree/main/apps/auth-service): service · Standalone first backend microservice. · `apps/auth-service`
- [API entry](https://github.com/dogukanttopcuoglu/beatflow/blob/main/apps/auth-service/cmd/api/main.go): bootstrap · Executable entrypoint and startup orchestration. · `apps/auth-service/cmd/api/main.go`
- [App wiring](https://github.com/dogukanttopcuoglu/beatflow/blob/main/apps/auth-service/internal/app/app.go): composition · Application assembly and dependency wiring. · `apps/auth-service/internal/app/app.go`
- [Service config](https://github.com/dogukanttopcuoglu/beatflow/blob/main/apps/auth-service/internal/config/config.go): config · Auth-service configuration loading and shaping. · `apps/auth-service/internal/config/config.go`
- [Health handler](https://github.com/dogukanttopcuoglu/beatflow/blob/main/apps/auth-service/internal/handler/health/handler.go): http handler · Current HTTP handler for liveness and health checks. · `apps/auth-service/internal/handler/health/handler.go`
- [Health routes](https://github.com/dogukanttopcuoglu/beatflow/blob/main/apps/auth-service/internal/handler/health/routes.go): routes · Route definitions for the health endpoint. · `apps/auth-service/internal/handler/health/routes.go`
- [HTTP adapter](https://github.com/dogukanttopcuoglu/beatflow/blob/main/apps/auth-service/internal/transport/httpadapter/handler.go): transport 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](https://github.com/dogukanttopcuoglu/beatflow/tree/main/packages/go/config): shared library · Reusable configuration loading package. · `packages/go/config`
- [Logger pkg](https://github.com/dogukanttopcuoglu/beatflow/tree/main/packages/go/logger): shared library · Reusable structured logging package. · `packages/go/logger`

### Docs

Architecture and delivery guidance that defines the intended platform shape.

- [Arch docs](https://github.com/dogukanttopcuoglu/beatflow/tree/main/docs/architecture): architecture docs · Core architecture guidance for the planned platform. · `docs/architecture`
- [ADRs](https://github.com/dogukanttopcuoglu/beatflow/tree/main/docs/adr): decision records · Architecture decision records capturing major platform choices. · `docs/adr`
- [Deploy docs](https://github.com/dogukanttopcuoglu/beatflow/tree/main/docs/deployment): delivery docs · CI/CD, GitOps, and Kubernetes delivery strategy. · `docs/deployment`
- [Observability](https://github.com/dogukanttopcuoglu/beatflow/tree/main/docs/observability): operability docs · Observability strategy and runtime visibility guidance. · `docs/observability`
- [Security](https://github.com/dogukanttopcuoglu/beatflow/tree/main/docs/security): security docs · Security strategy and boundary guidance. · `docs/security`
- [Testing](https://github.com/dogukanttopcuoglu/beatflow/tree/main/docs/testing): quality docs · Testing strategy and validation approach. · `docs/testing`
- [Product](https://github.com/dogukanttopcuoglu/beatflow/tree/main/docs/product): product docs · 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 infra · Planned persistent storage boundaries such as PostgreSQL, Redis, Elasticsearch, S3, and Couchbase.
- **Messaging**: planned infra · Planned event and queue boundaries such as RabbitMQ and Kafka.
- **GitOps**: planned infra · Planned Kubernetes and Argo CD delivery model.

## Connections

- 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.
