From executable to first record.
Run one Trestle process with SQLite or PostgreSQL, create the first administrator, define a typed collection and write through the HTTP API.
Install and start
Choose how you want the verified executable delivered. Both options fetch the release archive and its SHA256SUMS and verify the archive before writing anything.
Download into this directory changes nothing outside the current directory - ideal for portable folders and testing:
mkdir my-trestle
cd my-trestle
curl -fsSL https://trestle.cv/download.sh | sh
./trestleInstall on this user account writes to ~/.local/bin:
curl -fsSL https://trestle.cv/install.sh | sh
~/.local/bin/trestleTrestle listens on 127.0.0.1:7333 and creates its data directory on first start.
Choose SQLite or PostgreSQL
Open http://127.0.0.1:7333. SQLite is embedded and can continue directly to administrator creation. For PostgreSQL, select PostgreSQL, enter a connection URL for an empty PostgreSQL 16-18 database, and choose Test and use PostgreSQL. Trestle validates the server, persists the owner-only bootstrap configuration, and asks you to restart before credentials are shown.
postgres://trestle:CHANGE_ME@127.0.0.1:5432/trestle?sslmode=requireAfter restart, reload the dashboard and create the administrator. Competing setup requests produce exactly one administrator on either provider.
Define a collection
In Collections, create notes with required text fields named title and body. Trestle materializes provider-appropriate physical storage while keeping display names out of SQL identifiers.
Create a scoped credential
In Integrations, create a service credential with records:read and records:write. Copy the secret once. This quickstart uses it from your own local console. In a real browser application, use an application-user access token instead and keep service credentials on a trusted server.
Write and query with curl
curl http://127.0.0.1:7333/api/v1/collections/notes/records \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"values":{"title":"First note","body":"Trestle is ready."}}'
curl 'http://127.0.0.1:7333/api/v1/collections/notes/records?limit=25' \
-H 'Authorization: Bearer YOUR_TOKEN'The create body wraps your fields in values. The list response wraps records in items and returns an opaque nextCursor when another page is available.
Do the same with JavaScript
Open the Trestle dashboard at http://127.0.0.1:7333, then run this in its developer console. Replace the token with the credential from the previous step.
const token = "YOUR_TOKEN";
const createResponse = await fetch(
"/api/v1/collections/notes/records",
{
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
values: { title: "First note", body: "Trestle is ready." },
}),
},
);
if (!createResponse.ok) throw new Error("Could not create note");
const note = await createResponse.json();
const listResponse = await fetch(
"/api/v1/collections/notes/records?limit=25",
{ headers: { Authorization: `Bearer ${token}` } },
);
if (!listResponse.ok) throw new Error("Could not load notes");
const page = await listResponse.json();
console.log(note.id, page.items);fetch sends the same HTTP requests as the curl examples. A created record includes its ID, version, timestamps and values; a list returns records in items.
Terminate TLS, configure trusted proxies explicitly, protect SQLite files or PostgreSQL credentials, create a tested backup, and review the security boundary.
For a deployed browser application, put the frontend and Trestle API behind one public origin or route requests through a same-origin backend. Do not copy a service credential into shipped frontend code.
Build out record operations Add application login Use another client