App data

Every app can have its own SQLite database with full-text search and vector search. Learn who can read and write it, how visitors save data safely, and how to share it between your apps.

An app can keep data with Studio Data. Each app has one SQLite database of its own, which stays with the app for as long as the app exists. It supports full-text search (FTS5) and vector search (sqlite-vec). The AI builder creates it and writes into it, and the running app reads it and lets visitors save things through safe, named operations.

The idea in one minute

App data in the configuration panel: sharing, which tables visitors can read, and storage used.

Create the database

You do not write SQL for the structure. Describe it to the AI builder:

Add a database table for books with title, author, a short note and when it was added. Fill it with these five books. Add an operation add_book so visitors can add one. Add full-text search over title, author and note.

The builder creates the tables and indexes, loads the rows, defines the operation and updates your app to use them. A destructive change to existing data, such as dropping a table, needs your approval first. See Build an app with AI.

If you write the code yourself, the builder still creates the database: ask it for the tables and operations, then call them from your code.

Read data

Use the helper in your page or in a server function:

// All books, as objects
const books = await smn.db.all('SELECT title, author FROM books ORDER BY title LIMIT 50');

// With a value passed safely as a parameter
const byAuthor = await smn.db.all('SELECT title FROM books WHERE author = ?', ['Ursula K. Le Guin']);

Always pass values as parameters (?), never by joining them into the SQL text.

With an FTS5 table that the builder created, search by words and rank by relevance:

const hits = await smn.db.all(
  'SELECT rowid, title FROM books_fts WHERE books_fts MATCH ? ORDER BY bm25(books_fts) LIMIT 20',
  [searchText]
);

SeeMyNotes does not create embeddings for you. If your app wants search by meaning, it brings its own vectors: for example from an AI provider through a connection, or computed beforehand. The vectors are stored in a vector table, and a query compares a list of numbers with them:

const near = await smn.db.all(
  'SELECT rowid, distance FROM chunks_vec WHERE embedding MATCH ? AND k = 5 ORDER BY distance',
  [queryVector]   // a list of numbers with the same length as the stored vectors
);

Let visitors save data: operations

Visitors change data by calling an operation: a named, ready-made statement with named parameters. You ask the builder to define it ("add an operation add_book that takes title and author"). The page calls it by name:

await smn.db.run('add_book', { title, author });

Who can read which table

Not every table is readable by visitors.

To show visitors what was saved, for example a guest list or a leaderboard, switch the table to readable. Then every row in it can be read by anyone who can open the app.

You can see and switch Visitors can read per table in the configuration panel under Tables visitors can read.

If the AI builder built the data from private notes, SeeMyNotes warns you before you make the app available to more people. See Build an app with AI.

Change the database from an AI agent

An AI agent you connect over MCP can create the tables and write the data, and define the named operations, with the Studio apps permission. It sees the structure of every table (columns, which visitors can read, and the row count of each table visitors can read), but reads rows only from tables that visitors can read: a table that holds what visitors entered is never readable by an agent. When it changes data it gets counts back, never rows.

A change that would delete or rewrite data is not made: it waits for your approval in SeeMyNotes. That covers dropping a table or columns, removing 50 or more rows or all rows of a table, rewriting 200 or more rows, renaming or replacing tables, and a trigger that deletes or changes rows. Before an approved change, SeeMyNotes keeps a copy of the database as it was for 30 days; you can bring it back yourself under Database history. An operation it defines that lets visitors change, delete or replace rows (UPDATE, DELETE, REPLACE, or an insert that updates or replaces on conflict) waits for your approval too; an operation that only adds rows or reads is saved at once. See Manage your apps with an AI agent.

A change that would touch a table visitors write to (directly, through a trigger or by building an index on it) also waits for your approval, and the agent never learns rows, counts or error text about that table. Deleting in small chunks does not avoid approval: an agent's removals and rewrites of the last 24 hours add up, and the database before its first one of the day is kept for 30 days. Giving an agent Publish lets it make a table visitor-readable, which shows what visitors entered in it to every visitor; this needs your explicit go-ahead.

Database history: restore a kept copy

Before a change that removes data, SeeMyNotes keeps a copy of the whole database as it was, for 30 days. You find the copies in the configuration panel under Database history, newest first. Each copy says why it was kept and when, how many tables and rows it holds, its size and until when it is kept. For example:

Before Claude Code's change that removed data - 3 Dec 2026, 14:02 3 tables, 1,240 rows - 48 KB - Kept until 2 Jan

A copy is kept before:

Database history: every kept copy with why and when it was kept.

To restore one, choose Restore next to it and confirm. SeeMyNotes asks, for example, "Restore the database as it was on 3 Dec at 14:02? The current data is kept as a copy for 30 days, so you can undo this."

After a restore: undo it, and choose which tables visitors can read again.

What a copy does not hold: your app's secrets and variables, the visitor operations, which tables visitors can read, and the app's code (code has its own version history). Copies older than 30 days are gone, and no copy is made for changes that only add data. A copy larger than your plan's database size limit cannot be restored.

While an app is paused because your plan no longer includes Studio, its copies are still listed, but restoring waits until Studio is back. You can always download the database.

An AI agent can list the copies and ask for a restore, but never restores by itself: you approve it in SeeMyNotes, like a change that deletes data. See Manage your apps with an AI agent. The account assistant shows a restore on its own approval card. Step by step: Undo a change to an app's database.

Share data between your apps

Under App data, switch on Share this app's data with my other apps and your other apps and the AI builder can read this app's data, read-only. Another app reads it by naming the app:

const rows = await smn.db.all('SELECT title FROM books LIMIT 10', [], { app: '<app id>' });

smn.db.schema({ app: '<app id>' }) shows what the other app offers; its first answer includes the app id. The AI builder lists the apps that share data. Sharing is only between your own apps, never with other accounts. A switch-off takes effect at once. An app that is not public can read another app's shared data only while that other app is served publicly.

Share one app's data with your other apps, read-only.

Storage and limits

The database has a maximum size, and all your apps share one storage quota that counts app files, data and checkpoints. Visitors' requests are limited per minute and per day. If you reach the storage quota, new saves are refused and nothing is deleted.

The current limits are shown on the plans and limits page.

Your data is kept safely: a write is confirmed to the app only once it has been stored durably. Deleting the app deletes its data. You can download the database as a SQLite file at any time; see History, checkpoints and export.

Related pages