One binary replaces your backend, database, and real-time layer. Write Rust or TypeScript, deploy instantly, and scale to millions of connections. Real-time subscriptions with DBSP incremental engine — 10-100x faster than alternatives.
cargo install cosmictron
The traditional stack forces you to maintain an app server, a database, a pub/sub system, and an ORM layer. Network hops between tiers destroy latency. Cosmictron collapses all of it into one.
See how we compare to the tools you're already evaluating.
Your business logic runs inside the database, not across the network. Microsecond response times on every request.
Subscribe to any SQL query. Clients get instant deltas when data changes. DBSP incremental engine — 10-100x faster than full re-evaluation.
Row-level policies are declarative SQL, automatically injected into every query. Impossible to accidentally expose data.
Replaces your app server + database + pub/sub + cache. Self-hosted in 30 seconds. Zero external dependencies.
FoundationDB-style simulation testing from Day 1. Every crash recovery path tested with 1000s of random seeds.
Hot-reload modules without dropping connections. Blue/green deployment with automatic rollback on failure.
Query with psql, DBeaver, or any PostgreSQL tool. Wire protocol support means existing tools just work.
Derive macros eliminate serialization boilerplate. TypeScript client with full intellisense. No more stringly-typed APIs.
End-to-end tracing from client click to database commit. Prometheus metrics included. Production-ready monitoring.
Derive macros eliminate serialization boilerplate. The Query API provides type-safe database operations. Focus on your logic, not the plumbing.
use cosmictron_sdk::*; #[derive(BsatnSerialize, BsatnDeserialize)] #[table(name = "messages")] pub struct Message { #[primary_key] #[auto_inc] pub id: u64, #[index] pub channel_id: u64, pub content: String, } #[reducer] pub fn send_message( channel_id: u64, content: String, ) { let msg = Message { id: 0, // auto-assigned channel_id, content, }; datastore::insert(&msg); } #[reducer(client_connected)] pub fn on_connect() { info(&format!("User {} connected", identity_abbr(&caller_identity()))); }
import { CosmictronClient } from '@cosmictron/client'; const client = new CosmictronClient( 'ws://localhost:8080' ); // Connect and authenticate await client.connect(); // Subscribe to messages in real-time await client.subscribe( 'SELECT * FROM messages WHERE channel_id = 1', (update) => { update.inserts.forEach(msg => console.log(`New: ${msg.content}`) ); } ); // Send a message await client.callReducer( 'chat', 'send_message', { channel_id: 1, content: 'Hello!' } );
Use the #[table] macro to declare your schema with types, indexes, and constraints in Rust structs.
Business logic as plain functions. Each call is an atomic transaction with full access to the datastore.
→Compile to WASM and deploy with the CLI. Hot-reload is supported with zero downtime.
→Clients subscribe to SQL queries over WebSocket. Deltas stream in real-time as data changes.
Low-latency state sync for thousands of concurrent players. Deterministic reducers prevent cheating. Powers games with 6M+ playtime hours.
See game example →Slack-like channels, presence indicators, and typing notifications out of the box. No CRDT complexity required.
See game example →Stream real-time analytics with incremental aggregations. No polling. No cache invalidation. Sub-millisecond updates.
See dashboard →Declarative row-level security isolates tenant data automatically. One query, scoped results. Built for B2B applications.
Learn about RLS →Self-hosted means your server, your rules, your budget. No per-operation billing spikes.
Self-hosted = no surprise bills, no vendor lock-in, no quota anxiety.
Join developers building the future with Cosmictron.
Open source, MIT/Apache-2.0 licensed, free forever.
Built for Production