Skip to main content
Documentation for 5.x

Typed collections for PouchDB.

PouchORM adds models, named collections, validation, query helpers, and synchronization management while keeping the PouchDB database available when you need it.

people.tsTypeScript
import { IModel, PouchCollection } from "pouchorm";

interface Person extends IModel {
name: string;
age: number;
}

class People extends PouchCollection<Person> {
constructor() {
super({
database: "app-data",
// Stored with each document, so keep this name stable.
collection: "people",
});
}
}

const people = new People();
// No _id means upsert creates a document with a UUIDv7.
const ada = await people.upsert({
name: "Ada Lovelace",
age: 36,
});

A small layer over the database you already use

Stable collection identity

Choose the collection name stored with each document. Production builds and class renames cannot change it.

Predictable writes

Create and update through one method, retain PouchDB revisions, validate models, and handle conflicts without changing caller-owned objects.

PouchDB remains available

Use the underlying database for attachments, plugins, and platform-specific adapters when the collection API is not the right level.

Using PouchORM 4?

Review the breaking changes before upgrading.

Version 5 requires stable collection names, a PouchDB peer dependency, and explicit validator registration.

Read the migration guide