# tinyplex/tinybase

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/tinyplex-tinybase).**

5,110 stars · 130 forks · TypeScript · MIT

## Links

- GitHub: https://github.com/tinyplex/tinybase
- Homepage: https://tinybase.org
- awesome-repositories: https://awesome-repositories.com/repository/tinyplex-tinybase.md

## Topics

`data` `javascript` `react` `reactive` `typescript`

## Description

TinyBase is a reactive data store and in-memory relational database designed for client-side state persistence. It serves as a local-first sync engine that merges distributed state using conflict-free replicated data types and logical clocks to ensure deterministic data convergence.

The project features a schema validation library that converts external definitions from tools like Zod, Yup, and TypeBox into type-safe store definitions. It provides an infrastructure for real-time collaborative editing, utilizing synchronization with Automerge, Yjs, and PartyKit to maintain consistent state across multiple clients and servers.

The capability surface includes relational data modeling with tables and foreign keys, SQL-like querying and indexing, and atomic transactions for grouped mutations. It supports a wide range of persistence adapters, including browser storage, SQLite, and Cloudflare Durable Objects. The system also provides bidirectional state binding and declarative components for integration with React, SolidJS, and Svelte.

## Tags

### Data & Databases

- [Application State Management](https://awesome-repositories.com/f/data-databases/application-state-management.md) — Provides a reactive system for managing and synchronizing application-wide state using relational tables or key-value pairs. ([source](https://tinybase.org/guides/agents-guide/))
- [Local-First Storage Engines](https://awesome-repositories.com/f/data-databases/local-first-storage-engines.md) — Provides a local-first sync engine that ensures deterministic data convergence using CRDTs and logical clocks.
- [Local-First Data Persistence](https://awesome-repositories.com/f/data-databases/data-engineering-infrastructure/data-persistence-storage/data-storage-architectures/local-first-data-persistence.md) — Uses Conflict-free Replicated Data Types to ensure local-first reconciliation and persistence. ([source](https://tinybase.org/guides/persistence/third-party-crdt-persistence/))
- [Client-Side Persistence](https://awesome-repositories.com/f/data-databases/data-engineering-infrastructure/data-persistence-storage/data-storage/client-side-persistence.md) — Manages data storage directly on user devices and within browser environments to maintain state across sessions.
- [Tabular Row Storage](https://awesome-repositories.com/f/data-databases/database-schema-mapping/row-mapping-logic/row-record-access/tabular-row-storage.md) — Organizes data into structured rows and columns using primary keys for tabular storage. ([source](https://tinybase.org/api/store/type-aliases/store/table/))
- [Deterministic State Merging](https://awesome-repositories.com/f/data-databases/deterministic-state-merging.md) — Ensures deterministic data convergence across instances using CRDT logic and hybrid logical clocks. ([source](https://tinybase.org/api/mergeable-store/interfaces/mergeable/mergeablestore/))
- [In-Memory Databases](https://awesome-repositories.com/f/data-databases/in-memory-databases.md) — Functions as a lightweight in-memory database supporting relational structures, querying, and indexing for low-latency performance.
- [Key-Value Stores](https://awesome-repositories.com/f/data-databases/key-value-stores.md) — Provides a lightweight key-value storage system for persisting application state. ([source](https://tinybase.org/api/the-essentials/creating-stores/store/))
- [Relational Data Modeling](https://awesome-repositories.com/f/data-databases/relational-data-modeling.md) — Organizes data into a hierarchy of tables and rows using foreign keys to model complex entity relationships.
- [Automerge Synchronizations](https://awesome-repositories.com/f/data-databases/automerge-synchronizations.md) — Provides synchronization between the local data store and Automerge documents to maintain consistent state across clients. ([source](https://tinybase.org/api/persister-automerge))
- [Client-Server State Synchronization](https://awesome-repositories.com/f/data-databases/client-server-state-synchronization.md) — Synchronizes local client state with a remote PartyKit server to maintain coherence across distributed environments. ([source](https://tinybase.org/api/persister-partykit-client))
- [Atomic Transaction Execution](https://awesome-repositories.com/f/data-databases/data-integration-synchronization/data-integration/database-integrations/atomic-transaction-execution.md) — Groups multiple data changes into atomic transactions to ensure consistent application of state mutations. ([source](https://tinybase.org/guides/the-basics/))
- [Data Persistence](https://awesome-repositories.com/f/data-databases/data-persistence.md) — Automatically synchronizes the in-memory data store with a persistence layer by listening for state changes. ([source](https://tinybase.org/guides/persistence/an-intro-to-persistence/))
- [Data Schema Definitions](https://awesome-repositories.com/f/data-databases/data-schema-definitions.md) — Provides declarative systems for defining tabular data structures and enforcing value types. ([source](https://tinybase.org/api/store/type-aliases/schema/tablesschema/))
- [Database Indexing](https://awesome-repositories.com/f/data-databases/database-indexing.md) — Creates indexes that allow rapid retrieval of matching row objects within large data tables. ([source](https://tinybase.org/guides/))
- [SQL-like Queries](https://awesome-repositories.com/f/data-databases/distributed-sql-querying/sql-like-queries.md) — Performs fast lookups via indexes and executes SQL-like operations including joins and filters. ([source](https://tinybase.org/guides/agents-guide/))
- [General State Persistence](https://awesome-repositories.com/f/data-databases/general-state-persistence.md) — Saves data to a storage medium so that state is maintained across sessions and page reloads. ([source](https://tinybase.org/demos/))
- [Durable Object Persistence](https://awesome-repositories.com/f/data-databases/object-storage/stateful-durable-objects/durable-object-persistence.md) — Saves a data store to Cloudflare Durable Objects using JSON serialization or fragmented SQL rows. ([source](https://tinybase.org/guides/integrations/cloudflare-durable-objects/))
- [Relational Join Engines](https://awesome-repositories.com/f/data-databases/relational-join-engines.md) — Combines information from multiple tables by linking related records through foreign keys. ([source](https://tinybase.org/demos/))
- [Relationship Management](https://awesome-repositories.com/f/data-databases/relationship-management.md) — Defines and tracks relationships between different entities within the data store. ([source](https://tinybase.org/api/))
- [Schema Validation Libraries](https://awesome-repositories.com/f/data-databases/schema-validation-libraries.md) — Provides a schema validation library that converts Zod, Yup, and TypeBox definitions into type-safe store structures.
- [SQLite or PostgreSQL Storage](https://awesome-repositories.com/f/data-databases/sqlite-drivers/sqlite-storage-adapters/sqlite-or-postgresql-storage.md) — Persists application state to SQLite or PostgreSQL databases using JSON blobs or tabular mapping. ([source](https://tinybase.org/guides/persistence/database-persistence/))
- [Pluggable State Backends](https://awesome-repositories.com/f/data-databases/sqlite-storage-adapters/pluggable-state-backends.md) — Offers a pluggable architecture to switch between different storage backends like IndexedDB, SQLite, or cloud objects.
- [Browser Storage Persistence](https://awesome-repositories.com/f/data-databases/state-persistence/browser-storage-persistence.md) — Saves and loads application data using browser-native storage like session storage, local storage, or OPFS. ([source](https://tinybase.org/api/persister-browser))
- [Third-Party Sync Integrations](https://awesome-repositories.com/f/data-databases/third-party-sync-integrations.md) — Integrates the local store with external synchronization platforms and CRDT libraries to leverage cloud infrastructure. ([source](https://tinybase.org/guides/the-basics/architectural-options/))
- [Store API Type Safety](https://awesome-repositories.com/f/data-databases/type-safe-query-builders/schema-inferred-type-safety/store-api-type-safety.md) — Infers API types from defined schemas to provide type constraints for store methods and listeners. ([source](https://tinybase.org/guides/schemas/schema-based-typing/))

### DevOps & Infrastructure

- [Local-First Synchronization](https://awesome-repositories.com/f/devops-infrastructure/local-first-synchronization.md) — Implements a local-first architecture that prioritizes offline data access with conflict-free remote synchronization.
- [State Storage Implementations](https://awesome-repositories.com/f/devops-infrastructure/custom-storage-adapters/state-storage-implementations.md) — Allows definition of custom logic to fetch, write, and monitor changes in external storage backends. ([source](https://tinybase.org/guides/persistence/custom-persistence/))

### Business & Productivity Software

- [Data Change Listeners](https://awesome-repositories.com/f/business-productivity-software/data-change-listeners.md) — Registers callbacks that trigger automatically when specific values, tables, or cells are modified. ([source](https://tinybase.org/guides/the-basics/))

### Development Tools & Productivity

- [Mutable State Tracking](https://awesome-repositories.com/f/development-tools-productivity/change-tracking/state-tracking-utilities/frontend-state-tracking/mutable-state-tracking.md) — Tracks changes to data and triggers listeners on specific entities to update the UI. ([source](https://cdn.jsdelivr.net/gh/tinyplex/tinybase@main/README.md))

### Software Engineering & Architecture

- [Reactive Data Stores](https://awesome-repositories.com/f/software-engineering-architecture/architectural-design-patterns/state-management/reactive-subscription-systems/reactive-data-stores.md) — Initializes a central reactive state container to manage and synchronize application data. ([source](https://tinybase.org/guides/the-basics/creating-a-store/))
- [Deterministic State Convergence](https://awesome-repositories.com/f/software-engineering-architecture/concurrent-state-merging/deterministic-state-convergence.md) — Uses hybrid logical clocks and last-write-wins logic to ensure deterministic state convergence across distributed data stores.
- [CRDT State Synchronization Engines](https://awesome-repositories.com/f/software-engineering-architecture/crdt-state-synchronization-engines.md) — Provides a synchronization engine using conflict-free replicated data types to maintain consistency across distributed clients.
- [Sync Conflict Resolution](https://awesome-repositories.com/f/software-engineering-architecture/sync-conflict-resolution.md) — Implements processes for detecting and resolving version mismatches and conflicts between synchronized datasets. ([source](https://tinybase.org/guides/synchronization/))
- [Atomic Transaction Grouping](https://awesome-repositories.com/f/software-engineering-architecture/atomic-transaction-grouping.md) — Bundles multiple state mutations into a single atomic operation to prevent intermediate listeners from firing.
- [Operation Interceptors](https://awesome-repositories.com/f/software-engineering-architecture/request-interception-middleware/operation-interceptors.md) — Provides operation interceptors that run before data writes to validate, modify, or block mutations.
- [Server-Side Sources of Truth](https://awesome-repositories.com/f/software-engineering-architecture/server-side-sources-of-truth.md) — Establishes a server-side store as the authoritative source of truth that persists data and synchronizes with clients. ([source](https://tinybase.org/guides/the-basics/architectural-options))
- [Schema-Driven Type Inference](https://awesome-repositories.com/f/software-engineering-architecture/typescript-type-definitions/schema-driven-type-inference.md) — Automatically derives static TypeScript type definitions from internal runtime store schemas for type-safe operations.
- [Schema Type Inference](https://awesome-repositories.com/f/software-engineering-architecture/typescript-type-definitions/schema-driven-type-inference/schema-type-inference.md) — Generates TypeScript type definitions based on active data schemas for improved type safety. ([source](https://tinybase.org/guides/schemas/))
- [Write Interception Middleware](https://awesome-repositories.com/f/software-engineering-architecture/write-interception-middleware.md) — Registers hooks that run before data is written to intercept, modify, or block updates based on validation rules. ([source](https://tinybase.org/api/middleware/))

### User Interface & Experience

- [Fine-Grained Reactivity](https://awesome-repositories.com/f/user-interface-experience/fine-grained-reactivity.md) — Tracks data dependencies at the cell, row, and table level to trigger high-performance, fine-grained UI updates.
- [Bidirectional Data-Binding](https://awesome-repositories.com/f/user-interface-experience/bidirectional-data-binding.md) — Synchronizes interface components with the data store by automatically updating views and writing user input back. ([source](https://tinybase.org/guides/building-uis-with-svelte/using-reactive-functions/))
- [SolidJS Bindings](https://awesome-repositories.com/f/user-interface-experience/data-binding-frameworks/solidjs-bindings.md) — Connects the reactive data store to SolidJS components using fine-grained accessors for automatic updates. ([source](https://tinybase.org/guides/building-uis-with-solid/))
- [Declarative UI Components](https://awesome-repositories.com/f/user-interface-experience/declarative-ui-components.md) — Provides pre-built declarative components to display specific parts of the data store. ([source](https://tinybase.org/guides/building-uis-with-svelte/))
- [Svelte Bindings](https://awesome-repositories.com/f/user-interface-experience/framework-bindings/svelte-bindings.md) — Creates reactive objects that automatically update Svelte user interface elements when the store changes. ([source](https://tinybase.org/guides/building-uis-with-svelte/))
- [Real-Time Collaborative Editing](https://awesome-repositories.com/f/user-interface-experience/real-time-collaborative-editing.md) — Synchronizes data changes across multiple users instantly for simultaneous editing of shared interfaces.
- [Update Batching](https://awesome-repositories.com/f/user-interface-experience/update-batching.md) — Groups multiple store modifications into a single transaction to prevent redundant listener triggers. ([source](https://tinybase.org/api/the-essentials/creating-stores/store/))

### Web Development

- [Client-Side State Management](https://awesome-repositories.com/f/web-development/client-side-state-management.md) — Provides a comprehensive mechanism for managing application state within the browser and persisting it to local or remote storage.
- [Reactive State Management](https://awesome-repositories.com/f/web-development/reactive-state-management.md) — Uses a reactive store to automatically update the user interface when the underlying application state changes.
- [Undo-Redo History](https://awesome-repositories.com/f/web-development/history-management/undo-redo-history.md) — Tracks state changes over time to allow users to revert to previous versions or re-apply changes. ([source](https://tinybase.org/guides/))
- [React State Bindings](https://awesome-repositories.com/f/web-development/react-state-bindings.md) — Provides specialized bindings that connect the reactive data store to React UI components. ([source](https://tinybase.org/guides/building-uis-with-react/))
- [Yjs Document Synchronizations](https://awesome-repositories.com/f/web-development/websocket-integrations/real-time-sync-engines/yjs-document-synchronizations.md) — Persists application state to Yjs documents to enable real-time collaborative synchronization and shared data. ([source](https://tinybase.org/api/persister-yjs/functions/creation/createyjspersister))

### Networking & Communication

- [Multi-Transport Real-time Layers](https://awesome-repositories.com/f/networking-communication/real-time-event-streams/multi-transport-real-time-layers.md) — Uses multi-transport layers including WebSockets and BroadcastChannels to exchange real-time state updates. ([source](https://tinybase.org/guides/agents-guide/))

### Part of an Awesome List

- [Miscellaneous Tools](https://awesome-repositories.com/f/awesome-lists/more/miscellaneous-tools.md) — Reactive data store for local-first applications.
