Local-First,
Real-Time,
By Default

Build local-first applications with real-time sync, offline support, and complete type safety.

 ▄▄████████▄▄ 
 ▄██████████████▄ 
  ████████████████
  ████  ████  ████
 ████████████████ 
 ██████▀  ▀██████ 
 ██████    ██████ 
██████▄  ▄██████  
████████████████  
████████████████  
 ██▄ ▀█▄▀ █▀ ▄█▄█ 
 ▀   █   █   ▀ ▀ 
queries.ts
import { useQuery } from "@spooky-sync/client-solid";
import { db } from "../db";

const ThreadList = () => {
  const result = useQuery(db, () =>
    db.query("thread")
      .related("author")
      .related("comments")
      .orderBy("created_at", "desc")
      .limit(10)
      .build()
  );

  return (
    <For each={result.data()}>
      {(thread) => (
        <div>{thread.title}</div>
      )}
    </For>
  );
};
Features

Build Horrifyingly Great Apps

From offline-first capabilities to real-time synchronization and complete type safety

Offline Compatibility

Full read/write capability without network access. Changes are queued locally and synchronized automatically when connectivity returns.

Live Updates

Sub-millisecond latency. Data changes propagate instantly to all connected clients via incremental view maintenance.

Exceptional DX

Schema-first design with end-to-end type safety. Generated TypeScript definitions ensure your code is always correct.

How It Works

It feels like magic

Direct state synchronization powered by SurrealDB

SurrealDB native sync engine

Spooky bypasses traditional REST APIs in favor of direct state synchronization on top of SurrealDB. Built for modern real-time applications that need instant updates across all clients.

Authentication-agnostic security

Integrate with any identity provider while maintaining fine-grained access control. SurrealDB's flexible security model adapts to your authentication strategy.

// SYSTEM_ARCHITECTURE_LIVE_VIEW
[ *WRITE* ] [ APP B ]
+--------------+ +--------------+
| LOCAL DB A | | LOCAL DB B |
+--------------+ +--------------+
+--------------------------------------------+
| REMOTE SURREALDB |
| |
| +----------+ +--------------+ |
| | EVENTS | | INCANTATIONS | |
| +----------+ +--------------+ |
| |
+------------------------------------------+
+--------------------------------------------+
| SPOOKY STREAM PROCESSOR |
+--------------------------------------------+
Type Safety

Schema-First Development

Define your database schema once in SurrealDB, and let Spooky generate type-safe clients for all your targets—TypeScript, Dart, Zod, and more. One source of truth for your entire stack.

schema.surql
DEFINE TABLE user SCHEMAFULL;
DEFINE FIELD username ON user
TYPE string;
DEFINE FIELD email ON user
TYPE string;
DEFINE TABLE thread SCHEMAFULL;
DEFINE FIELD title ON thread
TYPE string;
DEFINE FIELD author ON thread
TYPE record<user>;
Generated Files
TypeScript
schema.gen.ts
Dart
schema.g.dart
Zod
schema.zod.ts
Click to see generation in action
terminal
$spooky generate --target ts,dart,zod
Generated schema.gen.ts
Generated schema.g.dart
Generated schema.zod.ts
schema.surql:
DEFINE TABLE user SCHEMAFULL;
DEFINE FIELD username ON user
TYPE string;
DEFINE FIELD email ON user
TYPE string;
DEFINE TABLE thread SCHEMAFULL;
DEFINE FIELD title ON thread
TYPE string;
DEFINE FIELD author ON thread
TYPE record<user>;
1
// @generated by spooky-cli
2
export const schema = {
3
tables: [
4
{
5
name: 'user' as const,
6
columns: {
7
id: { type: 'string' as const, recordId: true },
8
username: { type: 'string' as const },
9
email: { type: 'string' as const }
10
},
11
primaryKey: ['id'] as const
12
},
13
{
14
name: 'thread' as const,
15
columns: {
16
id: { type: 'string' as const, recordId: true },
17
title: { type: 'string' as const },
18
author: {
19
type: 'string' as const,
20
recordId: true,
21
references: 'user' as const
22
}
23
},
24
primaryKey: ['id'] as const
25
}
26
],
27
relationships: [
28
{
29
from: 'thread' as const,
30
field: 'author' as const,
31
to: 'user' as const,
32
cardinality: 'one' as const
33
}
34
]
35
};
Developer Tools

Exceptional DX

Spooky is built by developers for developers with framework-native queries with full reactivity and type safety.

TSXThreadList.tsx
1 Error
1
import { useQuery } from "@spooky-sync/client-solid";
2
import { db } from "../db";
3

4
const ThreadList = () => {
5
const result = useQuery(db, () =>
6
db.query("thread")
7
.related("comments")
8
.orderBy("created_at", "desc")
9
.limit(10)
10
.build()
11
);
12

13
return (
14
<For each={result.data()}>
15
{(thread) => (
16
<div>{thread.title} by {thread.author.username}</div>
17
)}
18
</For>
19
);
20
};
SPOOKY_SYNC
Ln 20, Col 2UTF-8TypeScript Solid.js
Context-Aware Autocomplete

Context-aware autocomplete knows your schema inside out. It suggests sort fields, relations, and filter operations appropriate for your current query context.

Real-Time Feedback

Your queries are continuously validated against your schema. Type mismatches, invalid fields, and logic errors are detected instantly and highlighted directly inside the code editor, ensuring your code is correct before execution. Try yourself and fix the type error on the left.

Showing feature 1 of 2
Architecture

Under the Hood

Spooky uses Incremental View Maintenance to track client query hashes, known as Incantations. These are stored in the _spooky_querys table. Choose your runtime based on your performance needs.

Scroll to explore deployment options

SSP Singlenode

Development
WEB
React/Solid
APP
Flutter/iOS
Local Environment
SURREALDB
Tables & Auth
Live Query Hub
Event Triggers
RPC
SYNC
SSP
DBSP Engine
Job Runner
In-Memory State

The Sidecar runs as a separate process. It keeps the DBSP state in RAM, eliminating the need to save/load state on every request. It updates the database via RPC.

  • High Performance (In-Memory State).
  • Scalable for production loads.

SSP Cluster

Production
WEB
React/Vue
APP
Flutter/iOS
API
Backend
Server Infrastructure
SURREALDB
Tables & Auth
Live Query Hub
Event Triggers
RPC
SCHEDULER
Snapshot Replica
WAL
Load Balancer
Health Monitor
Job Scheduler
SSP-1
Active
SSP-2
Active
SSP-3
Bootstrapping

The Scheduler distributes Incantations across multiple SSP instances using a persistent RocksDB snapshot replica and WAL for crash recovery. Automatic load balancing and health monitoring ensure zero-downtime deployment and horizontal scalability for enterprise workloads.

  • Horizontal Scaling (Add/Remove SSPs).
  • Zero-Downtime Deployments.
  • Intelligent Query Routing & Load Balancing.

Surrealism (WASM)

Coming Soon
DEV
Developer
TEST
Vitest
Test Environment
SURREALDB
Spooky Stream Processor (WASM) Ephemeral

The Spooky Stream Processor executes directly within SurrealDB—ideal for automated testing scenarios, CI/CD pipelines, and local development.

  • Zero setup (runs inside `surreal start`).
  • High I/O overhead (State Rehydration).
    The DBSP processor runs as an embedded WASM function. Since WASM memory is ephemeral, the entire state must be loaded and saved to the database on every execution.

Ready to build something amazing?

Start building local-first, offline-ready applications today. Dive into the documentation to learn more about the architecture and implementation details.

Get Started