How edgexfoundry/edgex-go works
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: client.go PostgreSQL · main.go Security bootstrapper · readingagg.go Telemetry aggregation · command.go Command application
Components 22
Core services
Device registry, telemetry, commands, and shared state.
- Core Metadata API · Owns device identities, profiles, commands, and provisioning.
internal/core/metadata/controller/http/device.go - Metadata application
internal/core/metadata/application/device.go - Metadata DB wiring
internal/core/metadata/container/database.go - Core Data ingestion · Consumes telemetry from the message bus.
internal/core/data/controller/messaging/subscriber.go - Telemetry aggregation · Persists, queries, and aggregates readings.
internal/core/data/application/readingagg.go - Core Data schema
internal/core/data/embed/sql/idempotent/01-tables.sql - Core Command API · Command invocation boundary.
internal/core/command/controller/http/command.go - Command application
internal/core/command/application/command.go - Command messaging · Handles external command messages.
internal/core/command/controller/messaging/external.go - Core Keeper registry · Registry and key-value APIs.
internal/core/keeper/application/registry.go
Support services
Notification delivery and scheduled automation.
- Notifications coordinator · Stores and distributes notifications and transmissions.
internal/support/notifications/application/distributioncoordinator.go - MQTT notification channel
internal/support/notifications/application/channel/mqtt.go - Scheduler bus actions · Executes scheduled EdgeX message-bus actions.
internal/support/scheduler/application/action/edgexmessagebus.go
Security and bootstrap
Secure access and dependency orchestration.
- Security bootstrapper · Prepares secure dependencies and waits for readiness.
internal/security/bootstrapper/main.go - Secret store service
internal/security/secretstore/main.go - Proxy authorization · Manages proxy authorization keys.
internal/security/proxyauth/application/key.go - Security proxy binary · Routes secured external requests.
cmd/security-proxy-auth/main.go
Platform boundaries
Shared runtime infrastructure and public contracts.
- Core Data OpenAPI
openapi/core-data.yaml - PostgreSQL · System of record for service data.
internal/pkg/db/postgres/client.go - Redis state
internal/pkg/infrastructure/redis/kv.go - EdgeX message bus · NATS is an optional build-time implementation.
- Device services · Provide telemetry and command execution.
Connections 26
- 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