Home
Softono
goatdb

goatdb

Open source MIT TypeScript
569
Stars
17
Forks
9
Issues
5
Watchers
1 week
Last Commit

About goatdb

A peer-to-peer database that spans devices. For apps and agents that work everywhere.

Platforms

Web Self-hosted

Languages

TypeScript

GoatDB Logo


GoatDB: Embedded, Distributed, Document Database

📚 Documentation • ⚡ Benchmarks • 💬 Discussions • 👋 Discord

Tests License: MIT JSR npm

GoatDB is an embedded, distributed document database that prioritizes speed and developer experience. Build real-time collaborative apps that work offline.

Inspired by distributed version control systems, GoatDB brings Git-like features to databases: cryptographically signed commits, three-way merges, and automatic conflict resolution. TypeScript-first with React hooks included.

What makes GoatDB different?

  • Works offline: Changes sync automatically when reconnected
  • Instant UI updates: Local changes are instant, no loading states
  • Smart conflict resolution: Git-style three-way merge for live data
  • Self-healing: Clients can restore crashed servers from the commit graph

GoatDB is under active development. Star ⭐️ our project if you like the approach!

[!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.

Quick Start

Deno (recommended):

deno add jsr:@goatdb/goatdb
deno run -A jsr:@goatdb/goatdb init   # scaffold a new project

Node.js (24+):

npx jsr add @goatdb/goatdb
npx -y @goatdb/goatdb init            # scaffold a new project

Basic Usage

import { DataRegistry, GoatDB } from '@goatdb/goatdb';

const kSchemaTask = {
  ns: 'task',
  version: 1,
  fields: {
    text: { type: 'string', required: true },
    done: { type: 'boolean', default: () => false },
  },
} as const;
DataRegistry.default.registerSchema(kSchemaTask);

const db = new GoatDB({ path: './data' });
await db.readyPromise();

const item = db.create('/data/todos', kSchemaTask, {
  text: 'Hello, GoatDB!',
});
item.set('done', true);

React Integration

GoatDB includes React hooks for real-time, offline-capable UIs. See the React documentation.

See the tutorial for more examples.

Contributing

We welcome contributions! See the contributing guide for setup instructions and guidelines.

License

GoatDB is licensed under the MIT License.