v2.7
Install
Docs
Compare
Pricing
Dev Resources
Referrals
25K STARS
Login
Docs
Pricing
LLM Benchmarks
Templates
Blog
Community
Features
Referrals
Community
install
Login
Compare top models
LLM Benchmarks
See how today's leading models write SpacetimeDB code, scored task by task on live modules.
View Evals
SpacetimeDB vs Postgres
Leaderboard
Trends
Evals
C#
Rust
Typescript
Evals
47 tasks · 5 categories
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
8
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.
▼