Skip to content
BarqDBPublic

About

Reactive object database SDK for JavaScript, Node, and React Native — live queries, HNSW vector search, and realtime sync, powered by barq-core.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

39 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Barq JS

License Status TypeScript React Native

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.

Packages

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

Install

npm install @barqdb/barq
# React Native hooks:
npm install @barqdb/react

Quick start (local database)

import { 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" });
});

Sync with barq-core

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.

Data types

Barq ships its own value types (no third-party BSON dependency):

  • Barq.Types.ObjectId
  • Barq.Types.UUID
  • Barq.Types.Decimal128
  • Barq.Types.Binary
  • Barq.Types.EJSON

Building

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.

Roadmap

  • 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

License

Apache License 2.0. See LICENSE and NOTICE.

About

Reactive object database SDK for JavaScript, Node, and React Native — live queries, HNSW vector search, and realtime sync, powered by barq-core.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages