Skip to content
spock

It’s only logical.

Prototype the backend you mean.

Spock is a small language and framework for putting durable state and deliberate operations in one inspectable contract. Check it, run it, and inspect the derived interfaces with one command.

$npx spock new demo
$cd demo
$npx spock dev
Early prototypePre-1.0Not for production
app.spockcurrent v0 syntax
auth table user {
  key id: uuid = auto
  username: text check valid_username unique
  full_name: text?
  avatar: storage_object?
  private: bool = false
  joined_at: timestamp = now
}

table post {
  key id: uuid = auto
  author: user = me
  caption: text?
  published_at: timestamp = now
}
Source
app.spock
Authority
embedded SQLite
Interfaces
GraphQL · REST · Studio
table
record
fn
seed
compiled contract

One first-class home

State the contract once.

Application intent is usually repeated across schemas, serializers, handlers, validation, authorization, storage rules, and tests. Spock gives that intent one small source artifact the toolchain can check, materialize, and expose.

Why it exists

Product logic stops being an agreement between scattered layers.

The compiled contract is the specified interchange artifact. The Rust toolchain is one implementation that turns it into a runnable local authority.

Source
app.spock

Durable data, value rules, deliberate functions, and seeds.

Artifact
compiled contract

A versioned, inspectable description independent of one host.

Runtime
embedded SQLite authority

A disposable world for validating real application behavior.

Surfaces
contract · GraphQL · REST · Studio

Derived interfaces over the same checked source.

Current v0

A deliberately small language.

The implemented surface is narrow enough to understand and complete enough to run. Future declarations such as view, role, and policy remain reserved—not advertised as current syntax.

Explore the normative specification

table · auth table

Durable entities, references, keys, checks, defaults, and identity.

record

Named structural values carried through the compiled contract.

fn · mut fn

Deliberate read and write operations beside the state they govern.

seed

Repeatable data and local files for a disposable prototype world.

examples/instagram/v0.spockimplemented syntax
fn valid_username(name: text) -> bool {
  unchecked sql("""
    SELECT :name NOT GLOB '*[^a-z0-9._]*'
      AND length(:name) BETWEEN 1 AND 30
  """)
}

auth table user {
  key id: uuid = auto
  username: text check valid_username unique
  full_name: text?
  private: bool = false
  joined_at: timestamp = now
}

The contract runs

From source to a working prototype.

The toolchain checks the source, creates a fresh local world, and serves inspectable interfaces over one authority. No production infrastructure theater required.

01

Check

Parse and fully load-check the source before a prototype starts.

02

Materialize

Lower the compiled contract into an embedded SQLite authority.

03

Serve

Expose contract, GraphQL, REST, storage, and Studio on one origin.

04

Generate

Emit TypeScript types and the derived GraphQL schema when needed.

Standalone language

$ npx spock run app.spock

Materialize the compiled contract into embedded SQLite, load seed data, and serve the developer surfaces locally.

Local surfaces

GET /~contract
Compiled contract as data
/rest/v1/*
Open reads and declared RPC
POST /graphql/v1
Typed reads and writes
GET /~studio
Developer console

Inspect what is running

The artifact stays legible.

The contract preserves field types, defaults, checks, references, and documentation. The runtime and Spock Studio consume that same metadata instead of reconstructing intent from a database.

Studio currently supports contract-aware tables, filters, sorting, paging, row insertion, actor selection, and storage-backed fields.

Compiled contract

table user

auth table
FieldTypeContract
iduuidkey · auto
usernametextcheck · unique
full_nametext?nullable
privatebooldefault false
joined_attimestampdefault now
The visual is a contract view, not a substitute for the normative specification.

Optional client layer

Compose the authority and the experience.

A framework project can add an Uhura client under the same command and origin. Composition keeps the responsibilities separate: Spock remains authoritative; Uhura remains optional.

Explore Uhura
Canonical project topology
demo/
├── spock.toml
├── backend/
│   └── app.spock       authority
└── client/
    └── uhura.toml      optional experience

Spock owns

Durable facts, policy boundaries, guarded mutations, and the authority protocols.

Uhura owns

Presentation, experience transitions, and non-authoritative interface-session state.

Know the boundary

Real enough to run. Deliberately not production.

Spock exists to validate application contracts—not to host an app at scale. Its language and host protocols are pre-1.0 and may change. The current specification is the source of truth.

Community

Built in the open.

Spock is MIT-licensed open-source software. Implementation, documentation, testing, research, and clearly labeled competing pre-1.0 experiments all happen in the public project.