GoatDB empowers you to build and deploy complex, scalable, and secure applications in under 20 minutesβwithout requiring backend expertise. It's the fastest and easiest way to create modern apps, tailored for today's developer needs.
GoatDB is a real-time, distributed Version Control Database (VCDB). By running tasks like reading and writing on the client side, it ensures fast performance and offline functionality. With causal consistency and an edge-native design, GoatDB simplifies development and supports scalable, modern workloads.
π If you like what we're building, please star βοΈ our project. We really appreciate it! π
-
Navigate to your project directory:
cd /path/to/project
-
Add GoatDB to your project:
deno add jsr:@goatdb/goatdb
-
Initialize GoatDB:
deno run -A jsr:@goatdb/goatdb/init
These steps install GoatDB and set up the underlying a project skaffold for your application.
import { useDB, useItem, useQuery } from '@goatdb/goatdb/react';
// Define your schema
const kSchemaTask = {
ns: 'task',
version: 1,
fields: {
text: { type: 'string', required: true },
done: { type: 'boolean', default: () => false },
},
} as const;
// Use hooks in your components
function TaskList() {
const db = useDB();
// Query tasks sorted by text
const query = useQuery({
schema: kSchemaTask,
source: `/data/${db.currentUser!.key}`,
sortDescriptor: ({ left, right }) =>
left.get('text').localeCompare(right.get('text')),
});
return (
<div>
{query.results().map(({ path }) => <TaskItem key={path} path={path} />)}
</div>
);
}
function TaskItem({ path }) {
// Subscribe to changes for a specific task
const task = useItem(path);
return (
<div>
<input
type='checkbox'
checked={task.get('done')}
onChange={(e) => task.set('done', e.target.checked)}
/>
<input
type='text'
value={task.get('text')}
onChange={(e) => task.set('text', e.target.value)}
/>
</div>
);
}
import { GoatDB } from '@goatdb/goatdb';
// Initialize DB
const db = new GoatDB({
path: '/data/db',
peers: 'https://api.example.com',
});
// Create a new task
const task = db.create('/data/user123', kSchemaTask, {
text: 'Buy groceries',
done: false,
});
// Update task
task.set('done', true);
// Query tasks
const query = db.query({
schema: kSchemaTask,
source: '/data/user123',
predicate: ({ item }) => !item.get('done'),
});
// Subscribe to query updates
query.on('ResultsChanged', () => {
console.log('Active tasks:', query.results());
});
GoatDB currently runs on Deno and we're actively working on supporting additional JavaScript runtimes including:
- Node.js
- Bun
- Cloudflare Workers
- Other edge runtimes
Stay tuned for updates as we expand runtime compatibility!
GoatDB currently provides first-class support for React through our React hooks API. We're actively working on supporting additional UI frameworks to make GoatDB accessible to more developers.
GoatDB is designed to address a variety of scenarios, making it a versatile solution for modern applications. Below are the primary use cases:
Synchronize data across multiple devices in real-time, ensuring consistency and seamless user experience.
Enable reliable communication and state synchronization between autonomous agents in multi-agent systems, with built-in conflict resolution and eventual consistency guarantees.
Create secure data sandboxes to validate LLM outputs and prevent hallucinations, allowing safe experimentation with AI models without compromising the main dataset.
Support for vector embeddings and similarity search is in development (tracking issue), enabling semantic search and AI-powered features.
Serve as a lightweight, self-contained ETL (Extract, Transform, Load) pipeline, leveraging GoatDB's schema validation and distributed processing capabilities to efficiently transform and migrate data between systems.
Facilitate smooth transitions between different database systems by using GoatDB as an intermediary layer, allowing gradual migration of data and functionality while maintaining application stability.
Enable continuous functionality even during server downtime, ensuring your application remains reliable and responsive.
Move data end-to-end between clients, ensuring that sensitive information is never exposed to the central server.
Allow multiple users to collaboratively edit and share the same data, perfect for teamwork and shared workflows.
Support fast product iteration cycles with flexible compatibility for frequent schema or structural changes.
Protect against fraudulent data manipulation and maintain trust by preventing unauthorized modifications.
Optimize for cost and performance in read-intensive workloads, making your application more efficient.