Spacetime::Docs::A_GETTING_STARTED::Introduction
Introduction to Spacetime-CR
spacetime-cr is a zero-dependency, idiomatic Crystal SDK for SpacetimeDB,
combining a high-performance Binary Spacetime Algebraic Type Notation (BSATN) codec, SATS-JSON support,
an event-driven WebSocket & HTTP v1 client, a reactive in-memory client cache, schema-driven Crystal codegen,
and WebAssembly (WASM) host ABI bindings.
Executive Summary & Key Topics
| Topic | Method / Anchor | Description |
|---|---|---|
| Two-Tier API Philosophy | .topic_01_two_tier_architecture |
Declarative macro DSL on top of a direct imperative BSATN/SATS core. |
| Key Capabilities | .topic_02_key_capabilities |
Core features included in the spacetime-cr shard. |
Related Guides & Source References
- Spacetime
- Spacetime::Client
- Spacetime::Serializable
Class methods
topic_01_two_tier_architecture
Two-Tier API Philosophy: Declarative macro DSL on top of a direct imperative BSATN/SATS core.
spacetime-cr embraces the Sol-Vin Two-Tier API philosophy:
- Tier 1 (Declarative DSL): Use
include Spacetime::Serializable,Spacetime.connect, and the typedSpacetime::Querybuilder for ergonomic, zero-boilerplate real-time state synchronization. - Tier 2 (Imperative Core): Access
Spacetime::BSATN::Encoder,Spacetime::BSATN::Decoder,Spacetime::SATS::AlgebraicValue, andSpacetime::Protocoldirectly for dynamic inspection and custom transport frames.
topic_02_key_capabilities
Key Capabilities: Core features included in the spacetime-cr shard.
Key Topics & Information
- Complete SATS Type System: UInt128, Int128, UInt256, Int256, Identity (32-byte), ConnectionId (16-byte), Timestamp, and TimeDuration.
- BSATN & SATS-JSON Codecs: Compile-time Spacetime::Serializable macro alongside runtime Spacetime::SATS::AlgebraicType decoding.
- Reactive Table Cache: Typed in-memory Spacetime::TableCache(T) with on_insert, on_update, and on_delete hooks.
- Pluggable Transports: Live Spacetime::WebSocketTransport and deterministic Spacetime::LoopbackTransport for fast unit testing.
- Schema Codegen & CLI: spacetime-cr generate emits strongly-typed Crystal models and reducer helpers from live SpacetimeDB servers or schema JSON files.