tinybase

Acting as a TinyBase expert to help developers build local-first, reactive data storage applications. Supports offline capability, structured tables, automatic reactivity, CRDT-based synchronization, and persistence to IndexedDB/SQLite/Postgres, with relation modeling—providing a full client-side database that can sync across devices without a custom backend.

Last repository push
GitHub Stars
219
Forks
38
Issues / PRs
7

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "tinybase" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-8b6c706f135afcdfcc1791a8f33a6208204d7b9550d297824bc0d4df460652e4. Verify the upstream source and version against https://github.com/TerminalSkills/skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Acting as a TinyBase expert to help developers build local-first, reactive data storage applications. Supports offline capability, structured tables, automatic reactivity, CRDT-based synchronization, and persistence to IndexedDB/SQLite/Postgres, with relation modeling—providing a full client-side database that can sync across devices without a custom backend.

0 Downloads

Introduction source: third_party · TerminalSkills · 1.0.0 Reference

SkillPi interpretation

Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: tinybase
description: >-
  You are an expert in TinyBase, the reactive data store for local-first
  applications. You help developers build offline-capable apps with structured
  tables, automatic reactivity, CRDT-based sync, persistence to
  IndexedDB/SQLite/Postgres, and relationship modeling — providing a complete
  client-side database that syncs across devices without a custom backend.
license: Apache-2.0
compatibility: ''
metadata:
  author: terminal-skills
  version: 1.0.0
  category: Frontend Development
  tags:
    - state-management
    - reactive
    - local-first
    - sync
    - crdt
    - offline
    - database

TinyBase — Reactive Data Store for Local-First Apps

You are an expert in TinyBase, the reactive data store for local-first applications. You help developers build offline-capable apps with structured tables, automatic reactivity, CRDT-based sync, persistence to IndexedDB/SQLite/Postgres, and relationship modeling — providing a complete client-side database that syncs across devices without a custom backend.

Core Capabilities

Store

import { createStore, createQueries, createRelationships } from "tinybase";
import { createLocalPersister } from "tinybase/persisters/persister-browser";

// Create store with tables
const store = createStore()
  .setTablesSchema({
    todos: {
      text: { type: "string" },
      done: { type: "boolean", default: false },
      priority: { type: "number", default: 0 },
      categoryId: { type: "string" },
    },
    categories: {
      name: { type: "string" },
      color: { type: "string" },
    },
  });

// Add data
store.setRow("todos", "t1", { text: "Build app", done: false, priority: 1, categoryId: "c1" });
store.setRow("todos", "t2", { text: "Ship it", done: false, priority: 2, categoryId: "c1" });
store.setRow("categories", "c1", { name: "Work", color: "#3b82f6" });

// Queries
const queries = createQueries(store);
queries.setQueryDefinition("activeTodos", "todos",
  ({ select, where, order }) => {
    select("text");
    select("priority");
    where("done", false);
    order("priority", true);              // Descending
  },
);

// Relationships
const relationships = createRelationships(store);
relationships.setRelationshipDefinition("todoCategory", "todos", "categories", "categoryId");

// Reactivity — listener fires on any change
store.addRowListener("todos", null, (store, tableId, rowId) => {
  console.log(`Todo ${rowId} changed:`, store.getRow(tableId, rowId!));
});

// Persist to IndexedDB
const persister = createLocalPersister(store, "my-app");
await persister.startAutoLoad();          // Load on startup
await persister.startAutoSave();          // Save on every change

React Integration

import { Provider, useRow, useTable, useResultTable, useCell } from "tinybase/ui-react";

function App() {
  return (
    <Provider store={store} queries={queries}>
      <TodoList />
    </Provider>
  );
}

function TodoList() {
  const activeTodos = useResultTable("activeTodos");  // Auto-updates on data change
  return (
    <ul>
      {Object.entries(activeTodos).map(([id, todo]) => (
        <TodoItem key={id} id={id} />
      ))}
    </ul>
  );
}

function TodoItem({ id }: { id: string }) {
  const done = useCell("todos", id, "done");          // Subscribes to single cell
  const text = useCell("todos", id, "text");
  return (
    <li onClick={() => store.setCell("todos", id, "done", !done)}
      style={{ textDecoration: done ? "line-through" : "none" }}>
      {text}
    </li>
  );
}

CRDT Sync

import { createWsSynchronizer } from "tinybase/synchronizers/synchronizer-ws-client";
import { createMergeableStore } from "tinybase";

// Mergeable store (CRDT-based, conflict-free)
const store = createMergeableStore();

// Sync via WebSocket
const synchronizer = createWsSynchronizer(store, new WebSocket("wss://sync.example.com"));
await synchronizer.startSync();

// Now any device with the same store syncs automatically
// Offline changes merge cleanly when reconnected

Installation

npm install tinybase

Best Practices

  1. Local-first — Data lives on the client; works offline, syncs when online; instant UI responses
  2. Fine-grained reactivity — Use useCell for single value subscriptions; only re-renders what changed
  3. CRDT sync — Use MergeableStore for multi-device sync; conflicts resolve automatically
  4. Queries — Define queries with select/where/order; reactive, auto-update when underlying data changes
  5. Relationships — Model foreign keys with setRelationshipDefinition; navigate between tables
  6. Persistence — Auto-save to IndexedDB, SQLite (via OPFS), or remote Postgres; seamless persistence
  7. Tiny bundle — Core is ~5KB gzipped; add only the modules you need (queries, relationships, sync)
  8. Schema validation — Define table schemas for type safety; rejects invalid data at write time

Current listing version

1.0.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value92/100

Highlights

  • TinyBase 提供完整的本地优先数据库解决方案,涵盖数据存储、响应式 UI、CRDT 同步和持久化等核心能力
  • 面向前端开发者解决离线应用、跨设备同步等实际痛点,具备高频刚需价值
Trigger Precision95/100

Highlights

  • description 明确描述 TinyBase 专家角色,覆盖 'reactive data store'、'local-first'、'CRDT sync' 等核心关键词
  • 触发词精准完整,边界清晰,能有效引导目标用户使用
Structure and Standards90/100

Highlights

  • 文档结构清晰,分 Core Capabilities、React Integration、CRDT Sync、Installation、Best Practices 等逻辑章节
  • 提供完整 TypeScript/React 代码示例,步骤明确,frontmatter 信息完整
Execution Reliability88/100

Highlights

  • 提供标准 npm 安装命令,代码示例参数正确,涵盖主要使用场景
  • 无不可逆操作,执行流程可靠
Evidence Verifiability (mean of the first four)91/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

  • Install or fetch external dependencies

    Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.

    Mentioned in main document · lines 139

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.