user_alice.messagesOpen source · Built in Rust · Apache 2.0
Postgres-compatible.
Realtime built in.
One binary.
The PostgreSQL-compatible backend with live queries, server functions, durable pub/sub, and Raft clustering built in.
Hot and cold storage. Built-in per-user isolation. Your data, on your infrastructure.
- Postgres SQLNative PGWire
- Live queriesWebSocket updates
- Server functionsJavaScript / TypeScript
- Durable pub/subTopics + workers
- AuthenticationUsers + row policies
- ClusteringMulti-Raft replication
- Tiered storageRocksDB + Parquet
- Per-user isolationUser-scoped data
Self-host with a native binary or Docker. Review PostgreSQL compatibility before migrating.
Familiar tools. More built in.
From PostgreSQL to a live app.
Query with your existing tools. Subscribe with an SDK. Run your logic next to the data. These snippets assume the named schema, an authenticated client, and generated types where shown.
Keep your SQL. Bind your parameters.
Connect PostgreSQL tools through PGWire, or use SDK queries with bound values. The same database serves both.
Connect with PGWireThe SDK snippets use an authenticated client and an existing chat_demo.messages table.
psql -h 127.0.0.1 -p 5432 -U root -d kalam -WSELECT id, content, created_atFROM chat_demo.messagesWHERE room = 'main'ORDER BY created_at DESCLIMIT 20;Enable [postgres_wire] in server.toml before connecting.
One backend, from data to delivery
Build the app. The backend is here.
Your schema becomes your API.
Define tables, types, and function contracts in SQL. Generate TypeScript and Dart/Flutter APIs, then keep them in sync as your schema evolves.
Schema to SDKTiered storage. One SQL query.
Write to hot RocksDB storage. Flush USER and SHARED tables to compressed Parquet on local disk or object storage using configurable policies. Query both tiers together through SQL.
Explore storage tiersPer-user isolation, built in.
The same USER table and query give each user their own rows and live updates, without adding user filters to every query. For shared tenant or team data, use SHARED tables with row-level policies.
Understand data isolationClustering is part of the engine
One node to start.
Raft when you grow.
Run on your laptop with local disk. Deploy multiple nodes with Multi-Raft replication and leader election. Each node serves clients and live subscriptions.
- Tiered storage. Query hot RocksDB rows and cold Parquet data together.
- Storage you control. Use filesystem or object storage for cold data.
- The same runtime. SQL, functions, topics, and live queries stay together.
Admin UI + CLI for the whole data loop
Browse tables, run SQL, inspect live updates, and manage users in the included admin UI. Use the CLI to develop your app, generate types, and deploy server functions.
Admin UI — SQL Studio & Live Data
LiveA web admin console that ships with every instance. Browse namespaces, inspect tables, and run SQL in the built-in SQL Studio. Turn on Live query to make supportedSELECT queries stream updates as rows change. Explore topics and per-user data without writing app code.
CLI — Init, Dev, and SQL Terminal
LiveScaffold with kalam init, then kalam dev starts the local server, applies schema, and runs your app. The same binary is a Postgres-style SQL terminal for queries, subscriptions, and user management.
Start with 0.8
See your first live query.
Start the released 0.8 server, create a private table in SQL Studio, and watch a live query update when a row changes. No application SDK required.
This starts a local development server; the guide shows initial authentication and live SQL. For production, use unique credentials and secure your exposed ports.
Follow the live-query tutorialdocker run -d --name kalamdb -p 2900:2900 \ -e KALAMDB_SERVER_HOST=0.0.0.0 \ -e KALAMDB_JWT_SECRET="$(openssl rand -base64 32)" \ -e KALAMDB_ALLOW_REMOTE_SETUP=true \ -v kalamdb_data:/data kalamdb/kalamdb:0.8.0 curl http://127.0.0.1:2900/v1/api/auth/statusRun just the server: Download a binary · Docker guide
A few practical details
Before you build.
How does tiered storage work?
Writes land in RocksDB. Configurable flush policies move data from USER and SHARED tables into compressed Parquet files on local disk or object storage. The SQL engine queries both tiers together. STREAM tables use TTL retention instead of Parquet flushing.
How are users and tenants isolated?
USER tables scope rows and live queries to the authenticated or effective user, so the same query returns each user's own data. Cross-user operations require authorized impersonation. For organizations or teams with multiple users, model membership on SHARED tables and enforce it with row-level policies.
Is KalamDB a PostgreSQL replacement?
KalamDB is a Postgres-compatible alternative with its own Rust engine. It supports PostgreSQL syntax and PGWire, so tools such as psql, DBeaver, and PostgreSQL drivers can connect directly. Check the SQL features and extensions your application uses before migrating.
Do I need a separate PostgreSQL server?
No. KalamDB includes its own SQL engine and storage. PGWire connects PostgreSQL clients directly to KalamDB. The optional pg_kalam extension serves a different use case: accessing KalamDB from an existing PostgreSQL server.
Where do server functions run?
JavaScript and compiled TypeScript run in KalamDB's embedded V8 runtime. SQL declares the contracts, the CLI builds and deploys the implementation, and applications invoke functions through generated clients, HTTP, or SQL. Topic triggers can run background procedures.
Can I start with one server and use a cluster later?
Yes. Standalone and clustered deployments use the same engine. Multi-Raft provides replication and leader election, and each node serves its own clients and live subscriptions. Cluster deployments need a cold-storage location accessible to all nodes.
Which SDKs can I use?
Use TypeScript/JavaScript, React, Dart/Flutter, or Rust. The CLI generates TypeScript and Dart contracts from SQL. PostgreSQL drivers and the HTTP/WebSocket APIs provide additional ways to connect.