Free · One database per site
Your site, with SQLite.
Upload a database or start fresh. Manage your data in the dashboard, then query it from your hosted site's JavaScript. Pagey Site runs the database for you.
Create a free account ↗1. Add your database
- Sign in. Open My sites → your site → Database.
- Click Create empty database, or upload a
.sqlite,.sqlite3, or.dbfile. - Use the SQL console to create tables and add data. Run one statement at a time; leave Named parameters as
{}for the examples below.
Starting empty? Create some sample data
Run this first:
CREATE TABLE products (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
category TEXT
)
Then run this separately:
INSERT INTO products (name, category)
VALUES ('Field notes', 'books')
Uploading an existing database? Export a standalone snapshot first. A live WAL-mode file is rejected because records may still be in its separate journal. Triggers and virtual tables are unsupported.
2. Query from your site
Run this JavaScript on your published site's own hostname, such as your-site.pagey.site. The hostname selects the database. By default, you must be signed in as that site's owner.
async function loadProducts() {
const response = await fetch('/api/database/query', {
method: 'POST',
credentials: 'same-origin',
headers: {
'Content-Type': 'application/json',
'X-Pagey-Database': '1'
},
body: JSON.stringify({
query: 'SELECT id, name FROM products WHERE category = :category LIMIT 50',
params: { category: 'books' }
})
});
const result = await response.json();
if (!response.ok) throw new Error(result.error);
console.log(result);
}
loadProducts().catch(console.error);
Response · array of objects
[{ "id": 1, "name": "Field notes" }]
Send one SQL statement per request. Use named parameters like :category for values rather than joining user input into SQL. Parameter values can be strings, safe finite numbers, booleans, or null.
3. Choose who can query
In Database → Query API, choose your settings and click Save API settings.
| Mode | Settings & behavior |
|---|---|
| Owner read-only Default | Require owner login on; Allow API writes off. Only you can query, using your Pagey browser session. |
| Owner read & write | Both on. You can also INSERT, UPDATE, and DELETE. Use RETURNING for changed rows; otherwise writes return []. |
| Public read-only | Require owner login off; writes must stay off. Anyone with site access can query every ordinary table and view. |
Owner login means this site's owning account. Other accounts, API tokens, and visitor passwords don't grant owner access. There are no individual visitor accounts or per-visitor row permissions.
Site access rules still apply, including passwords, country restrictions, maintenance, pauses, and expiry. Administrators can disable SQLite per site or account while keeping data and backups. Cross-origin calls are unsupported. Create or alter tables in the dashboard console; it works independently of the API write setting.
Keep your data
Publishing new HTML keeps your database. It stays outside your public files and site ZIP downloads. Use Download db.sqlite to save a separate copy.
Automatic snapshots run after changes, checked every minute, keeping the latest three by default. Use Back up now or Restore in the Database tab. Replacing or restoring resets the API to owner login and read-only.
Download a copy for safekeeping. Deleting a database also deletes its backups.
Default limits
- 5 MiB per database
- 10,000 rows / 5 MiB per response
- 3 seconds per query
- 60 requests/minute/IP, plus global limits
The response limit applies to JSON, not database file size. Use LIMIT and pagination, or download the full file. Your dashboard shows configured limits. See the query API reference for full limits, supported SQL, and error codes, or database management for upload and backup endpoints.