š Documentation ⢠┠Benchmarks ⢠š¬ Discussions ⢠š Discord
GoatDB is an embedded, distributed, document database that prioritizes speed and developer experience. It excels at real-time collaboration and embedded caching applications.
Instead of following traditional database design patterns, GoatDB leverages concepts refined over decades by distributed version control systems. These are enhanced with novel algorithms for efficient synchronization and automatic real-time conflict resolution.
Currently optimized for TypeScript environments, GoatDB functions as a first-class citizen in both browsers and servers. It utilizes a document model with schemas, providing causal eventual consistency to simplify development while offering built-in optional cryptographic signing for the underly C837 ing commit graph.
What makes GoatDB different?
- Repository-centric: Each repository is a self-contained unit, enabling natural sharding, isolation, and fine-grained access control.
- Stateless, probabilistic sync: Synchronization uses iterative Bloom filter exchanges for efficient, low-latency, and transport-agnostic convergenceāno persistent sync state required.
- Deterministic, incremental queries: Queries are first-class, track their own commit history, and process only new changesāenabling real-time, reactive data flows without full recomputation.
- Ephemeral CRDT-based conflict resolution: Conflicts are resolved automatically and efficiently using a three-way merge with short-lived CRDTs, tailored for scalable, distributed collaboration.
- Memory-first, append-only storage: All active data is in memory for speed; the on-disk format is a simple, append-only log for reliability and easy backup.
GoatDB is under active development. If you're interested in a new approach to distributed data, we invite you to explore further and contribute. And please, star āļø our project. We really appreciate it! š
Warning
Please keep in mind that GoatDB is still under active development and therefore full backward compatibility is not guaranteed before reaching v1.0.0. For more details, see the FAQ.
Install in Deno (recommended):
deno add jsr:@goatdb/goatdb
import { GoatDB } from '@goatdb/goatdb';
const db = new GoatDB({ path: './data', peers: ['http://10.0.0.1'] });
const item = db.create('/todos', { text: 'Hello, GoatDB!', done: false });
item.set('done', true);
GoatDB provides a set of ergonomic React hooks for building real-time,
offline-capable UIs with minimal boilerplate. These hooks offer a complete state
management solution for React appsāhandling database initialization, loading
state, live queries, and item updatesāall with automatic synchronization and
efficient reactivity. Hooks like useDB
,
useDBReady
,
useQuery
, and
useItem
make it easy to manage your
application's data layer. See the Concepts and
Reading and Writing Data docs for more
background.
Example:
function TaskList() {
const tasks = useQuery({
schema: taskSchema, // see https://goatdb.dev/schema/
source: '/tasks',
predicate: (item) => !item.get('done'), // see https://goatdb.dev/query/
});
return (
<ul>
{tasks.results().map((task) => (
<li key={task.path}>
<TaskEditor path={task.path} />
</li>
))}
</ul>
);
}
function TaskEditor({ path }) {
const task = useItem(path, { keys: ['text', 'done'] }); // see https://goatdb.dev/read-write-data/
if (!task) return <span>Loading...</span>;
return (
<input
value={task.get('text')}
onChange={(e) => task.set('text', e.target.value)}
/>
);
}
For details and examples, see the React documentation.
For full installation and usage details, see the installation guide and tutorial.
GoatDB is open source under the Apache 2.0 license. We welcome issues, discussions, and pull requests. To get started:
- Fork the repository
- Create a branch for your changes
- Submit a pull request
For local development, you can link GoatDB into your project:
deno run -A jsr:@goatdb/goatdb/link link ./path/to/goatdb
To unlink GoatDB, run:
deno run -A jsr:@goatdb/goatdb/link unlink
GoatDB is licensed under the Apache 2.0 License.