Check out our all new pricing plans! Learn more.
use spacetimedb::{table, reducer, ReducerContext, Table};
#[table(name = person, public)]
pub struct Person {
name: String,
}
#[reducer]
pub fn add(ctx: &ReducerContext, name: String) {
log::info!("Inserting {}", name);
ctx.db.person().insert(Person { name });
}
#[reducer]
pub fn say_hello(ctx: &ReducerContext) {
for person in ctx.db.person().iter() {
log::info!("Hello, {}!", person.name);
}
log::info!("Hello, World!");
}
A SERVER AND DATABASE IN ONE.
You can think of SpacetimeDB as both a relational database and a server combined into one. Instead of deploying a web or game server that sits in between your clients and your database, clients connect directly to the database and execute your logic inside the database itself. No more Docker, Kubernetes, VMs, microservices or extensive ops infrastructure.
We built SpacetimeDB because we needed a reliable, transactional and super fast backend to run BitCraft. The entire backend, including all logic, real-time updates, and persistent state, is implemented as a SpacetimeDB module.
Learn More


