Cross-platform CRDT database built on Automerge. Runs in browsers via WebAssembly and as a native Rust sync server.
⚠️ UNDER ACTIVE DEVELOPMENT ⚠️
SwirlDB is in early development and not ready for production use. The API is unstable and subject to breaking changes.
See BUILD.md for build instructions.
npm install -g pnpm or brew install pnpm1. Build the WASM package:
# From repository root
pnpm run build:wasm
2. Use in your application:
import { SwirlDB } from '@swirldb/js';
// Configure with LocalStorage adapter (data persists automatically)
const db = await SwirlDB.withLocalStorage('my-app');
// Use natural property access via Proxies
db.data.user.name = 'Alice';
db.data.user.age = 30;
// Read values
console.log(db.data.user.name.$value); // 'Alice'
// Observe changes reactively
db.data.user.name.$observe((newValue) => {
console.log('Name changed:', newValue);
});
// Data is automatically persisted to localStorage
// No manual save/load needed!
Or with in-memory storage:
// Volatile storage (nothing persists)
const db = await SwirlDB.create();
Build Browser WASM:
cd native/swirldb-browser
wasm-pack build --target web --out-dir pkg
Build Server:
cd native/swirldb-server
cargo build --release
Prerequisites for Integration Tests:
# Install Node.js dependencies for browser tests
cd tests/integration
npm install
# Install Playwright for headless browser testing
npx playwright install chromium
Run All Integration Tests:
cd tests
cargo test --test integration
Run Specific Test Suites:
# Browser WebAssembly ↔ Server sync tests
cargo test --test integration browser_sync
# Subscription filtering tests
cargo test --test integration subscription_filtering
# Multi-client sync tests
cargo test --test integration multi_client_sync
# Network resilience tests
cargo test --test integration network_resilience
Run a Single Test:
cargo test --test integration test_browser_to_server_sync -- --nocapture
The integration test suite includes: - 32 passing tests covering Browser WASM and Rust native clients - Real headless browser testing with Playwright - Cross-platform CRDT synchronization validation - Subscription filtering and policy enforcement - Network disconnect/reconnect scenarios
See BUILD.md for detailed build instructions.
SwirlDB is built entirely from swappable adapters:
Implemented: - ✅ In-memory (volatile, fast) - ✅ LocalStorage (browser, 5-10MB) - ✅ IndexedDB (browser, 50MB-1GB) - ✅ redb (server, embedded, persistent) - ✅ Memory adapter (server, multi-threaded)
Planned: - 🔜 SQLite (portable, queryable) - 🔜 Sharded files (large datasets) - 🔜 S3 (cloud-native)
Implemented: - ✅ WebSocket (real-time, bi-directional) - ✅ HTTP long-polling (fallback)
Planned: - 🔜 WebRTC (peer-to-peer) - 🔜 Custom protocols
Planned: - 🔜 JWT validation - 🔜 OAuth integration - 🔜 ABAC (attribute-based access control) - 🔜 Custom policy engines
Planned: - 🔜 AES-GCM (document-level) - 🔜 Field-level encryption - 🔜 Custom crypto implementations
Apache 2.0
Copyright 2025 Everyside Innovations, LLC
$ claude mcp add swirldb \
-- python -m otcore.mcp_server <graph>