Barq is an offline-first object database for JavaScript and React Native, with optional synchronization powered by barq-core.
Barq JS is a modified fork of the Realm JavaScript SDK. It keeps the fast, reactive local database and reshapes synchronization around barq-core's token-based sync users — the Atlas Device Sync and App Services layers are removed, and there is no bundled BSON dependency. See NOTICE for fork attribution.
| npm package | Path | Description |
|---|---|---|
@barqdb/barq |
packages/barq |
The core database SDK (native, binds barq-core) |
@barqdb/react |
packages/react |
React / React Native hooks and providers |
@barqdb/babel-plugin |
packages/babel-plugin |
Babel plugin for schema-from-class syntax |
@barqdb/common |
packages/common |
Cross-package shared utilities |
@barqdb/fetch |
packages/fetch |
Minimal fetch abstraction |
@barqdb/tools |
packages/tools |
Developer tooling |
@barqdb/mocha-reporter |
packages/mocha-reporter |
Mocha reporter used by the test suites |
npm install @barqdb/barq
# React Native hooks:
npm install @barqdb/reactimport { Barq } from "@barqdb/barq";
class Task extends Barq.Object<Task> {
_id!: Barq.Types.ObjectId;
description!: string;
done = false;
static schema: Barq.ObjectSchema = {
name: "Task",
primaryKey: "_id",
properties: {
_id: "objectId",
description: "string",
done: { type: "bool", default: false },
},
};
}
const barq = await Barq.open({ schema: [Task] });
barq.write(() => {
barq.create(Task, { _id: new Barq.Types.ObjectId(), description: "Ship Barq" });
});Barq does not perform authentication itself. Obtain a signed access token from your own identity provider, build a token-based sync user, and open a synced database:
import { Barq } from "@barqdb/barq";
const user = Barq.User.fromToken(tenantId, userId, accessToken, { route: "https://sync.example.com" });
const barq = await Barq.open({
schema: [Task],
sync: { user, flexible: true },
});
// Flexible-sync subscriptions
await barq.subscriptions.update((mutable) => {
mutable.add(barq.objects(Task));
});Value types (ObjectId, UUID, Decimal128, Binary) are provided by Barq
under Barq.Types — see packages/barq/src/types.
Barq ships its own value types (no third-party BSON dependency):
Barq.Types.ObjectIdBarq.Types.UUIDBarq.Types.Decimal128Barq.Types.BinaryBarq.Types.EJSON
CI builds the barq-core native engine and the Barq value types on every push. See BUILDING.md for the build matrix and the status of the native @barqdb/barq addon.
- Stabilize the
@barqdb/*package surface - Publish React Native examples that are easy to run
- Keep native builds aligned with barq-core releases
- Improve docs for token-based sync users