Skip to main content
tinykit uses Pocketbase, an embedded SQLite database that runs alongside your app. Create collections, store records, and get realtime updates—all without setting up external infrastructure.
Database panel

Data tab showing a voice memos collection

How It Works

  1. The AI (or you) creates a collection (like a database table)
  2. Collections store records (rows of data)
  3. Your code accesses data via import data from '$data'
  4. Changes sync in realtime across all connected clients
  5. The Data tab lets you browse and edit records visually

Data Tab Overview

The Data tab shows all your collections:
Database collections
Features:
  • View all collections on the left
  • Browse records for selected collection
  • Add, edit, and delete records
  • Create new collections with custom schemas
  • Export data as JSON

Accessing Data in Code

Import and Subscribe

CRUD Operations

All operations trigger realtime updates automatically.

Column Types

When creating collections, choose appropriate column types:

Schema Inference

If you create records without defining a schema, tinykit infers types from the first record:

Creating Collections

Via the AI

Ask the AI to create collections:
The AI will:
  1. Create a recipes collection
  2. Define the schema (title, ingredients, instructions)
  3. Wire up the code to use the collection

Via the Data Tab

  1. Click Add Collection
  2. Enter a name (lowercase, underscores allowed)
  3. Add columns with names and types
  4. Click Create

Via Code

If you reference a collection that doesn’t exist, you can create it by adding the first record:

Common Patterns

Loading State

Always show loading indicators:

Filtering Data

Use $derived.by() for filtered views:

Sorting Data

Copy arrays before sorting (sort mutates):

Form Submission

Optimistic Updates

For snappier UI, update state before the server responds:

Record IDs

Every record has a unique id field:
  • Auto-generated if not provided (5 alphanumeric characters)
  • Can be manually set when creating records
  • Used for updates and deletes

Timestamps

Records include automatic timestamps:

Pocketbase Admin

For advanced database management, access Pocketbase directly:
The Pocketbase admin UI lets you:
  • Browse all collections
  • Run SQL queries
  • Manage authentication
  • Configure collection rules
  • Export/import data
tinykit stores app data in the _tk_projects collection. Your app’s collections are stored within each project’s data field.

Data Export

From the Data Tab

  1. Select a collection
  2. Click the download icon
  3. Get JSON export of all records

From Pocketbase Admin

Access /_pb/_ for full database export capabilities.

Limitations

Keep these limitations in mind:
No relations (yet): Collections are independent. For related data, store IDs manually:
Shared database: All apps on a tinykit instance share the same Pocketbase. Use unique collection names or prefixes:
No migrations: Schema changes should be made carefully. Adding fields is safe; removing or renaming requires manual data migration.

FAQ

Data is stored in Pocketbase’s SQLite database at pocketbase/pb_data/. This persists across app restarts.
Yes. The SQLite database is a single file. Copy pocketbase/pb_data/data.db for a full backup. You can also export via the Pocketbase admin UI.
SQLite handles millions of records efficiently. For very large datasets, consider pagination in your queries.
Access the Pocketbase admin at /_pb/_ to run SQL queries directly.
In the Data tab, select the collection and click the delete button. This removes all records permanently.
Last write wins. Pocketbase doesn’t have conflict resolution—the most recent update overwrites previous values.