Move the local database first. Keep sync out of the first change so you can test schemas, writes, live queries, and migrations in isolation.
Install the BarqDB database and React packages, then replace the import boundary around your data layer.
npm install @barqdb/barq @barqdb/reactOpen a local BarqDB file
The tested JavaScript quick start uses a class schema, a write transaction, and a live Results collection.
import { Barq } from '@barqdb/barq'
const barq = await Barq.open({ schema: [Task] })
barq.write(() => {
barq.create(Task, {
_id: new Barq.Types.ObjectId(),
description: 'Ship BarqDB',
})
})
const openTasks = barq.objects(Task).filtered('done == false')Add React hooks after the data layer works
Wrap the app in BarqProvider, then move screens to useBarq, useQuery, and useObject. Test notification timing and component updates before adding sync.
Do not reuse a production Realm file without a tested file conversion. Export and import data through an explicit migration when formats differ.