examples/

directory
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2026 License: MIT

Directories

Path Synopsis
Package adapters-chi demonstrates the three-layer codec pipeline pattern using the chi router.
Package adapters-chi demonstrates the three-layer codec pipeline pattern using the chi router.
Package adapters-chi-security demonstrates authentication and authorization for REST APIs built with go-codex and the chi router adapter.
Package adapters-chi-security demonstrates authentication and authorization for REST APIs built with go-codex and the chi router adapter.
Package main demonstrates the go-codex MCP server adapter.
Package main demonstrates the go-codex MCP server adapter.
Package adapters-mqtt demonstrates the three-layer codec pipeline pattern for event-driven / MQTT applications.
Package adapters-mqtt demonstrates the three-layer codec pipeline pattern for event-driven / MQTT applications.
Package adapters-mqtt-contract demonstrates the "codec-as-contract" pattern for MQTT event-driven services.
Package adapters-mqtt-contract demonstrates the "codec-as-contract" pattern for MQTT event-driven services.
contract
Package contract is the shared API contract between producer and consumer services.
Package contract is the shared API contract between producer and consumer services.
Package adapters-mqtt-security demonstrates SecurityFunc-based authentication for MQTT subscribe channels built with go-codex.
Package adapters-mqtt-security demonstrates SecurityFunc-based authentication for MQTT subscribe channels built with go-codex.
Package adapters-mqtt5 demonstrates the MQTT 5.0 adapter and its features that are specific to MQTT 5.0, compared to the MQTT 3.1.1 adapter:
Package adapters-mqtt5 demonstrates the MQTT 5.0 adapter and its features that are specific to MQTT 5.0, compared to the MQTT 3.1.1 adapter:
Package adapters-nethttp demonstrates the three-layer codec pipeline pattern where every boundary — HTTP request, database, HTTP response — is modelled as a codec contract.
Package adapters-nethttp demonstrates the three-layer codec pipeline pattern where every boundary — HTTP request, database, HTTP response — is modelled as a codec contract.
Package adapters-nethttp-client demonstrates the HTTP client-side adapter.
Package adapters-nethttp-client demonstrates the HTTP client-side adapter.
contract
Package contract defines the shared HTTP API contract for the adapters-nethttp-client example.
Package contract defines the shared HTTP API contract for the adapters-nethttp-client example.
Package adapters-nethttp-security demonstrates authentication and authorization for REST APIs built with go-codex and the net/http adapter.
Package adapters-nethttp-security demonstrates authentication and authorization for REST APIs built with go-codex and the net/http adapter.
Package adapters-sse demonstrates Server-Sent Events (SSE) using the go-codex adapters/nethttp and adapters/chi adapters.
Package adapters-sse demonstrates Server-Sent Events (SSE) using the go-codex adapters/nethttp and adapters/chi adapters.
Package main demonstrates two templ + go-codex patterns on a single server:
Package main demonstrates two templ + go-codex patterns on a single server:
Package main demonstrates how go-codex fits into a templ-based rendering pipeline using the adapters/templ format plug-in.
Package main demonstrates how go-codex fits into a templ-based rendering pipeline using the adapters/templ format plug-in.
Package adapters-zeromq demonstrates the ZeroMQ PUB/SUB adapter using go-codex's api/events channel declarations.
Package adapters-zeromq demonstrates the ZeroMQ PUB/SUB adapter using go-codex's api/events channel declarations.
Package adapters-zeromq-dealer-router demonstrates the ZeroMQ DEALER/ROUTER adapter pattern using go-codex's api/rest route declarations.
Package adapters-zeromq-dealer-router demonstrates the ZeroMQ DEALER/ROUTER adapter pattern using go-codex's api/rest route declarations.
Package adapters-zeromq-reqrep demonstrates the ZeroMQ REQ/REP adapter using go-codex's api/rest route declarations.
Package adapters-zeromq-reqrep demonstrates the ZeroMQ REQ/REP adapter using go-codex's api/rest route declarations.
Package api-events demonstrates the api/events builder: define channels with codec-backed payload types, get typed Decode/Encode helpers, and generate a full AsyncAPI 3.0 spec — all without importing any messaging library.
Package api-events demonstrates the api/events builder: define channels with codec-backed payload types, get typed Decode/Encode helpers, and generate a full AsyncAPI 3.0 spec — all without importing any messaging library.
Package api-rest demonstrates the api/rest builder: define routes with codec-backed types, get typed Decode/Encode helpers, and generate a full OpenAPI 3.1 spec — all without importing net/http or any HTTP framework.
Package api-rest demonstrates the api/rest builder: define routes with codec-backed types, get typed Decode/Encode helpers, and generate a full OpenAPI 3.1 spec — all without importing net/http or any HTTP framework.
Package main demonstrates using go-codex for CLI tool configuration: loading a TOML config file and overlaying environment variable overrides.
Package main demonstrates using go-codex for CLI tool configuration: loading a TOML config file and overlaying environment variable overrides.
Package main demonstrates three patterns for reusing and transforming codecs without repeating constraint definitions.
Package main demonstrates three patterns for reusing and transforming codecs without repeating constraint definitions.
Package decode-errors demonstrates multi-field validation errors in go-codex.
Package decode-errors demonstrates multi-field validation errors in go-codex.
Package enum-union-sum shows how go-codex handles the three key type-modeling patterns from Go: iota enums, union types, and sum types (discriminated unions).
Package enum-union-sum shows how go-codex handles the three key type-modeling patterns from Go: iota enums, union types, and sum types (discriminated unions).
Package main demonstrates format.FromEnv: loading application configuration exclusively from environment variables using the codec as the single source of truth for field names, types, validations, and documentation.
Package main demonstrates format.FromEnv: loading application configuration exclusively from environment variables using the codec as the single source of truth for field names, types, validations, and documentation.
Package error-types demonstrates every structured error type in go-codex.
Package error-types demonstrates every structured error type in go-codex.
Package event-driven demonstrates generating a full AsyncAPI 3.0 document from channel descriptors and Codec-derived schemas using the render/asyncapi/v3 package.
Package event-driven demonstrates generating a full AsyncAPI 3.0 document from channel descriptors and Codec-derived schemas using the render/asyncapi/v3 package.
Package main demonstrates format.File: the declarative typed file descriptor for reading, writing, and updating files with full codec validation.
Package main demonstrates format.File: the declarative typed file descriptor for reading, writing, and updating files with full codec validation.
Package main demonstrates flat dotted-key JSON patching with go-codex.
Package main demonstrates flat dotted-key JSON patching with go-codex.
Package forge-collection demonstrates forge collection operations applied to a batch of MQTT-style sensor temperature readings.
Package forge-collection demonstrates forge collection operations applied to a batch of MQTT-style sensor temperature readings.
Package main demonstrates the forge package for signed, governed KPI computation.
Package main demonstrates the forge package for signed, governed KPI computation.
Package formats demonstrates the builtin format constraints in validate/, as well as WithExample, WithDeprecated, and the Duration codec.
Package formats demonstrates the builtin format constraints in validate/, as well as WithExample, WithDeprecated, and the Duration codec.
Package gob-contract demonstrates the "Go library as contract" pattern.
Package gob-contract demonstrates the "Go library as contract" pattern.
contract
Package contract is the shared API contract between producer and consumer services.
Package contract is the shared API contract between producer and consumer services.
Package main demonstrates where go-codex shines in a comment moderation use case: a single codec definition simultaneously escapes HTML, enforces length limits, and documents the schema — all derived from one value.
Package main demonstrates where go-codex shines in a comment moderation use case: a single codec definition simultaneously escapes HTML, enforces length limits, and documents the schema — all derived from one value.
Package http-trace-span-propagation demonstrates trace span propagation across HTTP, forge, and file I/O layers using the observer pattern.
Package http-trace-span-propagation demonstrates trace span propagation across HTTP, forge, and file I/O layers using the observer pattern.
Package oee-chain demonstrates the three-layer go-codex architecture end-to-end:
Package oee-chain demonstrates the three-layer go-codex architecture end-to-end:
Package openapi demonstrates generating an OpenAPI components/schemas section from Codec definitions using the render/openapi package.
Package openapi demonstrates generating an OpenAPI components/schemas section from Codec definitions using the render/openapi package.
Package png-upload demonstrates how to define REST routes for PNG binary transfer using go-codex:
Package png-upload demonstrates how to define REST routes for PNG binary transfer using go-codex:
Package rest-api demonstrates generating a full OpenAPI 3.1 document from route descriptors and Codec-derived schemas using the render/openapi package.
Package rest-api demonstrates generating a full OpenAPI 3.1 document from route descriptors and Codec-derived schemas using the render/openapi package.
Command sensor-service is the go-codex flagship example: a small but complete sensor-readings service structured as a real project, with each concern in its own package:
Command sensor-service is the go-codex flagship example: a small but complete sensor-readings service structured as a real project, with each concern in its own package:
adapters
Package adapters holds the sensor service's infrastructure edge: the mock MQTT client used for the demo, the SQL-backed ReadingStore, and the HTTP handler factories.
Package adapters holds the sensor service's infrastructure edge: the mock MQTT client used for the demo, the SQL-backed ReadingStore, and the HTTP handler factories.
db
domain
Package domain is Layer 1 + Layer 2 of the sensor service: models, codecs, and pure business rules.
Package domain is Layer 1 + Layer 2 of the sensor service: models, codecs, and pure business rules.
ioports
Package ioports declares every IO boundary of the sensor service as a protocol-agnostic port or route — the service's complete IO surface, readable as a compact spec, with ZERO adapter imports.
Package ioports declares every IO boundary of the sensor service as a protocol-agnostic port or route — the service's complete IO surface, readable as a compact spec, with ZERO adapter imports.
observability
Package observability holds the cross-cutting observer for the sensor service.
Package observability holds the cross-cutting observer for the sensor service.
pipeline
Package pipeline is the sensor service's business logic layer: forge functions and the stream topology.
Package pipeline is the sensor service's business logic layer: forge functions and the stream topology.
Package stats-observer demonstrates how to use stats.ValidationObserver and stats.ReportErrors with codecs directly — without any HTTP or MQTT adapter.
Package stats-observer demonstrates how to use stats.ValidationObserver and stats.ReportErrors with codecs directly — without any HTTP or MQTT adapter.
Package stream-oee demonstrates how to govern OEE computation with forge and bridge it to a reactive machine event stream using the stream package.
Package stream-oee demonstrates how to govern OEE computation with forge and bridge it to a reactive machine event stream using the stream package.
Package stream-pipeline demonstrates the go-codex stream package across eight sections, each showcasing a different group of operators.
Package stream-pipeline demonstrates the go-codex stream package across eight sections, each showcasing a different group of operators.
Package main shows how to use Codec.Validate and Format.Validate for explicit bidirectional validation.
Package main shows how to use Codec.Validate and Format.Validate for explicit bidirectional validation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL