@canvas-js/okra
A Prolly tree written in Zig, that enables fast peer-to-peer sync for application histories.
Canvas is a replicated database with an embedded runtime, that lets you write multiplayer TypeScript applications with complex logic and instant sync.
Write your core application logic in a replicated contract, that syncs over libp2p. Users' actions are applied instantly on their machine, and merged seamlessly with others' actions.
Handle conflicts with CRDTs, the data structures that Figma and Linear use to make their UI fast. Or, we also support optimistic rollback, for MMO-style game sync
It's fully open source, and built on SQLite, Postgres, and IndexedDB.
import { useCanvas } from "@canvas-js/hooks"
const contract = {
models: {
messages: {
id: "primary",
text: "string",
}
},
actions: {
createMessage: (db, { text }, { address, msgid }) => {
db.set("messages", { id: msgid, text })
}
}
}
const { app } = useCanvas({ topic: "demo.canvas.xyz", contract })
export const contract = {
models: {
messages: {
id: "primary",
text: "string"
}
},
actions: {
createMessage: (db, { text }, { address, txid }) => {
db.set("messages", { id: txid, text })
}
}
}
$ canvas run contract.ts --topic demo.canvas.xyz
Every Canvas application runs on a distributed log that stores a history of users' actions.
When new applications are started up, they catch up on history using efficient sync to catch up on the latest state.
On top of the sync layer, we've written a peer-to-peer runtime that sandboxes users' actions, that executes them in a deterministic environment to maintain convergence and mergeability.
Now you can develop multiplayer games, local-first applications, and realtime applications with instant responsiveness, while maintaining strong decentralization properties.
For demanding applications, you can shard an application into multiple state containers, and state containers can be snapshotted and compacted as they grow.
To learn more, check out our docs, or join us on Github and Discord.
A Prolly tree written in Zig, that enables fast peer-to-peer sync for application histories.
A self-authenticating distributed log for multi-writer applications.
A cross-platform relational database wrapper for IDB, SQLite, and Postgres.
Log in with an Ethereum wallet. Also supports Cosmos, Solana, and Polkadot.
Log in with your decentralized identity from the Bluesky PLC network.
Log in trustlessly with Google, Apple, or other SSO providers.
In development