Spacetimedb backend as database

From CarlosCaPe/octorato · View interactive version

Spacetimedb backend as database is an AI agent skill from the GitHub repository CarlosCaPe/octorato. A database that REPLACES the backend: logic runs as modules inside the DB and clients subscribe to live state, with no API layer. For real-time multiplayer. A new paradigm, not a default.

How to use this skill

Skill file

SpacetimeDB — Database-as-Backend

A paradigm shift, not just a database. Application logic (server functions) runs inside the database as compiled modules; clients connect directly and subscribe to live state changes. No separate API server, no separate websocket layer, no separate state sync glue.

When to surface this to a client

When NOT to use

Source of truth

What's genuinely new

| Traditional 3-tier | SpacetimeDB |

|---|---|

| API server (separate process) | Server logic = DB modules |

| Database (separate process) | Same process |

| Websocket layer (separate) | Built-in client subscriptions |

| Client polls or subscribes via custom code | Client subscribes to query results, gets diffs automatically |

| Auth/session managed in API tier | First-class in DB module API |

The pitch: collapse the stack.

Quick start (rough — verify against current docs)

# Install CLI
# (varies — check spacetimedb.com or the repo)

# Initialize a module project
spacetime init my-module

# Write your server logic in Rust → compiled to WASM
# Deploy the module to a SpacetimeDB instance (hosted or self-hosted)

# Client (TypeScript example): connect, subscribe to a query, react to live updates

Recommendation pattern (architecture proposals)

"Surface SpacetimeDB as an alternative when the client's architecture is dominated by real-time state sync across many clients — multiplayer, collaborative editing, agent swarms. The paradigm collapses three tiers into one, which is a structural cost reduction. Frame it as a paradigm choice that has long-term implications, not just a database swap. If the client's workload is standard CRUD or batch analytics, recommend the conventional 3-tier — SpacetimeDB shines on the real-time state-sync axis and is overkill elsewhere."

Limits to disclose to a client

Related brain assets

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.