Repolode
clockworklabs

clockworklabs/SpacetimeDB

A relational database that also acts as the server: you deploy your application logic into it and clients connect directly, with live updates pushed to subscribers.

Open-source alternative to:Firebase

Stars
25,328
Forks
1,091
Open issues
942
Last commit
3 hours ago

What is it?

SpacetimeDB removes the separate web or game server layer between clients and the database. You write your schema and business logic as a module in Rust, C#, TypeScript, or C++, and SpacetimeDB compiles it, runs it inside the database, and synchronizes state to connected clients. Clients call reducers (functions that modify data) and subscribe to tables, and the server pushes committed changes to them automatically, with no polling.

All application state is held in memory for low-latency access, and a commit log on disk provides durability and crash recovery. Transactions follow ACID guarantees. Since version 2.0, subscription updates and reducer results are withheld until the transaction is durable by default, and clients can opt out for lower latency.

Client SDKs cover TypeScript (including React, Vue, Svelte, and Node.js), Rust, C#, including Unity, and C++ for Unreal Engine. The project is aimed at reactive web apps such as chat, dashboards, and collaborative tools, as well as multiplayer games.

Key features

  • 01Application logic runs inside the database as a module written in Rust, C#, TypeScript, or C++.
  • 02Clients subscribe to tables and receive committed changes in real time without polling.
  • 03ACID transactions, with state held in memory and a disk commit log for durability and recovery.
  • 04Confirmed reads hold back updates until the transaction is durable, configurable per client.
  • 05Client SDKs for TypeScript (with React hooks), Rust, C#/Unity, and C++/Unreal Engine.
  • 06Can be run locally via Docker or the CLI, with a cloud deployment option called Maincloud.

Use cases

  • Building a collaborative web app or chat service without a separate API server or pub/sub layer.
  • Creating live dashboards where every connected client sees updates as they happen.
  • Backing a multiplayer game such as an MMORPG with shared, real-time world state.
  • Writing an entire application in a single language and deploying it as one binary.

Quick start

  1. 1

    Run the official install script from the README

  2. 2

    Log in to your account

    spacetime login
  3. 3

    Create a project from a template and start the dev watcher

    spacetime dev --template chat-react-ts

Things to know

  • Licensed under the Business Source License 1.1, which is source-available and not an OSI open-source license until it converts to AGPL v3.0 after a few years.
  • The quick start publishes to Maincloud, which is a paid hosted service with its own pricing.

In collections

Topics

FAQ

What is SpacetimeDB?
A relational database that also acts as the server: you deploy your application logic into it and clients connect directly, with live updates pushed to subscribers. SpacetimeDB removes the separate web or game server layer between clients and the database. You write your schema and business logic as a module in Rust, C#, TypeScript, or C++, and SpacetimeDB compiles it, runs it inside the database, and synchronizes state to connected clients. Clients call reducers (functions that modify data) and subscribe to tables, and the server pushes committed changes to them automatically, with no polling.
Is SpacetimeDB free to use? What license does it have?
SpacetimeDB is open source under the Other license. Check the license terms before using it in commercial products.
Is SpacetimeDB still maintained?
Actively maintained. The last commit to SpacetimeDB was on Oct 22, 2026.
What can I use SpacetimeDB for?
Building a collaborative web app or chat service without a separate API server or pub/sub layer. Creating live dashboards where every connected client sees updates as they happen. Backing a multiplayer game such as an MMORPG with shared, real-time world state. Writing an entire application in a single language and deploying it as one binary.
How do I install SpacetimeDB?
Run the official install script from the README Log in to your account: spacetime login Create a project from a template and start the dev watcher: spacetime dev --template chat-react-ts
Where can I get SpacetimeDB?
The source code and installation instructions are on GitHub: https://github.com/clockworklabs/SpacetimeDB

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects