Skip to main content
An API is rarely only HTTP. A request may write state, cache a value, publish an event, enqueue work, send mail, schedule a retry, store a file, or call another service. Simile Stack provides small deterministic implementations of those capabilities so a local Simile service can reproduce the observable consequences of an operation without reproducing its production infrastructure.

The design rule

Stack emulates capabilities, not vendors. db means durable document-like state; it does not claim to be PostgreSQL. queue means delayed, at-least-once delivery with visibility and acknowledgement; it does not claim Kafka or SQS protocol compatibility. The service definition describes the behavior an integration can observe while private topology and vendor choices stay private. This keeps service definitions:
  • portable across provider infrastructure changes;
  • small enough for providers to author and review;
  • safe to publish without disclosing internal architecture; and
  • precise enough to reproduce meaningful state and asynchronous behavior.

Components

One process hosts one capability kind and may contain several named backends. For example, queue.orders and queue.receipts are isolated namespaces in one simile-queue process. This is small enough to run locally while preserving the backend boundaries in the service definition.

What every component shares

All components implement the same versioned protocol, use the same logical-time model, and contribute payload-free entries to the same conceptual causal journal. Their state is serializable, resettable, and restorable. The supervisor owns command identity and time, so every backend observes the same operation timeline. Every component process checkpoints each coherent transition into an embedded redb database under the Simile home directory and restores it before accepting traffic after a restart. No state-file configuration is required. The persistence contract defines path identity, commit visibility, rollback, file ownership, compatibility checks, and the distinction between a runtime checkpoint and a portable JSON snapshot.

Execution boundary

HCL effects compile into typed Stack commands. Synchronous commands, inferred state transitions, the Stack checkpoint, and deferred-work publication share one service commit. Named async units and webhook occurrences enter a durable outbox, where background workers lease and execute them after the public response has committed. A backend declaration grants the service a capability; it never invents a provider-specific command. Simile can infer conservative database CRUD when the contract proves a single entity and identity. Queue messages, mail, schedules, events, objects, and ambiguous database transitions use provider-authored effects. See Dependencies and effects for the action language and Durable work for dispatch semantics.

Composition rules

Stack follows three rules that keep larger emulations understandable:
  1. State changes commit before asynchronous effects. A response cannot claim success while its required state mutation remains ambiguous.
  2. Every command carries causality. Operation, causation, correlation, and idempotency metadata make related activity inspectable without recording private payloads in the journal.
  3. Time is an input. Tests advance one logical clock instead of sleeping and hoping background work has completed.
These rules let simple components compose into a believable service without turning Stack into a copy of the provider’s production deployment.