v2.10
Install
Docs
Compare
Pricing
Dev Resources
Blog
Referrals
25K STARS
Login
Docs
Pricing
LLM Benchmarks
Templates
Community
Features
Blog
Referrals
Community
install
Login
Compare top models
LLM Benchmarks
See how today's leading models write Spacetime code, scored task by task on live modules.
Spacetime vs Postgres
Leaderboard
Trends
Evals
C#
Rust
TypeScript
Evals
83 tasks · 11 categories
View Source
basics
15
t_000
Empty Reducers
defines a table and these five empty reducers.
▼
t_001
Basic Tables
defines three tables with basic columns.
▼
t_002
Scheduled Table
defines a scheduled table and a scheduled reducer.
▼
t_003
Struct In Table
defines a struct type and uses it in a table.
▼
t_004
Insert
defines one table and a reducer that inserts a row.
▼
t_005
Update
defines one table and two reducers: one that inserts a row and one that updates a row.
▼
t_006
Delete
defines one table and two reducers: one that inserts a row and one that deletes a row.
▼
t_007
Crud
defines one table and a reducer that performs insert, update, and delete in one call.
▼
t_008
Index Lookup
defines two tables and two reducers: one that inserts a user row, and one that looks up a row by primary-key index and writes a projection to another table.
▼
t_009
Init
defines one table and an init reducer that seeds rows on database initialization.
▼
t_010
Connect
defines one table and two reducers for client lifecycle events.
▼
t_011
Helper Function
defines a table, a non-reducer helper function, and a reducer that uses the helper.
▼
t_038
Schedule At Time
schedules a one-shot reducer to fire at a specific future time.
▼
t_039
Cancel Schedule
schedules a reducer and allows canceling it before it fires.
▼
t_040
Lifecycle Player
maintains a table of currently connected players using lifecycle reducers.
▼
schema
10
t_012
Spacetime Product Type
defines a product type and uses it in a table.
▼
t_013
Spacetime Sum Type
defines a new sum type and uses it in a table.
▼
t_014
Elementary Columns
defines one table and seeds one row.
▼
t_015
Product Type Columns
defines product types and uses them as columns in a table.
▼
t_016
Sum Type Columns
defines a sum type and uses it in multiple table columns.
▼
t_017
Scheduled Columns
defines a scheduled table and seeds one schedule entry.
▼
t_018
Constraints
defines one table and seeds two rows.
▼
t_019
Many To Many
defines three tables modeling a many-to-many relationship and seeds rows.
▼
t_020
Ecs
models a minimal ECS and computes next positions.
▼
t_021
Multi Column Index
defines one table with a multi-column B-Tree index and seeds rows.
▼
queries
8
t_022
View Basic
defines a public anonymous view over a table.
▼
t_023
View Per User
defines a table of user profiles and a per-user view that returns only the calling user's profile.
▼
t_032
Range Query
defines a product table with a BTree-indexed price column, a result table, and a reducer that filters products within a price range and writes matches to the result table.
▼
t_033
Sort And Limit
defines a player table with scores, a leaderboard result table, and a reducer that finds the top N players by score (descending) and writes them to the result table.
▼
t_034
Find First
defines a task table and a result table, with a reducer that finds the first incomplete task and writes it to the result table.
▼
t_035
Select Distinct
defines an order table and a result table, with a reducer that collects all distinct category values from orders into the result table.
▼
t_036
Count Without Collect
defines a user table and a stats table, with a reducer that counts total users and active users without collecting into an array.
▼
t_037
Multi Column Filter
defines an event log table with a multi-column BTree index and a result table, with a reducer that filters events by both category and severity level.
▼
data modeling
6
t_024
Event Table
defines an event table for damage notifications and a reducer that publishes events to it.
▼
t_025
Optional Fields
defines a table with optional (nullable) fields and a reducer that inserts rows with and without optional values.
▼
t_028
Cascade Delete
defines an author table and a post table with a foreign key, and a reducer that deletes an author along with all their posts.
▼
t_029
Filter And Aggregate
defines an order table and a stats table, with a reducer that computes aggregate statistics from filtered orders.
▼
t_030
Wo Table Join
defines a customer table, an order table with a foreign key to customer, and a denormalized result table. Include a reducer that joins the two tables and writes results.
▼
t_031
Unique Constraint
defines a table with a unique constraint on a non-primary-key column and a reducer that inserts rows.
▼
auth
9
t_026
Auth Identity Check
defines a table of messages owned by users, and reducers that enforce ownership using ctx.sender.
▼
t_027
Private Vs Public Table
defines a private table for sensitive data and a public table for client-visible data, with a reducer that copies safe fields from private to public.
▼
t_041
Registered User Gate
gates actions behind a registration check.
▼
t_042
Admin Bootstrap
implements a one-time admin bootstrap pattern.
▼
t_043
Role Based Access
implements role-based access control.
▼
t_044
Ban List
implements a ban list enforced on game entry.
▼
t_045
Rate Limit
enforces per-identity rate limiting.
▼
t_046
Shared Document
implements document ownership and explicit sharing.
▼
t_068
Secure Projection
exposes a safe per-user projection of private rows.
▼
tables
8
t_047
Normalized Collection
models an unbounded child collection with normalized tables.
▼
t_048
Heartbeat Isolation
separates stable profile data from frequently updated connection presence.
▼
t_049
Binary Storage
stores binary content and its metadata.
▼
t_050
Normalized Schema
normalizes organization data into three related tables.
▼
t_051
Denormalized Index
maintains an indexed denormalized category slug on products.
▼
t_052
Autoinc Reference
safely creates related rows with an auto-incremented parent ID.
▼
t_053
Default Values
Update the existing SpacetimeDB backend module in TypeScript to add a migration-safe default value.
▼
t_054
Special Types
Write a SpacetimeDB backend module in TypeScript defining one public table with special value types.
▼
reducers
6
t_055
Atomic Idempotent Transfer
performs atomic, idempotent transfers between accounts.
▼
t_056
Nested Update
stores and updates nested profile preferences.
▼
t_057
Nested Cascade Delete
performs a nested cascade delete across normalized tables.
▼
t_058
Batched Delete
deletes a logical group in scheduled batches of at most two rows.
▼
t_059
Deterministic Context
records deterministic reducer time and randomness.
▼
t_060
Reducer Result Table
writes reducer results to a table.
▼
views
7
t_061
Hree Table Join
defines a public view joining three normalized tables.
▼
t_062
Semijoin Intersection
defines a query-builder semijoin view.
▼
t_063
Imestamp Window
defines a procedural view over an inclusive timestamp range.
▼
t_064
Index And Filter
defines a procedural view using an index and additional filters.
▼
t_065
Materialized Aggregate
maintains and exposes a materialized aggregate.
▼
t_066
Query Builder View
defines a query-builder filter view.
▼
t_067
View Primary Key
defines a procedural view with a primary key.
▼
lifecycle
3
t_069
Scheduled Materialization
refreshes materialized state through a scheduled reducer.
▼
t_070
Connection Scoped Presence
tracks presence separately for each connection.
▼
t_071
Scheduled Private
Write a SpacetimeDB backend module in TypeScript with a private scheduled table that is not client-callable.
▼
procedures
8
t_072
Procedure Return
defines a procedure with a typed return value.
▼
t_073
Http Fetch
performs outbound HTTP in a procedure.
▼
t_074
Fetch And Store
fetches external data before storing a result in a transaction.
▼
t_075
Scheduled Procedure
schedules a procedure which writes inside a transaction.
▼
t_076
Http Handler
defines and routes an inbound HTTP handler.
▼
t_077
Http Router
routes two HTTP methods on the same path.
▼
t_078
Idempotent Webhook
handles idempotent, ordered webhook events.
▼
t_079
External Upload Flow
exposes an upload route and an external upload procedure.
▼
migrations
3
t_080
Automatic Migration
Update the existing SpacetimeDB backend module in TypeScript with a compatible schema change.
▼
t_081
Incremental Migration
Update the existing SpacetimeDB backend module in TypeScript with an incremental migration.
▼
t_082
Hot Swap Compatibility
Update the existing SpacetimeDB backend module in TypeScript through a compatible republish.
▼