Official TinyDB TypeScript client SDK
npm install @tinydb/clientThis package provides an ergonomic TypeScript client for TinyDB. It mirrors the scenarios described in docs/CLIENT_SDK.md and exposes helpers for working with collections, documents, queries, and schema management from Node.js or modern browsers.
> Status: Work in progress. The public surface may change before the first stable release.
``bash`
npm install @tinydb/client
`ts
import { TinyDB } from '@tinydb/client';
const db = new TinyDB({
endpoint: process.env.TINYDB_ENDPOINT ?? 'http://localhost:8080',
apiKey: process.env.TINYDB_API_KEY!,
appId: process.env.TINYDB_APP_ID,
offlineMode: true,
});
const users = await db
.collection('users')
.schema({
fields: {
name: { type: 'string', required: true },
role: { type: 'string' },
age: { type: 'number' },
},
})
.sync();
const created = await users.create({
name: 'Sambo',
role: 'Developer',
age: 29,
});
console.log(Document version: ${created.version});
const refreshed = await users.get(created.id);
`
Refer to the project documentation for more end-to-end use cases.
- See example code — CLI script that connects to a real TinyDB API (requires endpoint + API key). Demonstrates collection creation, document CRUD, querying, and sync.
- Full API Reference — Comprehensive reference for all SDK classes, methods, and types.
- API Examples — 50+ practical code examples for common tasks.
`bash`
npm install
npm run build
npm test
To create a release and publish to npm:
`bash`
npm run release
This script will:
1. Read the version from package.jsonv{version}
2. Create a git tag with format (e.g., v0.1.0)
3. Push the tag to origin
4. Trigger the GitHub Actions publish workflow
5. Automatically build and publish to npm
For detailed information, see scripts/TAG-RELEASE.md`.
- Sambo Chea
MIT © CUBIS Labs