gocell

package module
v0.0.0-...-85b4cba Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 2 Imported by: 0

README

GoCell

Cell-native Go Engineering Foundation.

GoCell provides Cell/Slice runtime primitives, governance toolchain, and built-in Cells for building reliable Go services with the Slice-Cell architecture.

Quick Start (5 minutes)

git clone https://github.com/ghbvf/gocell.git
cd gocell
go run ./examples/todo-order

Open another terminal:

# Create an order
curl -s -X POST http://localhost:8082/api/v1/orders \
  -H 'Content-Type: application/json' \
  -d '{"item":"my first order"}' | jq .

# List orders
curl -s http://localhost:8082/api/v1/orders | jq .

Check the application logs — you should see event.order.created consumed.

Core Concepts

┌─────────────────────────────────────────────────┐
│  Assembly        (physical deployment unit)      │
│  ┌────────────┐  ┌────────────┐  ┌────────────┐ │
│  │ Cell       │  │ Cell       │  │ Cell       │ │
│  │ ┌────────┐ │  │ ┌────────┐ │  │ ┌────────┐ │ │
│  │ │ Slice  │ │  │ │ Slice  │ │  │ │ Slice  │ │ │
│  │ └────────┘ │  │ └────────┘ │  │ └────────┘ │ │
│  │ ┌────────┐ │  │ ┌────────┐ │  │ ┌────────┐ │ │
│  │ │ Slice  │ │  │ │ Slice  │ │  │ │ Slice  │ │ │
│  │ └────────┘ │  │ └────────┘ │  │ └────────┘ │ │
│  └──────┬─────┘  └──────┬─────┘  └──────┬─────┘ │
│         └───── Contract ─┘───── Contract ┘       │
└─────────────────────────────────────────────────┘
Concept Description
Cell Independent domain unit with lifecycle (Init/Start/Stop/Health). Types: core, edge, support.
Slice A single responsibility within a Cell (e.g., session-login, order-create).
Contract Cross-Cell communication boundary (HTTP, event, command). Cells never import each other directly.
Assembly Physical deployment — groups Cells into a runnable binary.
Journey End-to-end acceptance specification spanning multiple Cells and Contracts.
Consistency Levels (L0-L4)
Level Name Pattern Example
L0 LocalOnly Single slice, no side effects Validation, computation
L1 LocalTx Single cell transaction Session creation
L2 OutboxFact Transaction + outbox event Order creation + event publish
L3 WorkflowEventual Cross-cell eventual consistency Audit trail, projections
L4 DeviceLatent High-latency device loop Command → ack with timeout

30-Minute Tutorial: Create Your First Cell

Follow these steps to create a custom Cell from scratch.

Step 1: Create Cell directory and metadata
mkdir -p cells/my-cell/slices/myaction

Create cells/my-cell/cell.yaml:

id: my-cell
type: core
consistencyLevel: L1
owner:
  team: my-team
  role: my-owner
schema:
  primary: my_table
verify:
  smoke:
    - my-cell/smoke

Create cells/my-cell/slices/myaction/slice.yaml:

id: myaction
belongsToCell: my-cell
contractUsages:
  - contract: http.my-api.v1
    role: serve
verify:
  unit: myaction/unit
  contract: myaction/contract
Step 2: Define the domain

Create cells/my-cell/internal/domain/model.go:

package domain

type Item struct {
    ID   string
    Name string
}

type ItemRepository interface {
    Create(ctx context.Context, item *Item) error
    GetByID(ctx context.Context, id string) (*Item, error)
}
Step 3: Implement the Cell

Create cells/my-cell/cell.go:

package mycell

import (
    "context"
    "log/slog"
    "github.com/ghbvf/gocell/kernel/cell"
)

type MyCell struct {
    *cell.BaseCell
    logger *slog.Logger
}

func New() *MyCell {
    return &MyCell{
        BaseCell: cell.NewBaseCell(cell.CellMetadata{
            ID: "my-cell", Type: cell.CellTypeCore,
            ConsistencyLevel: cell.L1,
            Owner: cell.Owner{Team: "my-team", Role: "my-owner"},
            Schema: cell.SchemaConfig{Primary: "my_table"},
            Verify: cell.CellVerify{Smoke: []string{"my-cell/smoke"}},
        }),
        logger: slog.Default(),
    }
}

func (c *MyCell) Init(ctx context.Context, deps cell.Dependencies) error {
    return c.BaseCell.Init(ctx, deps)
}

func (c *MyCell) RegisterRoutes(mux cell.RouteMux) {
    mux.Handle("GET /api/v1/hello", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
        w.Write([]byte(`{"message":"hello from my-cell"}`))
    }))
}
Step 4: Create a main.go
package main

import (
    "context"
    "os/signal"
    "syscall"

    mycell "github.com/ghbvf/gocell/cells/my-cell"
    "github.com/ghbvf/gocell/kernel/assembly"
    "github.com/ghbvf/gocell/runtime/bootstrap"
)

func main() {
    ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
    defer cancel()

    asm := assembly.New(assembly.Config{ID: "my-app", DurabilityMode: cell.DurabilityDemo})
    asm.Register(mycell.New())

    app := bootstrap.New(
        bootstrap.WithAssembly(asm),
        bootstrap.WithHTTPAddr(":8080"),
    )
    app.Run(ctx)
}
Step 5: Build and run
go build ./cmd/my-app && ./my-app
# In another terminal:
curl http://localhost:8080/api/v1/hello
# {"message":"hello from my-cell"}

Example Projects

Example Complexity What it demonstrates
todo-order Medium Custom Cell, CRUD, outbox event publish, RabbitMQ consume
sso-bff Medium-High 3 built-in Cells composition (access + audit + config)
iot-device High L4 DeviceLatent: command queue, ack, high-latency loop

Runtime Modes

GoCell assemblies must declare a DurabilityMode explicitly (zero value is rejected):

Mode Value Noop Allowed Use Case
DurabilityDemo 1 Yes — NoopWriter, NoopTxRunner, DiscardPublisher accepted Development, unit tests, examples
DurabilityDurable 2 No — CheckNotNoop rejects at Init() Production (cmd/core-bundle)
// Production
asm := assembly.New(assembly.Config{ID: "prod", DurabilityMode: cell.DurabilityDurable})

// Development / tests
asm := assembly.New(assembly.Config{ID: "dev", DurabilityMode: cell.DurabilityDemo})

Architecture

├── kernel/       — Cell/Slice runtime + governance tools (framework core)
├── cells/        — Cell implementations (access-core / audit-core / config-core / order-cell / device-cell)
├── contracts/    — Cross-Cell boundary contracts ({kind}/{domain}/{version}/)
├── journeys/     — Journey acceptance specs + status-board.yaml
├── runtime/      — HTTP middleware, auth, worker, observability, bootstrap
├── adapters/     — External system adapters (postgres / redis / rabbitmq / websocket / s3 / oidc)
├── pkg/          — Shared utilities (errcode / ctxkeys / httputil / query)
├── cmd/          — CLI (gocell validate [--strict] / scaffold / generate / check / verify)
├── examples/     — Example projects (sso-bff / todo-order / iot-device)
├── templates/    — Project templates (ADR / cell-design / contract-review / runbook / postmortem / grafana)
└── generated/    — Tool-generated artifacts (indexes, derived views)
Layer Dependencies
kernel/    ← stdlib + pkg/ + gopkg.in/yaml.v3 (no runtime, adapters, cells)
runtime/   ← kernel/ + pkg/ (no cells, adapters)
cells/     ← kernel/ + runtime/ (no adapters — interface decoupling)
adapters/  ← kernel/ + runtime/ + pkg/ + external libs (no cells)
examples/  ← all layers

Built-in Cells

  • access-core — Identity management, JWT session lifecycle (RS256), RBAC authorization (7 Slices)
  • audit-core — Tamper-proof audit trail with HMAC-SHA256 hash chain (4 Slices)
  • config-core — Configuration management with versioning, publishing, and feature flags (5 Slices)

Adapters

Adapter Capabilities Kernel Interface
adapters/postgres Pool, TxManager, Migrator (goose v3), OutboxWriter, PGOutboxStore outbox.Writer, outbox.BatchWriter, runtime/outbox.Store
adapters/redis Client, DistLock, IdempotencyClaimer, Cache idempotency.Claimer
adapters/oidc Thin go-oidc v3 wrapper (Config, Provider, Refresh, Verifier, OAuth2Config)
adapters/s3 Thin aws-sdk-go-v2 wrapper (Config, Upload, Health, SDK escape hatch)
adapters/rabbitmq Publisher, Subscriber, ConsumerBase (DLQ + retry) outbox.Publisher, outbox.Subscriber
adapters/websocket WebSocket Hub, signal-first push
adapters/otel OTel SDK tracer + MetricProvider + pool collector (OTLP gRPC exporter, semconv db.client.connection.*) tracing.Tracer, kernel/observability/metrics.Provider
adapters/prometheus MetricProvider (backs runtime/outbox collectors) + LifecycleHookObserver kernel/observability/metrics.Provider, cell.LifecycleHookObserver
Outbox Wiring

The transactional outbox is split across three layers — write at the cell, store + relay loop in runtime/outbox, persistence in adapters/postgres:

// 1. Write inside the cell's business transaction (any package)
postgres.NewOutboxWriter().Write(txCtx, entry)

// 2. Compose the relay at bootstrap (cmd/core-bundle, examples, etc.)
store := postgres.NewOutboxStore(pool.DB())
relay := outbox.NewRelay(store, publisher, outbox.DefaultRelayConfig())
// relay implements worker.Worker — register with bootstrap to manage lifecycle.

runtime/outbox defines the SQL-dialect-neutral Store interface (ClaimPending / MarkPublished / MarkRetry / MarkDead / ReclaimStale / CleanupPublished / CleanupDead / OldestEligibleAt) and the Relay worker that owns the poll / reclaim / cleanup goroutines. Cleanup is data-driven: it sleeps until the next published / dead row crosses its retention window, so an idle table costs zero DB cycles.

Outbox Observability Bridge

For HTTP flows that publish through the transactional outbox, GoCell now bridges request_id, correlation_id, and optional trace_id from handler context into outbox.Entry.Metadata on the PostgreSQL write path. When the event is consumed, ObservabilityContextMiddleware (registered by bootstrap by default) restores those keys into the consumer handler context before business code runs.

For non-bootstrap usage, compose ObservabilityContextMiddleware via SubscriberWithMiddleware manually. To disable consume-side restore, pass WithDisableObservabilityRestore() to bootstrap — the publish-side metadata injection in the outbox writer remains active. When HTTP tracing is enabled, GoCell now extracts inbound traceparent and b3 headers before starting the server span so synchronous service hops preserve the same trace_id. Note: span_id is intentionally excluded across async boundaries — spans do not cross the outbox hop.

Trace Propagation

When HTTP tracing is enabled via WithTracer, GoCell automatically extracts inbound W3C traceparent and B3 headers before starting the server span. W3C takes precedence; B3 is used only as a fallback. Invalid or missing headers safely degrade to a new root trace.

Enablement — tracing is opt-in via bootstrap.WithTracer or router.WithTracer:

// bootstrap (recommended)
tracer := tracing.NewTracer("my-service")  // or adapters/otel.NewTracer(...)
app := bootstrap.New(
    bootstrap.WithAssembly(asm),
    bootstrap.WithHTTPAddr(":8080"),
    bootstrap.WithTracer(tracer),
)

// router (standalone)
r := router.New(router.WithTracer(tracer))

Trust assumption: trace header propagation assumes a trusted-upstream deployment (service-to-service behind a gateway or mesh). Public-facing edges should sanitize or ignore inbound trace headers at the gateway layer. See TRUST-POLICY-01 in docs/backlog.md for the planned public-endpoint strategy.

Framework-emitted consumer logs pick up these fields when the process uses GoCell's context-aware slog handler. This branch does not make plain slog JSON handlers automatically extract request_id, correlation_id, or trace_id. Values restored from broker metadata are validated for safe characters and length before injection into context.

Using in Your Project

# Set up Go private module access
export GOPRIVATE=github.com/ghbvf/gocell

# Add to your project
go get github.com/ghbvf/gocell@latest

Project Templates

GoCell includes templates for common engineering documents:

  • templates/adr.md — Architecture Decision Record
  • templates/cell-design.md — Cell design document
  • templates/contract-review.md — Contract review checklist
  • templates/runbook.md — Operations runbook
  • templates/postmortem.md — Incident postmortem
  • templates/grafana-dashboard.json — Grafana monitoring dashboard

License

MIT

Documentation

Overview

Package gocell provides the top-level entry point for the GoCell framework.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAssembly

func NewAssembly(id string) *assembly.CoreAssembly

NewAssembly creates a new CoreAssembly with the given identifier.

Types

This section is empty.

Directories

Path Synopsis
adapters
circuitbreaker
Package circuitbreaker provides a sony/gobreaker adapter that implements the runtime/http/middleware.Allower interface.
Package circuitbreaker provides a sony/gobreaker adapter that implements the runtime/http/middleware.Allower interface.
oidc
Package oidc provides a thin adapter over coreos/go-oidc v3 and golang.org/x/oauth2 for OpenID Connect authentication.
Package oidc provides a thin adapter over coreos/go-oidc v3 and golang.org/x/oauth2 for OpenID Connect authentication.
otel
Package otel provides an OpenTelemetry adapter that implements the runtime/observability/tracing.Tracer interface using the OTel SDK.
Package otel provides an OpenTelemetry adapter that implements the runtime/observability/tracing.Tracer interface using the OTel SDK.
postgres
Package postgres provides a PostgreSQL adapter for the GoCell framework.
Package postgres provides a PostgreSQL adapter for the GoCell framework.
prometheus
Package prometheus provides a Prometheus backend for the provider-neutral metrics abstraction defined in kernel/observability/metrics, plus a direct cell.LifecycleHookObserver implementation for assembly hook metrics.
Package prometheus provides a Prometheus backend for the provider-neutral metrics abstraction defined in kernel/observability/metrics, plus a direct cell.LifecycleHookObserver implementation for assembly hook metrics.
rabbitmq
Package rabbitmq provides a RabbitMQ adapter for the GoCell event bus.
Package rabbitmq provides a RabbitMQ adapter for the GoCell event bus.
ratelimit
Package ratelimit provides a token-bucket rate limiter adapter that implements the runtime/http/middleware.RateLimiter and WindowedRateLimiter interfaces using golang.org/x/time/rate.
Package ratelimit provides a token-bucket rate limiter adapter that implements the runtime/http/middleware.RateLimiter and WindowedRateLimiter interfaces using golang.org/x/time/rate.
redis
Package redis provides a Redis adapter for the GoCell framework.
Package redis provides a Redis adapter for the GoCell framework.
s3
Package s3 provides a thin adapter over aws-sdk-go-v2 for S3-compatible object storage.
Package s3 provides a thin adapter over aws-sdk-go-v2 for S3-compatible object storage.
vault
Package vault provides a HashiCorp Vault Transit adapter that implements the kernel/crypto.KeyProvider interface.
Package vault provides a HashiCorp Vault Transit adapter that implements the kernel/crypto.KeyProvider interface.
websocket
Package websocket provides an nhooyr.io/websocket binding for the runtime/websocket.Conn interface.
Package websocket provides an nhooyr.io/websocket binding for the runtime/websocket.Conn interface.
cells
access-core
Package accesscore implements the access-core Cell: identity management, session lifecycle (login/refresh/logout/validate), RBAC authorization, and role queries.
Package accesscore implements the access-core Cell: identity management, session lifecycle (login/refresh/logout/validate), RBAC authorization, and role queries.
access-core/internal/domain
Package domain contains the access-core Cell domain models.
Package domain contains the access-core Cell domain models.
access-core/internal/dto
Package dto provides handler-level response types for access-core, shared across slices that return the same entity shape.
Package dto provides handler-level response types for access-core, shared across slices that return the same entity shape.
access-core/internal/mem
Package mem provides in-memory repository implementations for access-core.
Package mem provides in-memory repository implementations for access-core.
access-core/internal/ports
Package ports defines the driven-side interfaces for access-core.
Package ports defines the driven-side interfaces for access-core.
access-core/slices/authorizationdecide
Package authorizationdecide implements the authorization-decide slice: RBAC-based authorization decisions.
Package authorizationdecide implements the authorization-decide slice: RBAC-based authorization decisions.
access-core/slices/configreceive
Package configreceive implements the config-receive slice: consumes config change events from config-core.
Package configreceive implements the config-receive slice: consumes config change events from config-core.
access-core/slices/identitymanage
Package identitymanage implements the identity-manage slice: CRUD + Lock/Unlock user accounts.
Package identitymanage implements the identity-manage slice: CRUD + Lock/Unlock user accounts.
access-core/slices/rbaccheck
Package rbaccheck implements the rbac-check slice: HasRole / ListRoles queries for a given user.
Package rbaccheck implements the rbac-check slice: HasRole / ListRoles queries for a given user.
access-core/slices/sessionlogin
Package sessionlogin implements the session-login slice: password-based login with JWT issuance.
Package sessionlogin implements the session-login slice: password-based login with JWT issuance.
access-core/slices/sessionlogout
Package sessionlogout implements the session-logout slice: revokes sessions and publishes revocation events.
Package sessionlogout implements the session-logout slice: revokes sessions and publishes revocation events.
access-core/slices/sessionrefresh
Package sessionrefresh implements the session-refresh slice: validates a refresh token and issues a new JWT token pair.
Package sessionrefresh implements the session-refresh slice: validates a refresh token and issues a new JWT token pair.
access-core/slices/sessionvalidate
Package sessionvalidate implements the session-validate slice: verifies access tokens and returns Claims.
Package sessionvalidate implements the session-validate slice: verifies access tokens and returns Claims.
audit-core
Package auditcore implements the audit-core Cell: tamper-evident audit log with hash chain, event consumption, integrity verification, and query.
Package auditcore implements the audit-core Cell: tamper-evident audit log with hash chain, event consumption, integrity verification, and query.
audit-core/internal/adapters/postgres
Package postgres provides a PostgreSQL implementation of audit-core ports.
Package postgres provides a PostgreSQL implementation of audit-core ports.
audit-core/internal/adapters/s3archive
Package s3archive provides an S3-backed implementation of the audit-core ArchiveStore port.
Package s3archive provides an S3-backed implementation of the audit-core ArchiveStore port.
audit-core/internal/domain
Package domain contains the audit-core Cell domain models.
Package domain contains the audit-core Cell domain models.
audit-core/internal/mem
Package mem provides in-memory repository implementations for audit-core.
Package mem provides in-memory repository implementations for audit-core.
audit-core/internal/ports
Package ports defines the driven-side interfaces for audit-core.
Package ports defines the driven-side interfaces for audit-core.
audit-core/slices/auditappend
Package auditappend implements the audit-append slice: consumes events from 6 topics and appends them to the hash chain.
Package auditappend implements the audit-append slice: consumes events from 6 topics and appends them to the hash chain.
audit-core/slices/auditarchive
Package auditarchive implements the audit-archive slice: stub implementation for Phase 2.
Package auditarchive implements the audit-archive slice: stub implementation for Phase 2.
audit-core/slices/auditquery
Package auditquery implements the audit-query slice: query audit entries via HTTP.
Package auditquery implements the audit-query slice: query audit entries via HTTP.
audit-core/slices/auditverify
Package auditverify implements the audit-verify slice: verifies hash chain integrity and publishes verification results.
Package auditverify implements the audit-verify slice: verifies hash chain integrity and publishes verification results.
config-core
Package configcore implements the config-core Cell: configuration management with versioning, publishing, rollback, and feature flag evaluation.
Package configcore implements the config-core Cell: configuration management with versioning, publishing, rollback, and feature flag evaluation.
config-core/internal/adapters/postgres
Package postgres provides a PostgreSQL implementation of config-core ports.
Package postgres provides a PostgreSQL implementation of config-core ports.
config-core/internal/crypto
Package crypto provides config-core-specific crypto helpers.
Package crypto provides config-core-specific crypto helpers.
config-core/internal/domain
Package domain contains the config-core Cell domain models.
Package domain contains the config-core Cell domain models.
config-core/internal/dto
Package dto provides shared handler-level data transfer objects for config-core.
Package dto provides shared handler-level data transfer objects for config-core.
config-core/internal/mem
Package mem provides in-memory repository implementations for config-core.
Package mem provides in-memory repository implementations for config-core.
config-core/internal/ports
Package ports defines the driven-side interfaces for config-core.
Package ports defines the driven-side interfaces for config-core.
config-core/slices/configpublish
Package configpublish implements the config-publish slice: Publish/Rollback versioned config snapshots.
Package configpublish implements the config-publish slice: Publish/Rollback versioned config snapshots.
config-core/slices/configread
Package configread implements the config-read slice: Get/List config entries.
Package configread implements the config-read slice: Get/List config entries.
config-core/slices/configsubscribe
Package configsubscribe implements the config-subscribe slice: consumes config change events to update a local cache.
Package configsubscribe implements the config-subscribe slice: consumes config change events to update a local cache.
config-core/slices/configwrite
Package configwrite implements the config-write slice: Create/Update/Delete config entries with event publishing.
Package configwrite implements the config-write slice: Create/Update/Delete config entries with event publishing.
config-core/slices/featureflag
Package featureflag implements the feature-flag slice: Get/Evaluate feature flags.
Package featureflag implements the feature-flag slice: Get/Evaluate feature flags.
config-core/slices/flagwrite
Package flagwrite implements the flag-write slice: Create/Update/Delete/Toggle feature flags with transactional outbox event publishing (L2 consistency).
Package flagwrite implements the flag-write slice: Create/Update/Delete/Toggle feature flags with transactional outbox event publishing (L2 consistency).
device-cell
Package devicecell implements the device-cell Cell for the iot-device example.
Package devicecell implements the device-cell Cell for the iot-device example.
device-cell/internal/domain
Package domain defines the core domain model for the device-cell example.
Package domain defines the core domain model for the device-cell example.
device-cell/internal/mem
Package mem provides in-memory implementations of the device domain repositories.
Package mem provides in-memory implementations of the device domain repositories.
device-cell/slices/devicecommand
Package devicecommand implements the device-command slice: enqueuing commands for devices, polling pending commands, and acknowledging execution.
Package devicecommand implements the device-command slice: enqueuing commands for devices, polling pending commands, and acknowledging execution.
device-cell/slices/deviceregister
Package deviceregister implements the device-register slice: registering devices and publishing device.registered events.
Package deviceregister implements the device-register slice: registering devices and publishing device.registered events.
device-cell/slices/devicestatus
Package devicestatus implements the device-status slice: querying device status.
Package devicestatus implements the device-status slice: querying device status.
order-cell
Package ordercell implements the order-cell Cell for the todo-order example.
Package ordercell implements the order-cell Cell for the todo-order example.
order-cell/internal/domain
Package domain defines the core domain model for the order-cell example.
Package domain defines the core domain model for the order-cell example.
order-cell/internal/mem
Package mem provides an in-memory implementation of the order domain repository.
Package mem provides an in-memory implementation of the order domain repository.
order-cell/slices/ordercreate
Package ordercreate implements the order-create slice: creating orders and publishing order.created events via the transactional outbox pattern.
Package ordercreate implements the order-create slice: creating orders and publishing order.created events via the transactional outbox pattern.
order-cell/slices/orderquery
Package orderquery implements the order-query slice: reading orders.
Package orderquery implements the order-query slice: reading orders.
cmd
core-bundle command
Package main is the entry point for the core-bundle assembly.
Package main is the entry point for the core-bundle assembly.
gocell command
Command gocell is the GoCell metadata / scaffolding CLI entry point.
Command gocell is the GoCell metadata / scaffolding CLI entry point.
gocell/app
Package app implements the gocell CLI command dispatch.
Package app implements the gocell CLI command dispatch.
examples
iot-device command
Package main is the entry point for the iot-device example application.
Package main is the entry point for the iot-device example application.
sso-bff command
Package main is the entry point for the sso-bff example application.
Package main is the entry point for the sso-bff example application.
todo-order command
Package main is the entry point for the todo-order example application.
Package main is the entry point for the todo-order example application.
kernel
assembly
Package assembly provides the CoreAssembly that orchestrates Cell lifecycle (register, start, stop, health).
Package assembly provides the CoreAssembly that orchestrates Cell lifecycle (register, start, stop, health).
cell
Package cell defines the core Cell and Slice abstractions for the GoCell framework: interfaces, base implementations, metadata types, consistency levels, and the Cell registrar.
Package cell defines the core Cell and Slice abstractions for the GoCell framework: interfaces, base implementations, metadata types, consistency levels, and the Cell registrar.
cell/celltest
Package celltest provides test utilities for kernel/cell types.
Package celltest provides test utilities for kernel/cell types.
crypto
Package crypto defines the kernel-level cryptographic interfaces: KeyProvider, KeyHandle, ValueTransformer, and CurrentKeyIDProvider.
Package crypto defines the kernel-level cryptographic interfaces: KeyProvider, KeyHandle, ValueTransformer, and CurrentKeyIDProvider.
governance
Package governance implements validation rules for GoCell metadata.
Package governance implements validation rules for GoCell metadata.
idempotency
Package idempotency defines the consumer-side idempotency interface.
Package idempotency defines the consumer-side idempotency interface.
journey
Package journey provides query access to Journey metadata and status.
Package journey provides query access to Journey metadata and status.
lifecycle
Package lifecycle provides the ContextCloser interface and adapters for managing resource teardown with context-aware shutdown budgets.
Package lifecycle provides the ContextCloser interface and adapters for managing resource teardown with context-aware shutdown budgets.
metadata
Package metadata provides a parser that loads all GoCell YAML descriptors (cell.yaml, slice.yaml, contract.yaml, assembly.yaml, journey.yaml) from a project root and produces a validated ProjectMeta model.
Package metadata provides a parser that loads all GoCell YAML descriptors (cell.yaml, slice.yaml, contract.yaml, assembly.yaml, journey.yaml) from a project root and produces a validated ProjectMeta model.
observability/metrics
Package metrics defines a provider-neutral metrics abstraction used by kernel modules that emit counters and histograms without importing any specific backend (Prometheus, OTel, …).
Package metrics defines a provider-neutral metrics abstraction used by kernel modules that emit counters and histograms without importing any specific backend (Prometheus, OTel, …).
outbox
Package outbox defines interfaces for the transactional outbox pattern: Writer (insert within a transaction), Relay (poll-and-publish), Publisher (fire-and-forget), and Subscriber (consume).
Package outbox defines interfaces for the transactional outbox pattern: Writer (insert within a transaction), Relay (poll-and-publish), Publisher (fire-and-forget), and Subscriber (consume).
outbox/outboxtest
Package outboxtest provides a reusable conformance test suite for outbox.Publisher and outbox.Subscriber implementations.
Package outboxtest provides a reusable conformance test suite for outbox.Publisher and outbox.Subscriber implementations.
persistence
Package persistence defines shared persistence abstractions for the GoCell framework.
Package persistence defines shared persistence abstractions for the GoCell framework.
registry
Package registry provides indexed, read-only access to parsed GoCell project metadata (cells, slices, contracts).
Package registry provides indexed, read-only access to parsed GoCell project metadata (cells, slices, contracts).
scaffold
Package scaffold generates boilerplate files (cell.yaml, slice.yaml, Go source stubs) for new Cells and Slices using embedded templates.
Package scaffold generates boilerplate files (cell.yaml, slice.yaml, Go source stubs) for new Cells and Slices using embedded templates.
verify
Package verify provides metadata-driven verification runners for cells, slices, and journeys.
Package verify provides metadata-driven verification runners for cells, slices, and journeys.
worker
Package worker defines the Worker domain contract.
Package worker defines the Worker domain contract.
pkg
aeadutil
Package aeadutil provides pure AES-GCM helpers shared across runtime/crypto and adapters/vault.
Package aeadutil provides pure AES-GCM helpers shared across runtime/crypto and adapters/vault.
contracts
Package contracts defines shared schema and transport types used by both kernel/metadata (the YAML metadata model) and pkg/contracttest (the test validation helpers).
Package contracts defines shared schema and transport types used by both kernel/metadata (the YAML metadata model) and pkg/contracttest (the test validation helpers).
contracttest
Package contracttest provides schema-driven contract validation helpers for use in contract_test.go files across GoCell cells.
Package contracttest provides schema-driven contract validation helpers for use in contract_test.go files across GoCell cells.
ctxkeys
Package ctxkeys provides typed context keys and helper functions for propagating GoCell identifiers (cell, slice, correlation, journey, trace, span, request, ip) through context.Context.
Package ctxkeys provides typed context keys and helper functions for propagating GoCell identifiers (cell, slice, correlation, journey, trace, span, request, ip) through context.Context.
errcode
Package errcode provides structured error codes for the GoCell framework.
Package errcode provides structured error codes for the GoCell framework.
httputil
Package httputil provides shared HTTP response helpers for GoCell handlers, including JSON success/error writers and the standard response envelope.
Package httputil provides shared HTTP response helpers for GoCell handlers, including JSON success/error writers and the standard response envelope.
idutil
Package idutil provides shared ID validation and generation for observability-safe identifiers across kernel/ and runtime/ layers.
Package idutil provides shared ID validation and generation for observability-safe identifiers across kernel/ and runtime/ layers.
query
Package query provides utilities for constructing parameterized SQL queries.
Package query provides utilities for constructing parameterized SQL queries.
securecookie
Package securecookie encodes and decodes cookie values with HMAC-SHA256 signing and optional AES-GCM encryption using Go standard library crypto only.
Package securecookie encodes and decodes cookie values with HMAC-SHA256 signing and optional AES-GCM encryption using Go standard library crypto only.
testutil/sloghelper
Package sloghelper provides test helpers for asserting slog JSON output.
Package sloghelper provides test helpers for asserting slog JSON output.
runtime
auth
ref: go-kratos/kratos middleware/auth/auth.go — auth middleware pattern Adopted: middleware wrapping pattern, Claims extraction from context.
ref: go-kratos/kratos middleware/auth/auth.go — auth middleware pattern Adopted: middleware wrapping pattern, Claims extraction from context.
auth/config
Package config is the production wiring entrypoint for runtime/auth components.
Package config is the production wiring entrypoint for runtime/auth components.
auth/refresh
Package refresh provides the server-side opaque refresh token store interface and in-memory implementation used by the access-core session slices.
Package refresh provides the server-side opaque refresh token store interface and in-memory implementation used by the access-core session slices.
auth/refresh/memstore
Package memstore provides an in-memory implementation of refresh.Store.
Package memstore provides an in-memory implementation of refresh.Store.
auth/refresh/storetest
Package storetest provides a reusable contract test suite for refresh.Store implementations.
Package storetest provides a reusable contract test suite for refresh.Store implementations.
bootstrap
Package bootstrap orchestrates the full GoCell application lifecycle: config loading, assembly init/start, HTTP serving, event subscriptions, background workers, and graceful shutdown.
Package bootstrap orchestrates the full GoCell application lifecycle: config loading, assembly init/start, HTTP serving, event subscriptions, background workers, and graceful shutdown.
config
Package config provides a Config interface with YAML + environment variable loading.
Package config provides a Config interface with YAML + environment variable loading.
crypto
Package crypto provides the KeyProvider abstraction and implementations for encrypting sensitive values at the repository boundary.
Package crypto provides the KeyProvider abstraction and implementations for encrypting sensitive values at the repository boundary.
distlock
Package distlock defines the provider-neutral distributed-lock contract for the GoCell runtime layer.
Package distlock defines the provider-neutral distributed-lock contract for the GoCell runtime layer.
eventbus
Package eventbus provides an in-memory implementation of kernel/outbox Publisher and Subscriber for development and testing.
Package eventbus provides an in-memory implementation of kernel/outbox Publisher and Subscriber for development and testing.
eventrouter
Package eventrouter provides a Router that separates event subscription declaration from execution.
Package eventrouter provides a Router that separates event subscription declaration from execution.
http/health
Package health provides /healthz (liveness) and /readyz (readiness) HTTP endpoints.
Package health provides /healthz (liveness) and /readyz (readiness) HTTP endpoints.
http/middleware
Package middleware provides chi-compatible HTTP middleware for GoCell applications.
Package middleware provides chi-compatible HTTP middleware for GoCell applications.
http/router
Package router provides a chi-based HTTP router that implements kernel/cell.RouteMux with default middleware and automatic health/metrics endpoint registration.
Package router provides a chi-based HTTP router that implements kernel/cell.RouteMux with default middleware and automatic health/metrics endpoint registration.
observability/logging
Package logging provides a slog.Handler that enriches log records with trace_id, span_id, request_id, correlation_id, and cell_id from the request context.
Package logging provides a slog.Handler that enriches log records with trace_id, span_id, request_id, correlation_id, and cell_id from the request context.
observability/metrics
Package metrics provides HTTP request instrumentation interfaces and an in-memory implementation.
Package metrics provides HTTP request instrumentation interfaces and an in-memory implementation.
observability/poolstats
Package poolstats defines a provider-neutral connection-pool snapshot interface.
Package poolstats defines a provider-neutral connection-pool snapshot interface.
observability/tracing
Package tracing provides a Tracer interface and HTTP middleware for distributed tracing.
Package tracing provides a Tracer interface and HTTP middleware for distributed tracing.
outbox
Package outbox provides the runtime-layer Store interface and relay worker for transactional outbox delivery.
Package outbox provides the runtime-layer Store interface and relay worker for transactional outbox delivery.
outbox/outboxtest
Package outboxtest provides a public in-memory Store implementation and a Store conformance test suite for use in unit tests.
Package outboxtest provides a public in-memory Store implementation and a Store conformance test suite for use in unit tests.
shutdown
Package shutdown provides graceful shutdown support by listening for SIGINT/SIGTERM signals with a configurable timeout and ordered teardown.
Package shutdown provides graceful shutdown support by listening for SIGINT/SIGTERM signals with a configurable timeout and ordered teardown.
websocket
Package websocket provides a Hub-based WebSocket connection manager with signal-first broadcasting, ping/pong health checks, and graceful shutdown.
Package websocket provides a Hub-based WebSocket connection manager with signal-first broadcasting, ping/pong health checks, and graceful shutdown.
worker
Package worker provides a Worker interface and WorkerGroup for managing concurrent background workers with graceful lifecycle control.
Package worker provides a Worker interface and WorkerGroup for managing concurrent background workers with graceful lifecycle control.
tests
testutil
Package testutil provides shared test utilities for integration tests.
Package testutil provides shared test utilities for integration tests.
tools
archtest
Package archtest enforces Go source-level import layering rules for the GoCell architecture.
Package archtest enforces Go source-level import layering rules for the GoCell architecture.

Jump to

Keyboard shortcuts

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