# edgexfoundry/edgex-go architecture

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

- Interactive diagram: https://gitdiagram.com/edgexfoundry/edgex-go
- Repository: https://github.com/edgexfoundry/edgex-go

## Overview

#### Purpose and Executables
This Go repository implements EdgeX Foundry’s edge-IoT platform microservices: core device/data APIs, supporting automation/notifications, and security/bootstrap utilities. Each deployable has a thin executable entry point under `cmd/`, which loads service resources and delegates into `internal/`, e.g. `cmd/core-data/main.go`, `cmd/core-metadata/main.go`, and `cmd/support-scheduler/main.go`. Docker images are defined per service alongside these entry points.

#### Core Metadata: Device-System Registry
Core Metadata owns device-facing configuration and identity: devices, device services, profiles, commands/resources, provisioning watchers, capacities, and units of measure. HTTP controllers route into application logic, backed by PostgreSQL and a units-of-measure bootstrap source.
- `internal/core/metadata/application/device.go`
- `internal/core/metadata/controller/http/device.go`
- `internal/core/metadata/container/database.go`

#### Core Data: Telemetry Persistence and Query
Core Data receives readings/events through HTTP and message-bus subscriptions, persists and queries them, aggregates readings, and purges aged events. Its application layer isolates controllers from database/cache/device dependencies; embedded SQL establishes its schema.
- `internal/core/data/controller/messaging/subscriber.go`
- `internal/core/data/application/readingagg.go`
- `internal/core/data/embed/sql/idempotent/01-tables.sql`

#### Core Command: Actuation Boundary
Core Command exposes HTTP command invocation and consumes/produces command-related messages. It is the control-plane boundary for invoking device commands, using configuration/container wiring and separate HTTP versus internal/external messaging controllers.
- `internal/core/command/controller/http/command.go`
- `internal/core/command/controller/messaging/external.go`
- `internal/core/command/application/command.go`

#### Core Keeper and Shared State
Core Keeper provides registry and key-value APIs, separating service application/controller layers from database and registry interfaces. Shared infrastructure supplies PostgreSQL persistence and Redis-backed caches/data access used across services.
- `internal/core/keeper/application/registry.go`
- `internal/pkg/infrastructure/postgres/registry.go`
- `internal/pkg/infrastructure/redis/kv.go`

#### Support Services: Delivery and Scheduled Automation
Support Notifications stores notifications, subscriptions, and transmissions, then dispatches through email, MQTT, or ZeroMQ channels. Support Scheduler persists jobs/action records and executes cron, REST, device-control, or EdgeX-message-bus actions through a scheduler manager.
- `internal/support/notifications/application/distributioncoordinator.go`
- `internal/support/notifications/application/channel/mqtt.go`
- `internal/support/scheduler/application/action/edgexmessagebus.go`

#### Security and Startup Orchestration
Security utilities provision and operate secret-store access, token providers, proxy authorization/key storage, SPIFFE identities, and secure dependency startup. The bootstrapper configures or waits on PostgreSQL, Redis, Mosquitto/message bus, proxy, and secret-store components; shell entrypoints sequence container readiness.
- `internal/security/bootstrapper/main.go`
- `internal/security/secretstore/main.go`
- `internal/security/proxyauth/application/key.go`

#### Runtime, APIs, and Deployment Boundaries
Services are Go binaries commonly run as Docker Compose containers. Public REST contracts are specified in `openapi/`; security-enabled deployments route external requests through a proxy with access tokens rather than directly exposed service ports. PostgreSQL is the durable system of record, Redis supplies cache/state implementations, and messaging supports EdgeX message bus operation (with NATS optional at build time); notification channels additionally reach MQTT, ZeroMQ, and email endpoints.
- `openapi/core-data.yaml`
- `cmd/security-proxy-auth/main.go`
- `internal/pkg/db/postgres/client.go`

Main entry points: [`internal/pkg/db/postgres/client.go`](https://github.com/edgexfoundry/edgex-go/blob/main/internal/pkg/db/postgres/client.go) (PostgreSQL), [`internal/security/bootstrapper/main.go`](https://github.com/edgexfoundry/edgex-go/blob/main/internal/security/bootstrapper/main.go) (Security bootstrapper), [`internal/core/data/application/readingagg.go`](https://github.com/edgexfoundry/edgex-go/blob/main/internal/core/data/application/readingagg.go) (Telemetry aggregation), [`internal/core/command/application/command.go`](https://github.com/edgexfoundry/edgex-go/blob/main/internal/core/command/application/command.go) (Command application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Core services"]
  node_core_metadata_api["Core Metadata API<br/>Go service<br/>[device.go]"]
  node_core_metadata_app["Metadata application<br/>application layer<br/>[device.go]"]
  node_core_metadata_db["Metadata DB wiring<br/>container<br/>[database.go]"]
  node_core_data_ingest["Core Data ingestion<br/>messaging controller<br/>[subscriber.go]"]
  node_core_data_app["Telemetry aggregation<br/>application layer<br/>[readingagg.go]"]
  node_core_data_schema["Core Data schema<br/>embedded SQL<br/>[01-tables.sql]"]
  node_core_command_http["Core Command API<br/>HTTP controller<br/>[command.go]"]
  node_core_command_app["Command application<br/>application layer<br/>[command.go]"]
  node_core_command_bus["Command messaging<br/>messaging controller<br/>[external.go]"]
  node_core_keeper["Core Keeper registry<br/>application layer<br/>[registry.go]"]
end

subgraph group_support["Support services"]
  node_notifications["Notifications coordinator<br/>application layer"]
  node_notification_mqtt["MQTT notification channel<br/>delivery channel<br/>[mqtt.go]"]
  node_scheduler["Scheduler bus actions<br/>scheduled action<br/>[edgexmessagebus.go]"]
end

subgraph group_security["Security and bootstrap"]
  node_bootstrapper{{"Security bootstrapper<br/>startup orchestrator<br/>[main.go]"}}
  node_secret_store["Secret store service<br/>security utility<br/>[main.go]"]
  node_proxy_auth["Proxy authorization<br/>security application<br/>[key.go]"]
  node_security_proxy["Security proxy binary<br/>Go executable<br/>[main.go]"]
end

subgraph group_platform["Platform boundaries"]
  node_openapi["Core Data OpenAPI<br/>public contract<br/>[core-data.yaml]"]
  node_postgres[("PostgreSQL<br/>durable persistence<br/>[client.go]")]
  node_redis[("Redis state<br/>cache and KV<br/>[kv.go]")]
  node_message_bus["EdgeX message bus<br/>event transport"]
  node_device_endpoints["Device services<br/>device boundary"]
end

node_security_proxy -->|"authorizes via"| node_proxy_auth
node_proxy_auth -->|"stores keys in"| node_secret_store
node_bootstrapper -->|"provisions"| node_secret_store
node_bootstrapper -.->|"waits/configures"| node_postgres
node_bootstrapper -.->|"waits/configures"| node_redis
node_bootstrapper -.->|"waits/configures"| node_message_bus
node_security_proxy -->|"secured REST"| node_core_metadata_api
node_security_proxy -->|"secured REST"| node_core_command_http
node_openapi -.->|"documents Core Data"| node_core_data_ingest
node_core_metadata_api -->|"routes to"| node_core_metadata_app
node_core_metadata_app -->|"uses"| node_core_metadata_db
node_core_metadata_db -->|"persists"| node_postgres
node_core_data_ingest -->|"delivers readings"| node_core_data_app
node_message_bus -->|"telemetry events"| node_core_data_ingest
node_core_data_app -.->|"initializes"| node_core_data_schema
node_core_data_app -->|"persists events"| node_postgres
node_core_data_app -->|"uses cache"| node_redis
node_core_command_http -->|"invokes"| node_core_command_app
node_core_command_bus -->|"routes messages"| node_core_command_app
node_core_command_app -->|"publishes commands"| node_message_bus
node_core_command_app -->|"executes commands"| node_device_endpoints
node_core_keeper -->|"registry persistence"| node_postgres
node_core_keeper -->|"key-value state"| node_redis
node_notifications -->|"stores delivery state"| node_postgres
node_notifications -->|"dispatches through"| node_notification_mqtt
node_scheduler -->|"executes bus actions"| node_message_bus

click node_core_metadata_api "https://github.com/edgexfoundry/edgex-go/blob/main/internal/core/metadata/controller/http/device.go"
click node_core_metadata_app "https://github.com/edgexfoundry/edgex-go/blob/main/internal/core/metadata/application/device.go"
click node_core_metadata_db "https://github.com/edgexfoundry/edgex-go/blob/main/internal/core/metadata/container/database.go"
click node_core_data_ingest "https://github.com/edgexfoundry/edgex-go/blob/main/internal/core/data/controller/messaging/subscriber.go"
click node_core_data_app "https://github.com/edgexfoundry/edgex-go/blob/main/internal/core/data/application/readingagg.go"
click node_core_data_schema "https://github.com/edgexfoundry/edgex-go/blob/main/internal/core/data/embed/sql/idempotent/01-tables.sql"
click node_core_command_http "https://github.com/edgexfoundry/edgex-go/blob/main/internal/core/command/controller/http/command.go"
click node_core_command_app "https://github.com/edgexfoundry/edgex-go/blob/main/internal/core/command/application/command.go"
click node_core_command_bus "https://github.com/edgexfoundry/edgex-go/blob/main/internal/core/command/controller/messaging/external.go"
click node_core_keeper "https://github.com/edgexfoundry/edgex-go/blob/main/internal/core/keeper/application/registry.go"
click node_notifications "https://github.com/edgexfoundry/edgex-go/blob/main/internal/support/notifications/application/distributioncoordinator.go"
click node_notification_mqtt "https://github.com/edgexfoundry/edgex-go/blob/main/internal/support/notifications/application/channel/mqtt.go"
click node_scheduler "https://github.com/edgexfoundry/edgex-go/blob/main/internal/support/scheduler/application/action/edgexmessagebus.go"
click node_bootstrapper "https://github.com/edgexfoundry/edgex-go/blob/main/internal/security/bootstrapper/main.go"
click node_secret_store "https://github.com/edgexfoundry/edgex-go/blob/main/internal/security/secretstore/main.go"
click node_proxy_auth "https://github.com/edgexfoundry/edgex-go/blob/main/internal/security/proxyauth/application/key.go"
click node_security_proxy "https://github.com/edgexfoundry/edgex-go/blob/main/cmd/security-proxy-auth/main.go"
click node_openapi "https://github.com/edgexfoundry/edgex-go/blob/main/openapi/core-data.yaml"
click node_postgres "https://github.com/edgexfoundry/edgex-go/blob/main/internal/pkg/db/postgres/client.go"
click node_redis "https://github.com/edgexfoundry/edgex-go/blob/main/internal/pkg/infrastructure/redis/kv.go"

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_core_metadata_api,node_core_metadata_app,node_core_metadata_db,node_core_data_ingest,node_core_data_app,node_core_data_schema,node_core_command_http,node_core_command_app,node_core_command_bus,node_core_keeper toneBlue
class node_notifications,node_notification_mqtt,node_scheduler toneAmber
class node_bootstrapper,node_secret_store,node_proxy_auth,node_security_proxy toneMint
class node_openapi,node_postgres,node_redis,node_message_bus,node_device_endpoints toneRose
```

## Components

### Core services

Device registry, telemetry, commands, and shared state.

- [Core Metadata API](https://github.com/edgexfoundry/edgex-go/blob/main/internal/core/metadata/controller/http/device.go): Go service · Owns device identities, profiles, commands, and provisioning. · `internal/core/metadata/controller/http/device.go`
- [Metadata application](https://github.com/edgexfoundry/edgex-go/blob/main/internal/core/metadata/application/device.go): application layer · `internal/core/metadata/application/device.go`
- [Metadata DB wiring](https://github.com/edgexfoundry/edgex-go/blob/main/internal/core/metadata/container/database.go): container · `internal/core/metadata/container/database.go`
- [Core Data ingestion](https://github.com/edgexfoundry/edgex-go/blob/main/internal/core/data/controller/messaging/subscriber.go): messaging controller · Consumes telemetry from the message bus. · `internal/core/data/controller/messaging/subscriber.go`
- [Telemetry aggregation](https://github.com/edgexfoundry/edgex-go/blob/main/internal/core/data/application/readingagg.go): application layer · Persists, queries, and aggregates readings. · `internal/core/data/application/readingagg.go`
- [Core Data schema](https://github.com/edgexfoundry/edgex-go/blob/main/internal/core/data/embed/sql/idempotent/01-tables.sql): embedded SQL · `internal/core/data/embed/sql/idempotent/01-tables.sql`
- [Core Command API](https://github.com/edgexfoundry/edgex-go/blob/main/internal/core/command/controller/http/command.go): HTTP controller · Command invocation boundary. · `internal/core/command/controller/http/command.go`
- [Command application](https://github.com/edgexfoundry/edgex-go/blob/main/internal/core/command/application/command.go): application layer · `internal/core/command/application/command.go`
- [Command messaging](https://github.com/edgexfoundry/edgex-go/blob/main/internal/core/command/controller/messaging/external.go): messaging controller · Handles external command messages. · `internal/core/command/controller/messaging/external.go`
- [Core Keeper registry](https://github.com/edgexfoundry/edgex-go/blob/main/internal/core/keeper/application/registry.go): application layer · Registry and key-value APIs. · `internal/core/keeper/application/registry.go`

### Support services

Notification delivery and scheduled automation.

- [Notifications coordinator](https://github.com/edgexfoundry/edgex-go/blob/main/internal/support/notifications/application/distributioncoordinator.go): application layer · Stores and distributes notifications and transmissions. · `internal/support/notifications/application/distributioncoordinator.go`
- [MQTT notification channel](https://github.com/edgexfoundry/edgex-go/blob/main/internal/support/notifications/application/channel/mqtt.go): delivery channel · `internal/support/notifications/application/channel/mqtt.go`
- [Scheduler bus actions](https://github.com/edgexfoundry/edgex-go/blob/main/internal/support/scheduler/application/action/edgexmessagebus.go): scheduled action · Executes scheduled EdgeX message-bus actions. · `internal/support/scheduler/application/action/edgexmessagebus.go`

### Security and bootstrap

Secure access and dependency orchestration.

- [Security bootstrapper](https://github.com/edgexfoundry/edgex-go/blob/main/internal/security/bootstrapper/main.go): startup orchestrator · Prepares secure dependencies and waits for readiness. · `internal/security/bootstrapper/main.go`
- [Secret store service](https://github.com/edgexfoundry/edgex-go/blob/main/internal/security/secretstore/main.go): security utility · `internal/security/secretstore/main.go`
- [Proxy authorization](https://github.com/edgexfoundry/edgex-go/blob/main/internal/security/proxyauth/application/key.go): security application · Manages proxy authorization keys. · `internal/security/proxyauth/application/key.go`
- [Security proxy binary](https://github.com/edgexfoundry/edgex-go/blob/main/cmd/security-proxy-auth/main.go): Go executable · Routes secured external requests. · `cmd/security-proxy-auth/main.go`

### Platform boundaries

Shared runtime infrastructure and public contracts.

- [Core Data OpenAPI](https://github.com/edgexfoundry/edgex-go/blob/main/openapi/core-data.yaml): public contract · `openapi/core-data.yaml`
- [PostgreSQL](https://github.com/edgexfoundry/edgex-go/blob/main/internal/pkg/db/postgres/client.go): durable persistence · System of record for service data. · `internal/pkg/db/postgres/client.go`
- [Redis state](https://github.com/edgexfoundry/edgex-go/blob/main/internal/pkg/infrastructure/redis/kv.go): cache and KV · `internal/pkg/infrastructure/redis/kv.go`
- **EdgeX message bus**: event transport · NATS is an optional build-time implementation.
- **Device services**: device boundary · Provide telemetry and command execution.

## Connections

- Security proxy binary → Proxy authorization: authorizes via
- Proxy authorization → Secret store service: stores keys in
- Security bootstrapper → Secret store service: provisions
- Security bootstrapper → PostgreSQL: waits/configures
- Security bootstrapper → Redis state: waits/configures
- Security bootstrapper → EdgeX message bus: waits/configures
- Security proxy binary → Core Metadata API: secured REST
- Security proxy binary → Core Command API: secured REST
- Core Data OpenAPI → Core Data ingestion: documents Core Data
- Core Metadata API → Metadata application: routes to
- Metadata application → Metadata DB wiring: uses
- Metadata DB wiring → PostgreSQL: persists
- Core Data ingestion → Telemetry aggregation: delivers readings
- EdgeX message bus → Core Data ingestion: telemetry events
- Telemetry aggregation → Core Data schema: initializes
- Telemetry aggregation → PostgreSQL: persists events
- Telemetry aggregation → Redis state: uses cache
- Core Command API → Command application: invokes
- Command messaging → Command application: routes messages
- Command application → EdgeX message bus: publishes commands
- Command application → Device services: executes commands
- Core Keeper registry → PostgreSQL: registry persistence
- Core Keeper registry → Redis state: key-value state
- Notifications coordinator → PostgreSQL: stores delivery state
- Notifications coordinator → MQTT notification channel: dispatches through
- Scheduler bus actions → EdgeX message bus: executes bus actions
