Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.goakt.dev/llms.txt

Use this file to discover all available pages before exploring further.

A guided tour of the codebase. Start with actor/—everything flows from there.

Top-level layout

PackagePurpose
actor/Core: ActorSystem, PID, Actor interface, spawn, mailbox, supervision
remote/Remoting config, serializers, wire protocol
client/Standalone cluster client for external callers (Tell, Ask, Spawn)
crdt/CRDT types, config, messages; Replicator implementation lives in actor/
discovery/Pluggable discovery providers (Consul, etcd, K8s, NATS, mDNS, DNS-SD, static)
datacenter/Multi-DC support, control plane (NATS JetStream, etcd)
supervisor/Supervision strategies and directives
stream/Reactive streams: Source, Flow, Sink, RunnableGraph; materialized on actors
passivation/Passivation strategy types
reentrancy/Reentrancy configuration for async Request/RequestName
extension/Extension (system-wide) and Dependency (per-actor) interfaces
eventstream/In-process event bus for system and cluster events
hash/Consistent hashing for partition-based placement
breaker/Circuit breaker for async outbound calls (e.g. PipeTo)
memory/Memory size helpers
tls/TLS configuration for remoting
log/Logging abstraction
errors/Sentinel errors
testkit/Testing helpers: Probe, GrainProbe, TestKit, MultiNodes, TestNode
benchmark/Throughput and latency benchmarks (BenchmarkTell, BenchmarkGrainTell, …)
mocks/Generated mocks
protos/Protobuf source definitions (.proto files)

Key files in actor/

Grouped by subsystem.

Core API and runtime

FilePurpose
actor.goActor interface: PreStart, Receive, PostStop
actor_system.goActorSystem implementation; wires cluster, remoting, scheduling, passivation
actor_path.goAddress/path parsing and formatting for goakt://system@host:port/path URLs
api.goTop-level API surface: Tell, Ask, BatchTell, BatchAsk
pid.goPID — live reference to an actor; implements schedulable.runTurn
pid_option.go, pid_state.go, pid_tree.goPID options, lifecycle state, and the parent/child tree structure
receive_context.goReceiveContext passed to Receive; messaging, stash, behaviors
context.goContext passed to PreStart / PostStop
option.goOptions for NewActorSystem (logger, remoting, cluster, WithThroughputBudget, …)
defaults.goPackage-level default constants
messages.goInternal protocol messages (PostStart, Terminated, Panicking, …)
no_sender.goSentinel PID used when a message has no sender
pools.gosync.Pools for hot-path allocations (ReceiveContext, etc.)
pipe_option.goOptions for PipeTo (async outbound with circuit breaker)
poison_pill_serializer.goRegistration of the PoisonPill control message with the serializer registry
reflection.goRuntime type helpers; instantiate actor/grain from type name
metric.goOpenTelemetry actor metrics
guardrails.goReserved actor/grain name guards

Scheduler — the dispatcher pool

See Dispatcher Pool for the full design.
FilePurpose
dispatcher.goFixed worker pool; start / stop / signalStop / schedule
worker.goWorker goroutine loop; local-queue reschedule helper
ready_queue.goPer-worker local rings, shared global ring, work stealing, condvar parking
dispatch_state.goThree-state atomic machine (Idle / Scheduled / Processing) per actor

Mailboxes

FilePurpose
mailbox.goMailbox interface
unbounded_mailbox.goDefault MPSC FIFO mailbox
bounded_mailbox.goCapacity-capped mailbox; backpressure when full
unbounded_priority_mailbox.goPriority-ordered mailbox
unbounded_fair_mailbox.goFair-scheduled mailbox; prevents producer starvation
unbounded_segmented_mailbox.goSegmented mailbox for throughput partitioning

Behaviour, supervision, lifecycle

FilePurpose
stash.goStash buffer for deferred messages
behavior_stack.goBecome / UnBecome stack for behavior switching
reentrancy.goRequestCall, RequestOption; async request handling
supervision_signal.goInternal supervision signals routed to the parent’s system mailbox
passivation_manager.goTracks idle actors; triggers passivation
dead_letter.goCaptures messages to stopped / non-existent actors
death_watch.goCleans up terminated actors; removes from tree and cluster
shutdown_hook.goUser-registered hooks run during coordinated shutdown
system_eviction.goEviction strategy (LRU / LFU / MRU) and scheduling when the actor cap is hit

Guardians, routing, scheduling, scheduled delivery

FilePurpose
root_guardian.goRoot of the actor hierarchy
system_guardian.goParent of system actors (dead letter, relocator, replicator, topic actor, …)
user_guardian.goParent of user-spawned actors
router.go / router_option.goRouter actor; fans out to routees
routing_strategy.goRound-robin, random, fan-out strategies
scheduler.go / schedule_option.goScheduled / recurring / cron message delivery
func_actor.goFuncActor — create an actor from a plain function
topic_actor.goPub/sub topic actor; also backs the CRDT delta topic (goakt.crdt.deltas)

Cluster, remoting, multi-DC

FilePurpose
cluster_config.goCluster configuration (discovery, CRDT, roles, multi-DC)
cluster_singleton.go / cluster_singleton_option.goCluster singleton: single instance across all nodes
remote_server.goTCP server for remoting; handles RemoteTell, RemoteAsk, RemoteSpawn, …
relocator.goRelocates actors/grains when a cluster node departs
data_center_controller.goMulti-DC controller; registers DC with the control plane
spawn.go / spawn_option.goSpawn logic (local, remote, cross-DC); spawn options (mailbox, supervisor, passivation, reentrancy, role)

Grains (virtual actors)

FilePurpose
grain.goGrain interface
grain_engine.goGrain activation, routing, passivation
grain_pid.gograinPIDPID variant for virtual actors; implements schedulable
grain_context.goGrainContext for OnReceive
grain_identity.goGrainIdentity with memoised validation (hot-path allocation fix)
grain_mailbox.goGrain-specific mailbox with system-message priorities
grain_props.goGrainProps passed to OnActivate / OnDeactivate
grain_option.goGrain activation options
grain_activation_barrier.goBarrier for grain activation during cluster events

CRDT replicator

FilePurpose
replicator.goCRDT Replicator system actor: local store, delta publish/merge, anti-entropy, cross-DC flush

crdt/

Pure CRDT data types and replication configuration — no import of actor. User and Replicator code interact via crdt messages and ReplicatedData values. See Distributed data and the repository architecture/CRDTs.md.
FilePurpose
crdt.go, key.goReplicatedData, keys, DataType
config.go, consistency.goConfig, options, optional read/write coordination
messages.goReplicator messages (Get, Update, Subscribe, Delete, Changed, …)
gcounter.go, pncounter.go, lww_register.go, mv_register.go, or_set.go, or_map.go, flag.goCRDT implementations

stream/

Reactive pipelines (Source, Flow, SinkRunnableGraph) materialized onto an ActorSystem with backpressure. See Streams and the repository architecture/REACTIVE_STREAMS.md.
FilePurpose
stream.go, graph.go, graph_builder.go, pipeline.go, materializer.goGraph construction and Run
source.go, flow.go, sink.goStream building blocks
handle.go, metrics.go, tracer.goStreamHandle, metrics, per-stage tracing hooks
protocol.go, queue.go, overflow.goWire protocol, GC-safe FIFO queue, overflow strategies
config.go, errors.goStage configuration and sentinel errors
stage_source.go, stage_flow.go, stage_sink.goStage actor implementations
stage_balance.go, stage_broadcast.go, stage_parallel.go, stage_coordinator.goFan-in/fan-out, parallel map, stream coordinator

remote/

Configuration, serializers, and wire helpers for the remoting layer. The remoting server lives at actor/remote_server.go; the remoting client lives at internal/remoteclient/.
FilePurpose
config.go, option.goRemoting Config: host, port, TLS, compression, batching, …
serializer.goSerializer interface and registry
proto_serializer.goDefault protobuf serializer
cbor_serializer.goCBOR serializer for non-proto messages
compression.goMessage compression (gzip, brotli, zstd)
context_propagator.goContext metadata propagation across remote calls
peer.goRemote peer addressing
spawn_request.goRemote spawn request payload
grain_request.goRemote grain request payload
actor_state.goActor state for relocation

discovery/

Pluggable service discovery. Each sub-package implements discovery.Provider:
ProviderBackend
consul/HashiCorp Consul
etcd/etcd v3
kubernetes/Kubernetes API (headless services, pod labels)
nats/NATS
mdns/Multicast DNS (local network)
dnssd/DNS Service Discovery
selfmanaged/Gossip-based peer discovery over the cluster memberlist
static/Hard-coded peer list

datacenter/

FilePurpose
data_center.goDataCenter metadata; DataCenterRecord
config.goDatacenter configuration
control_plane.goControlPlane interface
controlplane/nats/NATS JetStream control plane
controlplane/etcd/etcd control plane

client/

Standalone cluster client for callers outside the actor system. See Client for full documentation.
FilePurpose
client.goClient: Tell, Ask, Spawn, SendSync, ReSpawn, Stop
option.goOption for NewClient (TLS, balancer, refresh, reentrancy, …)
node.goNode — cluster-member endpoint metadata
balancer.goBalancer interface
round_robin.goRound-robin node selection
random.goRandom node selection
least_load.goLeast-loaded node selection

Internal packages

PackagePurpose
internal/address/Address type; parsing, formatting, path operations
internal/cluster/Cluster membership, Olric, actor/grain registry, peer state store
internal/remoteclient/TCP client for remoting; connection pooling, proto frames, send coalescing
internal/net/TCP server, client, frame protocol, compression
internal/codec/Protobuf marshal/unmarshal; CRDT key helpers for wire types
internal/ddata/CRDT snapshots (BoltDB), crdt_codec, crdt_serializer
internal/commands/Command types for lifecycle (AsyncRequest, AsyncResponse, etc.)
internal/datacentercontroller/DC controller; registers DC, heartbeats, cache refresh
internal/types/Registry interface; type name → factory for remote spawn
internal/memberlist/Hashicorp Memberlist wrapper (TLS transport)
internal/chain/Middleware-style chain execution
internal/future/Future/promise for Ask async delivery
internal/timer/Timer pool for timeouts
internal/ticker/Ticker abstraction
internal/pause/Cooperative pause primitive
internal/duration/Duration helpers
internal/locker/Keyed lock / named mutex helpers
internal/quorum/Quorum computation for cluster writes/reads
internal/queue/General-purpose queue primitives (distinct from stream/queue.go)
internal/id/Unique ID generation
internal/size/Byte-size parsing and formatting
internal/strconvx/Extended string-conversion helpers
internal/xsync/Atomic maps, extended sync primitives
internal/validation/Fluent validation helpers
internal/pointer/Generic pointer utilities
internal/metric/OpenTelemetry metrics (includes Replicator instruments)
internal/chunk/Chunking utilities (e.g. for relocation allocation)
internal/slices/Slice utilities (Filter, etc.)
internal/internalpb/Generated protobuf Go code (wire types)

protos/

protos/
├── internal/   ← Wire types (cluster, remoting, actor, grain, datacenter, crdt, …)
└── test/       ← Test fixture proto messages

Dependency summary

PackageDepends on
actorremote, internal/cluster, discovery/*, datacenter, crdt, supervisor, passivation, reentrancy, eventstream, extension, log, errors, internal/*
remoteinternal/net, internal/codec
internal/clusterdiscovery, internal/memberlist, hash
clientremote, internal/address
streamactor
log, errors, extension, eventstream, supervisor, passivation, reentrancy, hash, breaker, memory, tls, and crdt are leaf packages—they depend on nothing else in this repository.

See also