# Tissue Cloud docs: full documentation This file contains the complete Tissue Cloud developer documentation in Markdown, concatenated from https://docs.tissue.systems/docs/. Each section below corresponds to one page; the "Source" line gives its canonical URL. The Mast manual is a separate file at https://tissue.systems/mast/docs/llms-full.txt. --- # Get started / What is Tissue Cloud? Source: https://docs.tissue.systems/docs/overview/ # What is Tissue Cloud? Tissue Cloud is a serverless compute platform. You write functions, deploy them with a single command, and they run on a live URL. There are no servers, runtimes or infrastructure for you to set up. --- ## The biological metaphor The platform is named after biological tissue, the organizational layer between individual cells and whole organisms. In biology, tissue is what emerges when specialized cells work in coordination: each cell isolated, self-contained, doing exactly one thing well; the tissue as a whole far more capable than any individual cell. tissue.systems extends this metaphor across the entire stack: ### Cells A **Cell** is the basic unit of computation. Each Cell is an isolated JavaScript or WebAssembly module that handles HTTP requests. Cells are stateless: they receive a request, produce a response, and terminate. No shared memory, no persistent local state, no side effects beyond their declared bindings. Just as biological cells maintain their internal chemistry through a membrane boundary, Cells on tissue.systems are isolated by default. They can only reach the outside world through explicit, declared channels: outbound `fetch()`, a c3 database binding, or a g7 storage binding. ### gate: Who may enter By default a Cell's URL is open to anyone who has it. A **gate** is an access policy in front of that URL, enforced at the edge before your code runs: capability links, your own Tissue Cloud account, listed email addresses, an email domain, or an identity provider you connect over OIDC. A request that fails the policy never reaches the Cell, and the Cell needs no code to enforce any of it. A membrane is selectively permeable; gated channels are what decide who crosses it. ### c3: Structured data **c3** is the platform's structured data service, backed by SQLite. The name echoes biochemistry: C3 in biology refers to three-carbon molecules, the fundamental currency of cellular chemistry. In tissue.systems, c3 is the fundamental currency of structured information: relational, persistent, queryable. c3 is a SQL API with exec, batch, prepare and bind methods. If you've used a SQL database in a serverless environment before, you'll recognise it. ### g7: Object storage **g7** is the platform's object storage service. The name is a numeronym: **g** + **7** (the seven letters of *lycogen*) + **n** = **glycogen**. The same convention behind *i18n* and *k8s* applied to a biological molecule. In biology, glycogen is how living systems store dense, stable reserves of glucose: compact, inert, available on demand when a cell needs energy or raw material. In tissue.systems, g7 is how your Cells store dense, stable reserves of data: images, documents, compiled assets, arbitrary binary objects. ### pulse: Scheduled invocations **pulse** is how Cells run on a schedule. A Cell can declare one or more cron expressions in `ribo.toml`; the platform fires a `pulse` event at each scheduled time, calling the Cell's `pulse(event, env)` handler. No incoming HTTP request is needed. The name echoes the biological metaphor: a pulse is the periodic signal that keeps a system alive between external stimuli. ### vesicle: Webhook inbox **vesicle** is the platform's webhook inbox. Creating an endpoint gives you a URL that accepts HTTP deliveries and stores every one of them under your account, before any Cell exists to handle them. Bind the endpoint to a Cell and a route and captures start dispatching; until then they wait, readable in the dashboard or with `ribo vesicle tail`. In biology, a vesicle is the membrane-bound package a cell uses to hold ingested material until it is processed. The delivery is held intact until something is ready to read it. ### synapse: Sensor ingest **synapse** is how a physical device reaches a Cell. The device publishes over MQTT-over-TLS to `ingest.tissue.dev:8883`; synapse authenticates it, enforces per-device topic isolation and rate limits, and dispatches each reading into the owning Cell's `sensor(event, env)` handler. Synapse stores no readings; the Cell owns storage, usually c3. A synapse is the junction that carries a signal from one cell to the next; here it carries a reading from the device into your Cell. ### ribo: the CLI **ribo** is the command-line tool that deploys Cells and manages platform resources. The name comes from the **ribosome**, the molecular machine inside every living cell that reads genetic instructions and assembles proteins from them. In the same way, `ribo` reads your `ribo.toml` and assembles a running Cell from your code. --- ## Platform components | Component | What it is | |-------------|-------------------------------------------------------------------------| | **Cell** | A JavaScript or WASM function that handles HTTP requests | | **gate** | An access policy in front of a Cell's URL, enforced before your code runs | | **c3** | Per-account SQLite databases, bound to Cells at deploy time | | **g7** | Object storage (files, images, binary data), accessible from Cells | | **pulse** | Scheduled Cell invocations on a cron schedule | | **vesicle** | Webhook endpoints that capture every delivery and hand it to a Cell | | **synapse** | MQTT ingest for sensors; each reading dispatches to a Cell | | **ribo** | The CLI for deploying Cells and managing resources | --- ## How a request flows 1. A request arrives at `https://..tissue.dev` 2. The platform routes it to the correct Cell based on the hostname 3. If the Cell has a gate, the edge checks the visitor against the policy and answers the request itself if it fails 4. The Cell's `fetch(request, env)` handler is called in an isolated V8 instance 5. The Cell reads from `env.DB` (c3) or `env.BUCKET` (g7) if it has those bindings 6. The Cell returns a `Response` The Cell's isolate is reused across requests for warm performance. Redeploying the Cell immediately routes new requests to a fresh isolate. --- ## What invokes a Cell An HTTP request is the common case, but not the only one. Each trigger arrives at a named export: | Trigger | Handler | |---------------------------------------------------------|-------------------------------------------------------------| | A request to the Cell's URL | `fetch(request, env, ctx)` | | A cron schedule ([pulse](https://docs.tissue.systems/docs/pulse/overview/)) | `pulse(event, env)` | | A sensor reading ([synapse](https://docs.tissue.systems/docs/synapse/overview/)) | `sensor(event, env)` | | A webhook delivery ([vesicle](https://docs.tissue.systems/docs/vesicle/overview/)) | `fetch`, on the bound route, with `x-tissue-event: vesicle` | Pulse and synapse dispatch is best-effort and not retried. Vesicle deliveries are stored first and retried, so a handler that is down does not lose them. --- ## Next steps - [Quick start](https://docs.tissue.systems/docs/get-started/): deploy your first Cell in under five minutes - [Cells](https://docs.tissue.systems/docs/cells/overview/): what Cells are and how to write them - [Access control](https://docs.tissue.systems/docs/cells/gate/): put a policy in front of a Cell's URL - [c3](https://docs.tissue.systems/docs/c3/overview/): persistent SQLite databases - [g7](https://docs.tissue.systems/docs/g7/overview/): object storage - [Pulse](https://docs.tissue.systems/docs/pulse/overview/): run a Cell on a cron schedule - [Vesicle](https://docs.tissue.systems/docs/vesicle/overview/): webhook endpoints that capture every delivery - [Synapse](https://docs.tissue.systems/docs/synapse/overview/): sensor and IoT ingest over MQTT --- # Get started / Quick start Source: https://docs.tissue.systems/docs/get-started/ # Quick start Deploy your first Cell to a live URL in under five minutes. --- ## 1. Install ribo `ribo` is the CLI for tissue.systems. It's a single self-contained binary, with no runtime required. All builds (with checksums, and previous releases) are on the [download page](https://tissue.systems/download/). ```bash curl -fsSL https://tissue.systems/install.sh | sh ``` That picks the build for your machine, checks it against the signed release manifest, and installs it to `/usr/local/bin`. Set `RIBO_INSTALL_DIR` to put it somewhere else. The script is short and does nothing you can't do by hand. [Read it first](https://tissue.systems/install.sh) if you'd rather not pipe it to a shell, or follow the per-platform steps below. **macOS (Apple Silicon)** ```bash curl -L https://tissue.systems/download/latest/ribo-macos-arm64 -o ribo chmod +x ribo && sudo mv ribo /usr/local/bin/ribo ``` **macOS (Intel)** ```bash curl -L https://tissue.systems/download/latest/ribo-macos-x86_64 -o ribo chmod +x ribo && sudo mv ribo /usr/local/bin/ribo ``` **Linux (x86-64)** ```bash curl -L https://tissue.systems/download/latest/ribo-linux-x86_64 -o ribo chmod +x ribo && sudo mv ribo /usr/local/bin/ribo ``` **Linux (arm64)**: Raspberry Pi 4, 5, 400 and the Compute Modules on 64-bit Raspberry Pi OS, and arm64 Linux generally. ```bash curl -L https://tissue.systems/download/latest/ribo-linux-arm64 -o ribo chmod +x ribo && sudo mv ribo /usr/local/bin/ribo ``` Check with `uname -m` if you're not sure: it prints `aarch64` on a machine this build is for. `armv7l` or `armv6l` means you're on the 32-bit Raspberry Pi OS, and there's no build for that. Install the 64-bit OS. Everything works from a Pi except `ribo local`, which needs a Cell runtime built for arm64 and there isn't one yet; deploy and test against tissue.systems instead. (Debian/Ubuntu users can grab the `.deb` for either architecture from the [download page](https://tissue.systems/download/) instead. On Windows, run the Linux x86-64 binary inside WSL.) Confirm the install: ```bash ribo --help ``` **Optional: check the signature.** Every release carries a `SHA256SUMS` manifest signed with the key in [allowed_signers](https://tissue.systems/download/allowed_signers), the same key that signs what runs on our servers, held on a laptop rather than on the machines that build the binaries. ```bash curl -LO https://tissue.systems/download/latest/SHA256SUMS curl -LO https://tissue.systems/download/latest/SHA256SUMS.sig curl -LO https://tissue.systems/download/allowed_signers ssh-keygen -Y verify -f allowed_signers -I release@tissue.systems \ -n tissue-release -s SHA256SUMS.sig < SHA256SUMS # → Good "tissue-release" signature for release@tissue.systems shasum -a 256 --ignore-missing -c SHA256SUMS # → ribo-macos-arm64: OK ``` Run this from the directory you downloaded `ribo` into, under its published name: `shasum` looks up each file by the name in the manifest, and `--ignore-missing` skips the platforms you did not download. Keep your copy of `allowed_signers`; a key fetched alongside the download it vouches for proves less than one you already had. **Staying current.** `ribo` checks for a new release once a day and prints a line when one exists. To update: ```bash ribo upgrade ``` It runs the same verification as the steps above before replacing the binary in place, so a download that doesn't match the signed manifest leaves your existing `ribo` untouched. `ribo upgrade --check` reports what's available without installing it. Set `RIBO_NO_UPDATE_CHECK=1` to turn the daily check off; it is already off when `CI` is set, and when output is not a terminal. The check is one unauthenticated GET asking which release is current, and the only thing it says about you is its own `User-Agent`: `ribo/ ()`. We count those to see which releases are still in use. If you installed the `.deb`, `ribo upgrade` will tell you to use your package manager rather than writing over a packaged file. --- ## 2. Sign in ```bash ribo login ``` Opens a browser to complete sign-in. Once authorized, `ribo` stores the token locally. You only need to do this once. You sign in as a user; what you deploy belongs to an account, the one created when you signed up unless you switch. [Accounts, users and roles](https://docs.tissue.systems/docs/account/overview/) has the distinction. To sign out: ```bash ribo logout ``` --- ## 3. Write a Cell Create a directory and add two files. ```bash mkdir hello && cd hello ``` **cell.js** ```js export default { async fetch(request) { return new Response("Hello from Tissue!", { headers: { "content-type": "text/plain" }, }); }, }; ``` **ribo.toml** ```toml [cell] name = "hello" js = "./cell.js" ``` --- ## 4. Deploy ```bash ribo deploy ``` account Demo (acct_33ed412f7bca84b0) [unpinned] server https://api.tissue.systems deployed hello address 33ed412f7x2kp kind js url https://hello.strand-9c.tissue.dev Open the `url`: your Cell is live. (The `address` is the Cell's permanent 13-character identifier. `url` always matches the `server` line, because a Cell is reachable only from the management server that holds it.) --- ## 5. Update and redeploy Edit `cell.js`, then run `ribo deploy` again. The same URL continues to work and the updated code is live immediately. --- ## 6. List and delete ```bash ribo list # all your deployed Cells ribo delete hello # remove a Cell permanently ``` --- ## Next steps - [Build a JSON API with SQLite](https://docs.tissue.systems/docs/tutorials/json-api-sqlite/): the first of five tutorials that each end with a working app on a live URL - [Writing Cells](https://docs.tissue.systems/docs/cells/writing/): routing, outbound fetch, returning JSON and HTML - [Structured data with c3](https://docs.tissue.systems/docs/c3/overview/): add a persistent SQLite database to your Cell - [Object storage with g7](https://docs.tissue.systems/docs/g7/overview/): store and serve files and binary objects - [Access control](https://docs.tissue.systems/docs/cells/gate/): put a sign-in policy in front of a Cell that shouldn't be public - [ribo CLI reference](https://docs.tissue.systems/docs/ribo/reference/): every command and flag --- # Tutorials / Build a JSON API with SQLite Source: https://docs.tissue.systems/docs/tutorials/json-api-sqlite/ # Build a JSON API with SQLite A small REST API for a to-do list, written as one JavaScript file, with its data in a SQLite database. You'll go from an empty directory to a live HTTPS URL that answers `GET`, `POST`, `PATCH` and `DELETE`. You need a terminal and about ten minutes. No Node, no Docker and no database server: the CLI is one binary, and the database is created with one command. --- ## 1. Install ribo and sign in `ribo` is the Tissue Cloud CLI. Install it and sign in once: ```bash curl -fsSL https://tissue.systems/install.sh | sh ribo login ``` `ribo login` opens a browser. If you don't have a Tissue Cloud account yet, you can create one there. The [quick start](https://docs.tissue.systems/docs/get-started/) has per-platform install steps and a way to check the binary's signature. --- ## 2. Create the database ```bash mkdir todo-api && cd todo-api ribo db create todos ``` That makes an empty SQLite database called `todos` in your account. It has no tables yet; the code creates them. --- ## 3. Write the config Create `ribo.toml`. It names the Cell, points at the code, and binds the database to the name `DB`: **ribo.toml** ```toml [cell] name = "todo-api" js = "./cell.js" [[bindings]] type = "c3" binding = "DB" database = "todos" ``` The binding is the whole connection setup. There's no connection string or password: inside the code the database is `env.DB`. --- ## 4. Write the API **cell.js** ```js const SCHEMA = ` CREATE TABLE IF NOT EXISTS todos ( id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT NOT NULL, done INTEGER NOT NULL DEFAULT 0, created_at TEXT NOT NULL DEFAULT (datetime('now')) ) `; export default { async fetch(request, env) { const url = new URL(request.url); const parts = url.pathname.split("/").filter(Boolean); if (parts[0] !== "todos" || parts.length > 2) { return json({ error: "not found" }, 404); } await env.DB.exec(SCHEMA); try { if (parts.length === 1) { if (request.method === "GET") return await list(env.DB); if (request.method === "POST") return await create(env.DB, request); return json({ error: "method not allowed" }, 405); } const id = Number(parts[1]); if (!Number.isInteger(id) || id < 1) return json({ error: "not found" }, 404); if (request.method === "GET") return await show(env.DB, id); if (request.method === "PATCH") return await update(env.DB, id, request); if (request.method === "DELETE") return await remove(env.DB, id); return json({ error: "method not allowed" }, 405); } catch (err) { return json({ error: err.message }, err.status ?? 500); } }, }; async function list(db) { const { results } = await db.prepare( "SELECT id, title, done, created_at FROM todos ORDER BY id DESC LIMIT 100" ).all(); return json(results.map(toTodo)); } async function create(db, request) { const body = await readJson(request); const title = typeof body.title === "string" ? body.title.trim() : ""; if (!title || title.length > 500) throw httpError(400, "title must be 1 to 500 characters"); const { meta } = await db.prepare("INSERT INTO todos (title) VALUES (?)").bind(title).run(); return show(db, meta.last_insert_rowid, 201); } async function show(db, id, status = 200) { const row = await db.prepare( "SELECT id, title, done, created_at FROM todos WHERE id = ?" ).bind(id).first(); if (!row) return json({ error: "not found" }, 404); return json(toTodo(row), status); } async function update(db, id, request) { const body = await readJson(request); const title = body.title === undefined ? null : String(body.title).trim(); const done = body.done === undefined ? null : Boolean(body.done); if (title !== null && (!title || title.length > 500)) { throw httpError(400, "title must be 1 to 500 characters"); } // COALESCE keeps the stored value for any field the request left out. const { meta } = await db.prepare( "UPDATE todos SET title = COALESCE(?, title), done = COALESCE(?, done) WHERE id = ?" ).bind(title, done, id).run(); if (meta.rows_affected === 0) return json({ error: "not found" }, 404); return show(db, id); } async function remove(db, id) { const { meta } = await db.prepare("DELETE FROM todos WHERE id = ?").bind(id).run(); if (meta.rows_affected === 0) return json({ error: "not found" }, 404); return new Response(null, { status: 204 }); } // SQLite has no boolean type, so done is stored as 0 or 1. function toTodo(row) { return { ...row, done: row.done === 1 }; } async function readJson(request) { try { return await request.json(); } catch { throw httpError(400, "body must be JSON"); } } function httpError(status, message) { const err = new Error(message); err.status = status; return err; } function json(data, status = 200) { return Response.json(data, { status }); } ``` A few things worth knowing about how this runs: - `exec(SCHEMA)` runs on every request. `CREATE TABLE IF NOT EXISTS` is a cheap no-op once the table is there, so there's no separate migration step for a project this size. [c3 overview](https://docs.tissue.systems/docs/c3/overview/#schema-migrations) has a versioned pattern for when the schema starts changing. - Every value from the request goes through `prepare().bind()`, never into the SQL string. That's what keeps a title like `'); DROP TABLE todos; --` from doing anything. - `run()` returns `meta.last_insert_rowid` and `meta.rows_affected`, which is how the handlers get the new id and tell a missing row from an updated one. --- ## 5. Deploy ```bash ribo deploy ``` account Demo (acct_33ed412f7bca84b0) [unpinned] server https://api.tissue.systems deployed todo-api address 33ed412f7x2kp kind js url https://todo-api.strand-9c.tissue.dev c3 DB→todos Your `url` will have your own account's subdomain in place of `strand-9c`. Copy it into a shell variable for the next step: ```bash API=https://todo-api.strand-9c.tissue.dev ``` --- ## 6. Try it ```bash # create two curl -s -X POST $API/todos -H 'content-type: application/json' -d '{"title":"Buy coffee"}' curl -s -X POST $API/todos -H 'content-type: application/json' -d '{"title":"Write the README"}' # list them curl -s $API/todos # mark the first one done curl -s -X PATCH $API/todos/1 -H 'content-type: application/json' -d '{"done":true}' # delete the second curl -s -X DELETE $API/todos/2 -i ``` The `POST` answers `201` with the new row: ```json {"id":1,"title":"Buy coffee","done":false,"created_at":"2026-12-02 17:04:11"} ``` You can read the same table from your terminal, which is handy while you build: ```bash ribo db exec todos "SELECT * FROM todos" ``` --- ## What you have A JSON API on a public HTTPS URL, backed by a SQLite database that persists across deploys. Edit `cell.js` and run `ribo deploy` again to ship a change; the URL stays the same and the data stays put. Anyone who has the URL can write to it. Before you hand it out, either check a bearer token from a [vault binding](https://docs.tissue.systems/docs/cells/configuration/#vault-encrypted-secret) (the [URL shortener tutorial](https://docs.tissue.systems/docs/tutorials/url-shortener/) does exactly that), or put an [access policy](https://docs.tissue.systems/docs/cells/gate/) in front of it. --- ## Next steps - [c3 API reference](https://docs.tissue.systems/docs/c3/api/): `exec`, `batch`, `prepare`, `bind` and the terminal methods - [Build a URL shortener](https://docs.tissue.systems/docs/tutorials/url-shortener/): the same pattern with redirects and a token on the write routes - [Writing Cells](https://docs.tissue.systems/docs/cells/writing/): routing, reading request bodies, outbound `fetch` - [What is SQLite at the edge?](https://docs.tissue.systems/docs/glossary/sqlite-at-the-edge/): where c3 keeps the database --- # Tutorials / Build a URL shortener Source: https://docs.tissue.systems/docs/tutorials/url-shortener/ # Build a URL shortener A link shortener you own: `POST` a long URL, get back a short one, and every visit to the short one redirects and counts a click. One JavaScript file, a SQLite database and a secret token, deployed to a live URL. It takes about fifteen minutes. If you haven't installed the CLI yet, do steps 1 and 2 of the [quick start](https://docs.tissue.systems/docs/get-started/) first (`ribo` install and `ribo login`). --- ## 1. Create the database and the token ```bash mkdir short-links && cd short-links ribo db create links ``` The redirect is public, but creating, listing and deleting links shouldn't be. Generate a random admin token and store it in the Cell's vault: ```bash openssl rand -hex 32 ribo vault set short-links ADMIN_TOKEN ``` `ribo vault set` prompts for the value with hidden input; paste the hex string `openssl` printed, and keep a copy for step 5. The value is stored encrypted on the server and never goes into a file you might commit. Set the vault value **before** the first deploy. A vault binding whose value is missing at deploy time gets a placeholder instead, and the Cell would compare tokens against that placeholder. The code below refuses to run its admin routes in that case rather than accepting it. --- ## 2. Write the config **ribo.toml** ```toml [cell] name = "short-links" js = "./cell.js" [[bindings]] type = "c3" binding = "DB" database = "links" [[bindings]] type = "vault" binding = "ADMIN_TOKEN" ``` The database shows up in the code as `env.DB`, the token as the string `env.ADMIN_TOKEN`. --- ## 3. Write the Cell **cell.js** ```js const SCHEMA = ` CREATE TABLE IF NOT EXISTS links ( code TEXT PRIMARY KEY, url TEXT NOT NULL, clicks INTEGER NOT NULL DEFAULT 0, created_at TEXT NOT NULL DEFAULT (datetime('now')) ) `; // A code is one URL path segment, so it is kept to characters that need no escaping. const CODE_RE = /^[A-Za-z0-9_-]{1,32}$/; const ALPHABET = "abcdefghijklmnopqrstuvwxyz0123456789"; // A vault value that was never set arrives as this placeholder. const VAULT_UNSET = "***REMOVED***"; export default { async fetch(request, env) { const url = new URL(request.url); const parts = url.pathname.split("/").filter(Boolean); await env.DB.exec(SCHEMA); try { // Public: GET / redirects. if (request.method === "GET" && parts.length === 1 && parts[0] !== "links") { return await redirect(env.DB, parts[0]); } // Everything else needs the admin token. await requireToken(request, env); if (request.method === "POST" && url.pathname === "/links") { return await shorten(env.DB, request, url); } if (request.method === "GET" && url.pathname === "/links") { return await list(env.DB); } if (request.method === "DELETE" && parts.length === 2 && parts[0] === "links") { return await remove(env.DB, parts[1]); } return json({ error: "not found" }, 404); } catch (err) { return json({ error: err.message }, err.status ?? 500); } }, }; async function redirect(db, code) { if (!CODE_RE.test(code)) return json({ error: "not found" }, 404); const row = await db.prepare("SELECT url FROM links WHERE code = ?").bind(code).first(); if (!row) return json({ error: "not found" }, 404); await db.prepare("UPDATE links SET clicks = clicks + 1 WHERE code = ?").bind(code).run(); return new Response(null, { status: 302, headers: { location: row.url } }); } async function shorten(db, request, reqUrl) { let body; try { body = await request.json(); } catch { throw httpError(400, "body must be JSON"); } let target; try { target = new URL(body.url); } catch { throw httpError(400, "url must be a full URL, starting with http:// or https://"); } if (target.protocol !== "https:" && target.protocol !== "http:") { throw httpError(400, "url must start with http:// or https://"); } if (target.href.length > 2048) throw httpError(400, "url is too long"); const code = body.code ?? randomCode(7); if (typeof code !== "string" || !CODE_RE.test(code)) { throw httpError(400, "code must be 1 to 32 letters, digits, - or _"); } const taken = await db.prepare("SELECT 1 FROM links WHERE code = ?").bind(code).first(); if (taken) throw httpError(409, `code "${code}" is already in use`); await db.prepare("INSERT INTO links (code, url) VALUES (?, ?)").bind(code, target.href).run(); return json({ code, short_url: `${reqUrl.origin}/${code}`, url: target.href }, 201); } async function list(db) { const { results } = await db.prepare( "SELECT code, url, clicks, created_at FROM links ORDER BY created_at DESC LIMIT 500" ).all(); return json({ links: results }); } async function remove(db, code) { const { meta } = await db.prepare("DELETE FROM links WHERE code = ?").bind(code).run(); if (meta.rows_affected === 0) return json({ error: "not found" }, 404); return new Response(null, { status: 204 }); } async function requireToken(request, env) { const secret = env.ADMIN_TOKEN; if (typeof secret !== "string" || secret === "" || secret === VAULT_UNSET) { throw httpError(503, "ADMIN_TOKEN is not set: run ribo vault set short-links ADMIN_TOKEN, then ribo deploy"); } const header = request.headers.get("authorization") ?? ""; const given = header.startsWith("Bearer ") ? header.slice(7) : ""; // Compare SHA-256 digests byte by byte, so the time taken doesn't depend on // how much of the token was right. const enc = new TextEncoder(); const [a, b] = await Promise.all( [given, secret].map((v) => crypto.subtle.digest("SHA-256", enc.encode(v))) ); const x = new Uint8Array(a); const y = new Uint8Array(b); let diff = 0; for (let i = 0; i < x.length; i++) diff |= x[i] ^ y[i]; if (!given || diff !== 0) throw httpError(401, "unauthorized"); } function randomCode(length) { // 252 is the largest multiple of 36 below 256; skipping bytes above it keeps // every character equally likely. let out = ""; while (out.length < length) { for (const byte of crypto.getRandomValues(new Uint8Array(length * 2))) { if (byte < 252 && out.length < length) out += ALPHABET[byte % 36]; } } return out; } function httpError(status, message) { const err = new Error(message); err.status = status; return err; } function json(data, status = 200) { return Response.json(data, { status }); } ``` The redirect answers `302`, not `301`. Browsers cache a `301` and stop asking, which means later clicks never reach the Cell and the counter stops counting. --- ## 4. Deploy ```bash ribo deploy ``` deployed short-links address 33ed412f9m4tq kind js url https://short-links.strand-9c.tissue.dev c3 DB→links vault ADMIN_TOKEN If `ribo deploy` prints `warning: vault value "ADMIN_TOKEN" is not set for cell "short-links"`, go back to step 1, set it, and deploy again. --- ## 5. Shorten a link ```bash SHORT=https://short-links.strand-9c.tissue.dev # your url from the deploy TOKEN=... # the hex string from step 1 curl -s -X POST $SHORT/links \ -H "authorization: Bearer $TOKEN" \ -H 'content-type: application/json' \ -d '{"url":"https://docs.tissue.systems/docs/c3/overview/"}' ``` ```json {"code":"k3x9q2a","short_url":"https://short-links.strand-9c.tissue.dev/k3x9q2a","url":"https://docs.tissue.systems/docs/c3/overview/"} ``` Pick the code yourself by adding `"code":"c3-docs"` to the body. Open the `short_url` in a browser and it redirects. Then look at the counts: ```bash curl -s $SHORT/links -H "authorization: Bearer $TOKEN" curl -s -X DELETE $SHORT/links/k3x9q2a -H "authorization: Bearer $TOKEN" -i ``` A request without the token gets `401`. --- ## What you have A working link shortener on HTTPS with click counts in SQLite, where only the holder of the token can add or remove links. To put it on a short domain of your own, add a [custom domain](https://docs.tissue.systems/docs/cells/custom-domains/) to the Cell; the code doesn't change. To change the token, run `ribo vault set short-links ADMIN_TOKEN` again. [Vault security](https://docs.tissue.systems/docs/cells/vault-security/) explains how the value is stored and when a change takes effect. The repository [tissue-examples](https://github.com/tissue-systems/tissue-examples/tree/main/js-url-shortener) has a fuller version of this Cell with a small admin page. --- ## Next steps - [Build a JSON API with SQLite](https://docs.tissue.systems/docs/tutorials/json-api-sqlite/): a full create, read, update and delete API - [Run a cron job without a server](https://docs.tissue.systems/docs/tutorials/scheduled-job/): work on a timer, the same database and bindings - [ribo vault](https://docs.tissue.systems/docs/ribo/reference/#ribo-vault): set, list and delete secrets - [c3 API reference](https://docs.tissue.systems/docs/c3/api/) --- # Tutorials / Run a cron job without a server Source: https://docs.tissue.systems/docs/tutorials/scheduled-job/ # Run a cron job without a server A scheduled job that checks a list of websites every five minutes, records each status code and response time in SQLite, and serves the results on a page. Once a night it deletes the old rows. Nothing to keep running: the platform calls your code on the schedule. It takes about fifteen minutes. If you haven't installed the CLI yet, do steps 1 and 2 of the [quick start](https://docs.tissue.systems/docs/get-started/) first (`ribo` install and `ribo login`). --- ## How scheduling works here You write the schedule in `ribo.toml` as a cron expression, and export a `pulse` function next to the usual `fetch`. At each slot the platform calls `pulse(event, env)` with the same bindings `fetch` gets. Schedules are 5-field cron and always UTC. The shortest interval is one minute, and a pulse fires within about 30 seconds of its slot. A pulse that fails is not retried; the next slot fires as normal. For a checker that runs every five minutes, a missed run is a gap in the table and nothing more. --- ## 1. Create the database ```bash mkdir site-checker && cd site-checker ribo db create checks ``` --- ## 2. Write the config **ribo.toml** ```toml [cell] name = "site-checker" js = "./cell.js" [[bindings]] type = "c3" binding = "DB" database = "checks" # Comma-separated list of URLs to check. [[bindings]] type = "text" binding = "TARGETS" value = "https://tissue.systems,https://docs.tissue.systems" # Every five minutes: check each target. [[pulse]] schedule = "*/5 * * * *" # 03:00 UTC every day: delete rows older than seven days. [[pulse]] schedule = "0 3 * * *" ``` Put your own URLs in `value`. A `text` binding is a plain string in the config, which is fine for a list like this; anything secret belongs in a [vault binding](https://docs.tissue.systems/docs/cells/configuration/#vault-encrypted-secret) instead. --- ## 3. Write the Cell **cell.js** ```js const SCHEMA = ` CREATE TABLE IF NOT EXISTS checks ( id INTEGER PRIMARY KEY AUTOINCREMENT, url TEXT NOT NULL, status INTEGER, ms INTEGER NOT NULL, error TEXT, checked_at TEXT NOT NULL ); CREATE INDEX IF NOT EXISTS checks_url_time ON checks (url, checked_at); `; export default { async pulse(event, env) { await env.DB.exec(SCHEMA); if (event.cron === "0 3 * * *") { await env.DB.prepare( "DELETE FROM checks WHERE checked_at < datetime('now', '-7 days')" ).run(); return; } const targets = env.TARGETS.split(",").map((s) => s.trim()).filter(Boolean); const results = await Promise.all(targets.map(check)); // One batch is one transaction: every row from this run lands, or none does. await env.DB.batch( results.map((r) => env.DB.prepare( "INSERT INTO checks (url, status, ms, error, checked_at) VALUES (?, ?, ?, ?, datetime(?))" ).bind(r.url, r.status, r.ms, r.error, event.scheduledTime.toISOString()) ) ); }, async fetch(request, env) { await env.DB.exec(SCHEMA); const { results } = await env.DB.prepare(` SELECT url, status, ms, error, checked_at FROM checks WHERE checked_at > datetime('now', '-1 day') ORDER BY checked_at DESC LIMIT 200 `).all(); if (new URL(request.url).pathname === "/json") { return Response.json(results); } return new Response(page(results), { headers: { "content-type": "text/html; charset=utf-8" }, }); }, }; async function check(url) { const started = Date.now(); try { const res = await fetch(url, { redirect: "manual", signal: AbortSignal.timeout(10000), }); return { url, status: res.status, ms: Date.now() - started, error: null }; } catch (err) { return { url, status: null, ms: Date.now() - started, error: err.name }; } } function page(rows) { const body = rows.map((r) => ` ${esc(r.checked_at)} ${esc(r.url)} ${r.status ?? esc(r.error)} ${r.ms} ms `).join(""); return ` Site checks

Site checks, last 24 hours

${body || ''}
Checked (UTC)URLStatusTime
No checks yet. The first one runs at the next five-minute mark.
`; } function esc(s) { return String(s ?? "").replace(/[&<>"]/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """ })[c]); } ``` Some details that matter: - `event.cron` is the expression that fired, exactly as written in `ribo.toml`, which is how one `pulse` function tells the nightly cleanup from the five-minute check. - `event.scheduledTime` is a `Date`. The insert passes it through SQLite's `datetime()`, which stores it as `2026-12-02 17:05:00`, the same shape `datetime('now', '-7 days')` produces. Text columns compare as strings, so both sides of a comparison need the same format. - `redirect: "manual"` records a redirect as its own status (`301`, `302`) rather than following it. Drop that line if you'd rather see the status of the final page. - Time spent waiting on `fetch()` doesn't count against the Cell's CPU limit, so slow sites only cost wall-clock time. `AbortSignal.timeout(10000)` gives up on a site after 10 seconds and records `TimeoutError`. --- ## 4. Deploy ```bash ribo deploy ``` deployed site-checker address 33ed412f2h8wd kind js url https://site-checker.strand-9c.tissue.dev c3 DB→checks text TARGETS pulse */5 * * * *, 0 3 * * * The `pulse` line lists the schedules the platform registered. A schedule it can't parse fails the deploy with a `400` that names the expression, and nothing is published. --- ## 5. Watch it run Wait for the next five-minute mark, then open the `url` in a browser. Each run adds one row per target. The same data is at `/json`: ```bash curl -s https://site-checker.strand-9c.tissue.dev/json ``` ```json [{"url":"https://tissue.systems","status":200,"ms":84,"error":null,"checked_at":"2026-12-02 17:05:00"}] ``` From the terminal you can query the table directly: ```bash ribo db exec checks "SELECT url, count(*), avg(ms) FROM checks GROUP BY url" ``` --- ## What you have A cron job running in the cloud with no server or process of yours: every five minutes it checks your sites, keeps a week of history in SQLite, and shows the last day on a public page. To change what it checks, edit `value` in `ribo.toml` and run `ribo deploy`. To change when, edit the `schedule` lines; `*/5` becomes `*/15` for every quarter hour, and `0 9 * * 2-6` is 09:00 UTC on weekdays. Day-of-week in these schedules counts from 1 for Sunday, so Monday is `2`. The [pulse overview](https://docs.tissue.systems/docs/pulse/overview/#cron-schedule-reference) has the full field table. --- ## Next steps - [Pulse overview](https://docs.tissue.systems/docs/pulse/overview/): schedule syntax, delivery, and tracking work across runs - [What is a cron expression?](https://docs.tissue.systems/docs/glossary/cron-expression/): the five fields explained - [Build a JSON API with SQLite](https://docs.tissue.systems/docs/tutorials/json-api-sqlite/): reads and writes from HTTP requests instead of a timer - [Writing Cells](https://docs.tissue.systems/docs/cells/writing/#outbound-fetch): outbound `fetch` and timeouts --- # Tutorials / Handle file uploads with object storage Source: https://docs.tissue.systems/docs/tutorials/file-uploads/ # Handle file uploads with object storage A private file drop: a web page with an upload form, files stored in an object storage bucket, and a download link for each one. Uploading needs a password you set; downloading needs only the link. One JavaScript file, one bucket, deployed to a live URL. It takes about fifteen minutes. If you haven't installed the CLI yet, do steps 1 and 2 of the [quick start](https://docs.tissue.systems/docs/get-started/) first (`ribo` install and `ribo login`). --- ## How it fits together The browser posts the form to your Cell. The Cell checks the password and the size, then writes the file to a g7 bucket through a binding, with no S3 keys in your code. Downloads go back through the Cell too, so the bucket stays private and the Cell decides who gets what. --- ## 1. Create the bucket and the password ```bash mkdir file-drop && cd file-drop ribo bucket create drop-files ``` Bucket names are 3 to 49 characters: lowercase letters, digits and hyphens. Buckets are private unless you pass `--public`, and this one should stay private. Now the upload password. Pick one, or generate one, and store it in the Cell's vault: ```bash openssl rand -base64 18 ribo vault set file-drop UPLOAD_TOKEN ``` `ribo vault set` prompts for the value with hidden input. Do this **before** the first deploy: a vault value that's missing at deploy time reaches the Cell as a placeholder string instead of your password, and the code below refuses uploads in that case. --- ## 2. Write the config **ribo.toml** ```toml [cell] name = "file-drop" js = "./cell.js" [[bindings]] type = "g7" binding = "FILES" bucket = "drop-files" [[bindings]] type = "vault" binding = "UPLOAD_TOKEN" ``` --- ## 3. Write the Cell **cell.js** ```js // The binding accepts up to 100 MiB per put. This drop takes less. const MAX_BYTES = 25 * 1024 * 1024; // A vault value that was never set arrives as this placeholder. const VAULT_UNSET = "***REMOVED***"; export default { async fetch(request, env) { const url = new URL(request.url); if (request.method === "GET" && url.pathname === "/") { return html(formPage()); } if (request.method === "POST" && url.pathname === "/upload") { return upload(request, env, url); } if (request.method === "GET" && url.pathname.startsWith("/f/")) { return download(env, url.pathname.slice(3)); } return new Response("Not found", { status: 404 }); }, }; async function upload(request, env, url) { let form; try { form = await request.formData(); } catch { return html(formPage("That upload didn't come through as a form."), 400); } if (!(await tokenMatches(form.get("token"), env.UPLOAD_TOKEN))) { return html(formPage("Wrong password."), 401); } const file = form.get("file"); if (!(file instanceof File) || file.size === 0) { return html(formPage("Choose a file first."), 400); } if (file.size > MAX_BYTES) { return html(formPage("That file is over 25 MB."), 413); } // A random folder per upload keeps two files with the same name apart and // makes the link unguessable. const id = crypto.randomUUID(); const key = `${id}/${safeName(file.name)}`; await env.FILES.put(key, file.stream(), { contentType: file.type || "application/octet-stream", }); const link = `${url.origin}/f/${key}`; return html(formPage(`Uploaded. Link: ${esc(link)}`), 201); } async function download(env, key) { const obj = await env.FILES.get(key); if (!obj) return new Response("Not found", { status: 404 }); const name = key.split("/").pop(); const headers = new Headers({ "content-type": obj.headers.get("content-type") ?? "application/octet-stream", // Download rather than display, so an uploaded HTML file can't run as a // page on this Cell's domain. "content-disposition": `attachment; filename="${name}"`, "x-content-type-options": "nosniff", }); const length = obj.headers.get("content-length"); if (length) headers.set("content-length", length); return new Response(obj.body, { headers }); } async function tokenMatches(given, secret) { if (typeof secret !== "string" || secret === "" || secret === VAULT_UNSET) return false; if (typeof given !== "string" || given === "") return false; // Compare SHA-256 digests byte by byte, so the time taken doesn't depend on // how much of the password was right. const enc = new TextEncoder(); const [a, b] = await Promise.all( [given, secret].map((v) => crypto.subtle.digest("SHA-256", enc.encode(v))) ); const x = new Uint8Array(a); const y = new Uint8Array(b); let diff = 0; for (let i = 0; i < x.length; i++) diff |= x[i] ^ y[i]; return diff === 0; } // Keys keep to letters, digits, dot, dash and underscore; anything else becomes "_". function safeName(name) { const cleaned = String(name).replace(/[^A-Za-z0-9._-]/g, "_").replace(/^\.+/, ""); return cleaned.slice(-100) || "file"; } function formPage(message = "") { return ` File drop

File drop

${message ? `

${message}

` : ""}
`; } function html(body, status = 200) { return new Response(body, { status, headers: { "content-type": "text/html; charset=utf-8" } }); } function esc(s) { return String(s).replace(/[&<>"]/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """ })[c]); } ``` What the important lines do: - `env.FILES.put(key, file.stream(), { contentType })` writes the object. A stream from a `File` carries its length, which the binding needs up front; a stream of unknown length is refused with `411`. - `env.FILES.get(key)` returns a standard `Response` (or `null`), with `content-type` and `content-length` headers from the stored object, so the download handler can pass the body straight through without loading it into memory. - `content-disposition: attachment` makes the browser save the file instead of opening it. Without it, someone could upload an HTML page with a script in it and send people a link that runs it on your Cell's domain. --- ## 4. Deploy ```bash ribo deploy ``` deployed file-drop address 33ed412f5c1vn kind js url https://file-drop.strand-9c.tissue.dev vault UPLOAD_TOKEN g7 FILES→drop-files --- ## 5. Upload something Open the `url` in a browser, choose a file, type the password and press **Upload**. The page comes back with the download link. The same thing works from a terminal. `-F file=@report.pdf` attaches a local file; `--form-string` sends the password as literal text, so a password starting with `@` or `<` isn't read as a filename: ```bash curl -s https://file-drop.strand-9c.tissue.dev/upload \ -F file=@report.pdf --form-string token='your-password' ``` And you can see what's in the bucket from the CLI: ```bash ribo bucket ls drop-files ``` --- ## What you have A password-protected upload page on HTTPS, files in private object storage, and a shareable link per file that downloads it. Nothing is publicly listable: a file can only be fetched by someone who has its link. To remove a file, delete it by key with `ribo bucket rm drop-files:`, where the key is the part of the link after `/f/`. Add a `DELETE` route that calls `env.FILES.delete(key)` if you'd rather do it over HTTP. For uploads from a script or another service that shouldn't go through the Cell, the management API can mint a short-lived signed URL for one object (`POST /v1/buckets/:bucket/presign`), and the bucket also speaks the S3 API. [g7 buckets](https://docs.tissue.systems/docs/g7/buckets/#public-access-and-external-clients) covers both. --- ## Next steps - [g7 binding API](https://docs.tissue.systems/docs/g7/api/): `get`, `head`, `put`, `delete` and `list` - [What is object storage?](https://docs.tissue.systems/docs/glossary/object-storage/): buckets, keys, and S3-compatible storage - [What is a presigned URL?](https://docs.tissue.systems/docs/glossary/presigned-url/): one-off access to a single object - [g7 limitations](https://docs.tissue.systems/docs/g7/limitations/): sizes, metadata and what the binding leaves out --- # Tutorials / Build a GitHub webhook receiver Source: https://docs.tissue.systems/docs/tutorials/webhook-receiver/ # Build a GitHub webhook receiver An HTTPS endpoint that receives GitHub webhooks, checks each delivery's signature against a shared secret, and records the event in a SQLite database. The same shape works for any service that signs its webhooks with HMAC-SHA256. It takes about fifteen minutes. If you haven't installed the CLI yet, do steps 1 and 2 of the [quick start](https://docs.tissue.systems/docs/get-started/) first (`ribo` install and `ribo login`). You also need a GitHub repository where you can change the settings. --- ## How webhook signatures work A webhook URL is public, so anyone who finds it can post to it. To prove a delivery came from GitHub, you give GitHub a secret when you create the webhook. GitHub computes an HMAC-SHA256 of each request body with that secret and sends it in the `X-Hub-Signature-256` header as `sha256=` followed by the hex digest. Your code computes the same HMAC over the raw body it received and accepts the delivery only if the two match. The check has to run on the body exactly as it arrived, before any JSON parsing, because re-serialized JSON won't produce the same bytes. --- ## 1. Create the database and the secret ```bash mkdir gh-hooks && cd gh-hooks ribo db create gh-events ``` Generate a secret, keep a copy for step 5, and store it in the Cell's vault: ```bash openssl rand -hex 32 ribo vault set gh-hooks GITHUB_WEBHOOK_SECRET ``` `ribo vault set` prompts for the value with hidden input. Set it **before** the first deploy: a vault value that's missing at deploy time reaches the Cell as a placeholder string, and every real delivery would then fail the signature check with nothing to say why. --- ## 2. Write the config **ribo.toml** ```toml [cell] name = "gh-hooks" js = "./cell.js" [[bindings]] type = "c3" binding = "DB" database = "gh-events" [[bindings]] type = "vault" binding = "GITHUB_WEBHOOK_SECRET" ``` --- ## 3. Write the Cell **cell.js** ```js const SCHEMA = ` CREATE TABLE IF NOT EXISTS events ( delivery TEXT PRIMARY KEY, event TEXT NOT NULL, action TEXT, repo TEXT, sender TEXT, received_at TEXT NOT NULL DEFAULT (datetime('now')) ) `; // A vault value that was never set arrives as this placeholder. const VAULT_UNSET = "***REMOVED***"; export default { async fetch(request, env) { const url = new URL(request.url); if (url.pathname !== "/github") return new Response("Not found", { status: 404 }); if (request.method !== "POST") return new Response("Method not allowed", { status: 405 }); const secret = env.GITHUB_WEBHOOK_SECRET; if (typeof secret !== "string" || secret === "" || secret === VAULT_UNSET) { return new Response("Webhook secret is not configured", { status: 503 }); } // Verify the raw bytes before parsing anything. const body = await request.arrayBuffer(); const signature = request.headers.get("x-hub-signature-256") ?? ""; if (!(await validSignature(secret, body, signature))) { return new Response("Bad signature", { status: 401 }); } const event = request.headers.get("x-github-event") ?? "unknown"; const delivery = request.headers.get("x-github-delivery") ?? crypto.randomUUID(); let payload; try { payload = JSON.parse(new TextDecoder().decode(body)); } catch { return new Response("Set the webhook's content type to application/json", { status: 415 }); } await env.DB.exec(SCHEMA); // A redelivery from GitHub carries the same delivery id, so it is // recorded once. await env.DB.prepare( "INSERT OR IGNORE INTO events (delivery, event, action, repo, sender) VALUES (?, ?, ?, ?, ?)" ).bind( delivery, event, payload.action ?? null, payload.repository?.full_name ?? null, payload.sender?.login ?? null ).run(); return new Response("ok"); }, }; async function validSignature(secret, body, header) { if (!header.startsWith("sha256=")) return false; const hex = header.slice("sha256=".length); if (!/^[0-9a-f]{64}$/.test(hex)) return false; const sig = new Uint8Array(32); for (let i = 0; i < 32; i++) sig[i] = parseInt(hex.slice(i * 2, i * 2 + 2), 16); const key = await crypto.subtle.importKey( "raw", new TextEncoder().encode(secret), { name: "HMAC", hash: "SHA-256" }, false, ["verify"] ); // verify() compares in constant time, so a wrong signature takes as long to // reject as a nearly right one. return crypto.subtle.verify("HMAC", key, sig, body); } ``` The handler answers quickly and does one insert. GitHub expects a fast answer, so if you later add slow work (calling another API, sending a message), keep the insert in the request and do the rest from a [scheduled pulse](https://docs.tissue.systems/docs/tutorials/scheduled-job/) that reads new rows, or after the response with `ctx.waitUntil()`. --- ## 4. Deploy ```bash ribo deploy ``` deployed gh-hooks address 33ed412f8r6yb kind js url https://gh-hooks.strand-9c.tissue.dev c3 DB→gh-events vault GITHUB_WEBHOOK_SECRET Before involving GitHub, check the signature code with a delivery you sign yourself: ```bash HOOK=https://gh-hooks.strand-9c.tissue.dev/github # your url, plus /github SECRET=... # the hex string from step 1 BODY='{"zen":"testing","repository":{"full_name":"me/test"}}' SIG=$(printf '%s' "$BODY" | openssl dgst -sha256 -hmac "$SECRET" | awk '{print $NF}') curl -s $HOOK -H "x-github-event: ping" -H "x-hub-signature-256: sha256=$SIG" \ -H 'content-type: application/json' -d "$BODY" # ok curl -s $HOOK -H "x-hub-signature-256: sha256=0000" -d "$BODY" # Bad signature ``` --- ## 5. Connect GitHub In the repository on GitHub, open **Settings**, then **Webhooks**, then **Add webhook**: - **Payload URL**: your `url` with `/github` on the end - **Content type**: `application/json` - **Secret**: the hex string from step 1 Choose which events to send, and save. GitHub sends a `ping` event straight away. Push a commit or open an issue, then look at what arrived: ```bash ribo db exec gh-events "SELECT received_at, event, action, repo, sender FROM events ORDER BY received_at DESC LIMIT 20" ``` GitHub's webhook settings page also lists each recent delivery with the response your Cell gave, which is the first place to look if a row is missing. A `401` there means the secret in GitHub and the one in the vault differ. --- ## What you have A public HTTPS webhook endpoint that rejects anything not signed with your secret and records every GitHub event once, by delivery id, in a SQLite table you can query. To change the secret, update it in GitHub and run `ribo vault set gh-hooks GITHUB_WEBHOOK_SECRET` with the same value. If you'd rather keep the signing secret out of your code altogether and get retries and replay, Tissue Cloud's webhook inbox can sit in front of the Cell. A [vesicle endpoint](https://docs.tissue.systems/docs/vesicle/overview/) created with `--verify github:GITHUB_WEBHOOK_SECRET` checks the same header before it stores the delivery, then forwards it to the Cell's `/github` route, which can drop its own signature check. --- ## Next steps - [Vesicle: webhook inbox](https://docs.tissue.systems/docs/vesicle/overview/): capture, verification, retries and replay - [What is a webhook?](https://docs.tissue.systems/docs/glossary/webhook/): the pattern in general - [c3 API reference](https://docs.tissue.systems/docs/c3/api/) - [Vault security](https://docs.tissue.systems/docs/cells/vault-security/): how secrets are stored and injected --- # Cells: compute / Overview Source: https://docs.tissue.systems/docs/cells/overview/ # Cells: overview A **Cell** is the fundamental unit of computation on tissue.systems. It is an isolated function that handles HTTP requests and returns HTTP responses. --- ## The interface Every Cell exports a default object with a `fetch` method: ```js export default { async fetch(request, env, ctx) { return new Response("ok"); }, }; ``` | Argument | Type | Description | |-----------|-----------|---------------------------------------------------| | `request` | `Request` | The incoming HTTP request | | `env` | `object` | Bound resources: databases, buckets, text values | | `ctx` | `object` | Execution context; `ctx.waitUntil(promise)` lets work finish after the response is sent | The return value must be a `Response` (or a `Promise`). --- ## Isolation Each Cell runs in its own isolated V8 instance: a separate JavaScript runtime with its own memory, heap, and execution context. Cells cannot share memory with each other. There is no global state between requests or between Cells. This isolation is by design. It means: - A bug in one Cell cannot affect another - Each Cell starts from a clean slate - Cells are horizontally scalable by nature The isolate is reused across requests for warm performance. Redeploying the Cell immediately provisions a fresh isolate for subsequent requests. --- ## What a Cell can do - Handle any HTTP method: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS - Parse and inspect request headers, URL, and body - Return any HTTP response: HTML, JSON, binary, redirects - Call external HTTP APIs using the standard `fetch()` function - Read and write c3 SQLite databases via the `env.DB` binding - Read and write g7 object storage via the `env.BUCKET` binding - Serve static file trees via the `env.FILES` binding - Run on a cron schedule via [pulse](https://docs.tissue.systems/docs/pulse/overview/), declared in `ribo.toml` - Receive webhook deliveries captured by [vesicle](https://docs.tissue.systems/docs/vesicle/overview/), on a route you bind - Receive sensor readings from a device through [synapse](https://docs.tissue.systems/docs/synapse/overview/), via a `sensor(event, env)` handler - Restrict who may reach its URL with a [gate](https://docs.tissue.systems/docs/cells/gate/), enforced at the edge before the Cell runs --- ## What a Cell cannot do - Access the local filesystem - Spawn processes or threads - Open TCP/UDP sockets directly (only `fetch()` is available) - Maintain state between requests without a binding - Communicate directly with other Cells --- ## Cell kinds Cells come in two kinds: **JavaScript.** The most common kind. You write a `.js` (or bundled TypeScript) module and point `ribo.toml` at it. The module runs as-is in the V8 runtime. **WebAssembly (WASM).** A compiled binary, typically from Rust via `wasm-pack`. Useful for CPU-intensive work, existing Rust libraries, or code that must not be distributed as source. The WASM binary receives requests as a JSON-serialised string and returns a JSON-serialised response. --- ## Addresses and URLs Each Cell gets a stable **address**: a 13-character alphanumeric ID assigned on first deploy. The same Cell keeps its address across every redeploy; it never changes. The public URL is: https://..tissue.dev where `` is a stable per-account subdomain (e.g. `strand-9c`). For example, a Cell named `my-cell` is reachable at `https://my-cell.strand-9c.tissue.dev`. The URL is printed after every `ribo deploy`. --- ## See also - [Writing Cells](https://docs.tissue.systems/docs/cells/writing/): JavaScript and WASM examples - [ribo.toml reference](https://docs.tissue.systems/docs/cells/configuration/): the full config schema - [Access control (Gate)](https://docs.tissue.systems/docs/cells/gate/): who may reach the Cell's URL - [Pulse](https://docs.tissue.systems/docs/pulse/overview/): scheduled Cell invocations - [Vesicle](https://docs.tissue.systems/docs/vesicle/overview/): webhook endpoints bound to a Cell route - [Synapse](https://docs.tissue.systems/docs/synapse/overview/): sensor readings dispatched to a Cell - [Cell limitations](https://docs.tissue.systems/docs/cells/limitations/) --- # Cells: compute / Writing Cells Source: https://docs.tissue.systems/docs/cells/writing/ # Writing Cells --- ## JavaScript Cells A JavaScript Cell is a module that exports a default object with a `fetch` handler. ### Routing Route on `url.pathname`: ```js export default { async fetch(request, env) { const url = new URL(request.url); if (url.pathname === "/api/status") { return Response.json({ ok: true, ts: Date.now() }); } if (request.method === "POST" && url.pathname === "/echo") { const body = await request.text(); return new Response(body, { headers: { "content-type": "text/plain" } }); } return new Response("Not found", { status: 404 }); }, }; ``` ### Reading request data ```js // URL and query params const url = new URL(request.url); const page = url.searchParams.get("page") ?? "0"; // JSON body const data = await request.json(); // Form data const form = await request.formData(); const name = form.get("name"); // Raw text const text = await request.text(); // Headers const auth = request.headers.get("authorization"); ``` ### Outbound fetch Cells have unrestricted outbound internet access via the standard `fetch()`: ```js const res = await fetch("https://api.example.com/data"); const json = await res.json(); ``` Fan out to multiple APIs in parallel: ```js const [weather, rates] = await Promise.all([ fetch("https://api.open-meteo.com/v1/forecast?...").then(r => r.json()), fetch("https://api.exchangerate.host/latest").then(r => r.json()), ]); ``` Use `AbortSignal.timeout()` to enforce deadlines: ```js const res = await fetch("https://slow-api.example.com/data", { signal: AbortSignal.timeout(5000), // 5 seconds }); ``` ### Returning responses ```js // Plain text return new Response("hello", { headers: { "content-type": "text/plain" } }); // JSON return Response.json({ ok: true, items: [] }); // HTML return new Response("

Hello

", { headers: { "content-type": "text/html; charset=utf-8" }, }); // Redirect return Response.redirect("https://example.com", 302); // Custom status and headers return new Response("Created", { status: 201, headers: { "content-type": "text/plain", "x-request-id": crypto.randomUUID(), }, }); ``` ### TypeScript `ribo.toml` supports a `build` command. Bundle TypeScript with any tool that produces a single ESM file: ```toml [cell] name = "my-cell" js = "./dist/cell.js" build = "npx esbuild src/cell.ts --bundle --outfile=dist/cell.js --format=esm --platform=browser" ``` ribo runs the build command before uploading the output file. --- ## Rust / WASM Cells Compile a Rust library to WebAssembly and deploy it as a Cell. The full HTTP handler (routing, logic, response generation) lives in the WASM binary. ### How it works When a request arrives, the tissue runtime: 1. Serialises the request to a JSON string: `{ method, url, headers, body }` 2. Calls your exported `fetch(req_json: String)` function 3. Deserialises the returned `{ status, headers, body }` into an HTTP response Your Rust code never sees the JS runtime or the DOM, just plain Rust strings. ### Cargo.toml ```toml [lib] crate-type = ["cdylib"] [dependencies] wasm-bindgen = "0.2" serde = { version = "1", features = ["derive"] } serde_json = "1" serde-wasm-bindgen = "0.6" # only if you return a JsValue, as below [profile.release] opt-level = "z" lto = true ``` ### src/lib.rs ```rust use wasm_bindgen::prelude::*; use serde::{Deserialize, Serialize}; #[derive(Deserialize)] struct IncomingRequest { method: String, url: String, headers: std::collections::HashMap, body: Option, } #[derive(Serialize)] struct OutgoingResponse { status: u16, headers: std::collections::HashMap, body: String, } #[wasm_bindgen] pub fn fetch(req_json: String) -> JsValue { let req: IncomingRequest = serde_json::from_str(&req_json).unwrap(); let resp = match (req.method.as_str(), req.url.as_str()) { ("GET", _) => OutgoingResponse { status: 200, headers: [("content-type".into(), "text/plain".into())].into(), body: format!("Hello from Rust! URL: {}", req.url), }, _ => OutgoingResponse { status: 405, headers: [("content-type".into(), "application/json".into())].into(), body: r#"{"error":"method not allowed"}"#.into(), }, }; serde_wasm_bindgen::to_value(&resp).unwrap() } ``` `fetch` may return the response either as a `JsValue` object, as above, or as the same `{ status, headers, body }` serialized to a JSON `String`. The runtime accepts both, and returning a `String` keeps the dependency list at `serde_json`. A returned string that isn't JSON becomes the response body with status 200. ### Build and deploy ```bash # requires wasm-pack: https://rustwasm.github.io/wasm-pack/ wasm-pack build --target web --out-dir pkg ``` **ribo.toml** ```toml [cell] name = "my-rust-cell" wasm = "./pkg/my_cell_bg.wasm" build = "wasm-pack build --target web --out-dir pkg" bindgen_glue = "./pkg/my_cell.js" ``` The `build` command runs automatically before upload. `bindgen_glue` points to the JS file generated by `wasm-pack`; it bridges the JS runtime and the WASM binary. --- ## Bindings in cell code When a Cell has [bindings declared in ribo.toml](https://docs.tissue.systems/docs/cells/configuration/), they appear on the `env` object passed to `fetch`: ```js export default { async fetch(request, env) { // env.DB = a c3 database // env.BUCKET = a g7 object storage bucket // env.FILES = a g7 static file tree // env.API_KEY = a plain text value }, }; ``` See [c3 API reference](https://docs.tissue.systems/docs/c3/api/) and [g7 API reference](https://docs.tissue.systems/docs/g7/api/) for how to use these bindings. --- # Cells: compute / ribo.toml reference Source: https://docs.tissue.systems/docs/cells/configuration/ # ribo.toml reference Every Cell has a `ribo.toml` configuration file. `ribo deploy` reads it from the current directory by default, or from the path given by `--config`. --- ## [cell] The `[cell]` table is required. ```toml [cell] name = "my-cell" # required js = "./cell.js" # required (or wasm, or static) build = "npm run build" # optional; runs before uploading ``` ### Fields | Field | Type | Required | Description | |----|----|----|----| | `name` | string | yes | Human-readable name. Used to derive the stable address. | | `js` | string | one of | Path to the JavaScript entry point (relative to ribo.toml) | | `wasm` | string | one of | Path to the compiled `.wasm` file | | `static` | string | one of | Path to a local directory; deploys a static site with no JS required | | `build` | string | no | Shell command to run before deploying. Runs in the directory containing ribo.toml. | | `bindgen_glue` | string | no | Path to the `wasm-bindgen` JS glue file. Required when `wasm` is set and the binary uses `wasm-bindgen`. | | `account_id` | string | no | Pin this project to an account (`acct_...`). See [Account pin](#account-pin). | | `account` | string | no | Human-readable label for the pinned account. Display-only, never enforced. | | `compatibility_date` | string | no | Runtime behaviour date, `YYYY-MM-DD`. See [Runtime compatibility](#runtime-compatibility). | | `compatibility_flags` | array | no | Runtime features to enable, e.g. `["nodejs_als"]`. | Exactly one of `js`, `wasm`, or `static` must be present. ### Account pin `account_id` pins the Cell to a specific account so it can't be deployed into the wrong one. When set, `ribo deploy` compares it against your active account (from your auth token) and **refuses to deploy on a mismatch**, before uploading anything: ```toml [cell] name = "my-cell" js = "./cell.js" account_id = "acct_3f8c1a2b4d6e8f00" # only deployable from this account account = "Acme Corp" # optional label, shown in output ``` The pin is an **assertion, not a selector**: it never *changes* which account is used, it only guards against deploying this project somewhere unintended. The optional `account` label is display-only and is never used for enforcement (account names are mutable; the id is the identifier). Generate the pin without hand-copying the id with [`ribo account pin`](https://docs.tissue.systems/docs/ribo/reference/#ribo-account-pin). > Don't pin shared/example templates that others deploy into their own accounts; the pin would refuse their deploys. The pin catches a wrong account; it doesn't *choose* the right one. If you regularly work across several accounts (or run agents that deploy for you), bind each project tree to its own credential with [profiles](https://docs.tissue.systems/docs/ribo/profiles/), and keep the pin as the backstop. ### Runtime compatibility Your Cell runs in its own V8 isolate. Some runtime behaviour is dated, so that fixes and changes can land without altering how already-deployed code behaves. `compatibility_date` selects which set of behaviours your Cell sees, and `compatibility_flags` turns on individual features by name. ```toml [cell] name = "my-cell" js = "./cell.js" compatibility_date = "2026-06-16" compatibility_flags = ["nodejs_als"] ``` Both keys are optional. Omit them and your Cell gets the platform default, which doesn't move on its own. A Cell's runtime behaviour changes only when you change these keys and redeploy. `compatibility_date` must be a real calendar date written as `YYYY-MM-DD`, zero-padded (`2026-06-16`, not `2026-6-16`), and no later than the date the platform supports. A date the platform can't serve is rejected at deploy time with the newest one it accepts. Available flags: | Flag | Effect | |----|----| | `nodejs_als` | Enables `AsyncLocalStorage` from `node:async_hooks`. | | `nodejs_compat` | Enables the Node.js compatibility layer (`node:*` built-ins). | | `nodejs_compat_v2` | The v2 Node.js compatibility layer. | A flag outside this list is rejected at deploy time rather than accepted and ignored. Two things to know: - **Changes take effect on redeploy.** Editing these keys without running `ribo deploy` changes nothing; the settings are read when your Cell's isolate is loaded, and that is keyed to the deployed version. - **Older `ribo` versions ignore these keys silently.** `ribo` 2026.08.2 and later send them. An earlier version parses the keys, drops them, and reports a successful deploy, with your Cell still on the defaults. Run `ribo --version` if a flag doesn't appear to take effect. --- ## [[bindings]] Each `[[bindings]]` block declares a resource that the Cell can access at runtime. The `binding` name becomes a property on the `env` object passed to `fetch`. There are five types, and this is the whole list: | `type` | Gives the Cell | Declared with | |---|---|---| | `c3` | a SQL database | `database` | | `g7` | an object storage bucket | `bucket` | | `files` | a static file tree, served by name | `dir` | | `text` | a plain string, stored in `ribo.toml` | `value` | | `vault` | an encrypted secret, stored server-side | the key name alone | `type` is matched exactly and in lowercase. Any other value fails the deploy and names the five, so a binding that would not have existed at runtime is caught before the Cell ships rather than as an `undefined` in `env` later: $ ribo deploy Error: unknown [[bindings]] type "secret" on binding "API_KEY": valid types are c3, text, g7, files, vault did you mean type = "vault"? Anything a Cell reaches over the network needs no binding at all. A `fetch` to an outside service works from a Cell the way it works anywhere, and a credential that call needs belongs in a `vault` binding. ### c3: SQLite database ```toml [[bindings]] type = "c3" binding = "DB" # env.DB in your cell database = "myapp" # database name (created with ribo db create) ``` Multiple databases: ```toml [[bindings]] type = "c3" binding = "USERS" database = "users" [[bindings]] type = "c3" binding = "LOGS" database = "request-logs" ``` ### g7: Object storage bucket ```toml [[bindings]] type = "g7" binding = "IMAGES" # env.IMAGES in your cell bucket = "avatars" # bucket name (created with ribo bucket create) ``` ### files: Static file tree ```toml [[bindings]] type = "files" binding = "ASSETS" # env.ASSETS in your cell dir = "./public" # local directory to upload ``` Files are uploaded at deploy time and served from object storage. The binding has a `fetch(request)` method for URL-based serving and a `get(key)` method for direct access. `dir` is the whole boundary, and it has no default. Every regular file beneath it is uploaded, with no exclusion list, and the bucket serves each one under its own name. Point it at a directory that holds only what the site serves. A binding written `dir = "."` publishes this `ribo.toml`, any `.env` file beside it and the whole `.git` directory, which is why the convention is a `public/` subdirectory with `ribo.toml` and `cell.js` one level above it. A `files` block with no `dir` key parses and uploads nothing. `ribo deploy` warns when it finds such an object and prints the URL it answers on; [`ribo deploy --unpublish-config`](https://docs.tissue.systems/docs/ribo/reference/#ribo-deploy) deletes those keys from the bucket. Removing a file locally doesn't unpublish it, because a deploy never deletes. ### text: Plain string value ```toml [[bindings]] type = "text" binding = "API_KEY" # env.API_KEY in your cell value = "sk-..." # literal string value ``` Use text bindings for configuration, feature flags, or non-secret string values. ### vault: Encrypted secret ```toml [[bindings]] type = "vault" binding = "JWT_SECRET" # env.JWT_SECRET in your cell ``` A vault binding injects a secret value at dispatch time. Unlike `text`, the value is **not** stored in `ribo.toml`; only the key name is. The value itself is set separately with [`ribo vault set`](https://docs.tissue.systems/docs/ribo/reference/#ribo-vault) and stored encrypted server-side. Use vault bindings for API keys, signing secrets, database credentials, and any other sensitive value you don't want committed to source control. ```bash ribo vault set my-cell JWT_SECRET # set the value (prompts for hidden input) ribo deploy # then deploy ``` **Important:** set the vault value with `ribo vault set` **before** deploying a cell that declares a `vault` binding. If the value is missing at deploy time the binding is stored as a placeholder, and the cell will receive that placeholder instead of the real secret, causing silent failures. See [`ribo vault`](https://docs.tissue.systems/docs/ribo/reference/#ribo-vault) for the full command reference. For how vault values are protected (encryption at rest, when decryption happens, scopes, auditing, and rotation), see the [Vault security model](https://docs.tissue.systems/docs/cells/vault-security/). --- ## [[pulse]] Each `[[pulse]]` block declares a cron schedule. The platform calls the Cell's `pulse(event, env)` handler at each scheduled time. ```toml [[pulse]] schedule = "0 * * * *" # every hour at :00 [[pulse]] schedule = "*/15 * * * *" # every 15 minutes ``` Multiple `[[pulse]]` blocks are allowed. Each fires independently. ### Fields | Field | Type | Required | Description | |------------|--------|----------|----------------------------------------------------------------| | `schedule` | string | yes | 5-field POSIX cron expression (UTC). Validated at deploy time. | Cron syntax: `min hour dom month dow`. All times are UTC. Minimum interval is 1 minute. Day-of-week runs 1–7 with Sunday as 1, so Monday is `2`. A Cell may declare at most 25 schedules; an expression the scheduler cannot parse fails the deploy with a `400` naming it. See [Pulse overview](https://docs.tissue.systems/docs/pulse/overview/) for the handler interface and examples. --- ## [gate] Restrict who can reach the Cell's public URL. The policy deploys with the Cell and is enforced at the edge before your code runs. See [Access control (Gate)](https://docs.tissue.systems/docs/cells/gate/) for the full model. ```toml [gate] audience = "domain" domains = ["yourco.com"] allow = ["contractor@example.com"] [gate.session] ttl = "7d" ``` ### Fields | Field | Type | Required | Description | |------------|----------|----------|------------------------------------------------------------------------------------------------| | `audience` | string | yes | One of `public`, `link`, `private`, `account`, `emails`, `domain`, `sso`. | | `allow` | string[] | for `emails` | Allowed email addresses. Optional extra allowance for other audiences. | | `domains` | string[] | for `domain` | Allowed email domains, e.g. `"yourco.com"`. | | `links` | bool | no | Accept capability links (`ribo gate link`). Default `true`. | | `[gate.session] ttl` | duration | no | Session lifetime, `"1h"`–`"90d"` (default `"30d"`). | | `[gate.source.]` | table | for `sso` | An identity provider for federated sign-in: one table per provider, up to 8. See below. | The config is validated at deploy time; an invalid gate fails the deploy rather than deploying the Cell open. Removing the `[gate]` block removes the gate on the next deploy. ### [gate.source] For `audience = "sso"`, each `[gate.source.]` table declares one identity provider. The table name (`google`, `okta`, …) becomes the URL path segment of the provider's callback and the default label on its sign-in button. Names are 1–32 characters of lowercase letters, digits, `-` or `_`; a policy holds at most 8 sources, and `sso` requires at least one. ```toml [gate] audience = "sso" domains = ["acme.com"] [gate.source.okta] type = "oidc" issuer = "https://acme.okta.com" client_id = "0oa..." scopes = "openid email profile groups" groups_claim = "groups" label = "Acme Okta" ``` | Field | Type | Required | Description | |----|----|----|----| | `type` | string | yes | `oidc` (any compliant provider), or the presets `google` / `github`. | | `issuer` | string | for `oidc` | The provider's https issuer URL, exactly as the provider states it (a trailing slash is kept). Forbidden for the presets, whose issuer is fixed. | | `client_id` | string | yes | The OAuth client id issued by the provider. | | `scopes` | string | no | Scopes requested from the provider, default `"openid email profile"`. `oidc` only. | | `groups_claim` | string | no | ID-token claim read for group names, default `"groups"`. `oidc` only. | | `label` | string | no | Sign-in button text. Defaults to the source name. | The client secret is never a `ribo.toml` key. It lives in the Cell's vault under `GATE_OIDC_` (the source name uppercased with `-` mapped to `_`, so `[gate.source.acme-sso]` reads `GATE_OIDC_ACME_SSO`) and must be set with [`ribo vault set`](https://docs.tissue.systems/docs/ribo/reference/#ribo-vault) before deploying; a deploy with a missing secret fails and names the command to run. A `google` or `github` source additionally requires a non-empty `domains` or `allow` on the `[gate]` table. See [federated sign-in](https://docs.tissue.systems/docs/cells/gate/#federated-sign-in) for the model and [Connect an identity provider](https://docs.tissue.systems/docs/cells/gate-sso/) for per-provider setup. --- ## [server] Override the default management API URL. Useful for local development. ```toml [server] url = "http://localhost:8082" ``` When omitted, ribo uses `https://api.tissue.systems`. --- ## Complete example ```toml [cell] name = "notes-app" js = "./dist/cell.js" build = "esbuild src/cell.ts --bundle --outfile=dist/cell.js --format=esm" [[pulse]] schedule = "0 * * * *" # hourly cleanup [[bindings]] type = "c3" binding = "DB" database = "notes" [[bindings]] type = "g7" binding = "UPLOADS" bucket = "note-attachments" [[bindings]] type = "text" binding = "APP_VERSION" value = "1.0.0" ``` --- ## Static site shorthand For a Cell that only serves static files, the `static` field eliminates the need for a JS entry point entirely: ```toml [cell] name = "my-site" static = "./public" ``` ribo generates the pass-through worker automatically and deploys the directory contents. See [Static sites](https://docs.tissue.systems/docs/g7/static-sites/) for routing behaviour and the hybrid (static + dynamic) pattern. --- # Cells: compute / Vault security model Source: https://docs.tissue.systems/docs/cells/vault-security/ # Vault security model This page explains what actually happens to a secret when you run [`ribo vault set`](https://docs.tissue.systems/docs/ribo/reference/#ribo-vault): how it is stored, when it is decrypted, who can access it, and what the vault does **not** protect against. If you are deciding whether to put an API key, signing secret, or database credential into a `type = "vault"` binding, this is the page to read. For usage, see [ribo.toml Reference → vault](https://docs.tissue.systems/docs/cells/configuration/#vault-encrypted-secret) and the [`ribo vault` command reference](https://docs.tissue.systems/docs/ribo/reference/#ribo-vault). --- ## The lifecycle of a secret 1. **You set it.** `ribo vault set my-cell API_KEY` reads the value with hidden input (or from an environment variable) and sends it to the management API over HTTPS. It never touches `ribo.toml`, your git history, your shell history, or the deploy bundle. 2. **It is encrypted immediately.** The management API encrypts the value with **AES-256-GCM** (authenticated encryption with a fresh random nonce per write) before storing it. Only the resulting ciphertext is persisted, in Tissue's replicated configuration store. 3. **It stays encrypted at rest.** The encryption key is a 256-bit platform key held only on the management host, separate from the replicated ciphertext; a copy of the storage layer alone is not enough to recover any secret. 4. **It is decrypted only at dispatch.** When your Cell is loaded to serve a request, the platform decrypts the value and injects it into the Cell's environment (`env.API_KEY`), over an internally-authenticated channel that is not reachable from the public internet. The plaintext exists only in memory, for the lifetime of the running Cell instance. ## What the API will never do - **No endpoint returns a stored value.** `ribo vault list` (and the underlying `GET /v1/vault/...` API) return key **names** only. From the outside, the vault is write-only: you can set, list, and delete, never read back. - **Values are never logged**: not in request logs, not in the audit trail. ## Access control and auditing - Vault routes require authentication, and API tokens must carry the explicit `vault:read` (list names) or `vault:write` (set/delete) scope. A token minted for deploys with `cells:write` alone cannot touch the vault. - Every vault **set** and **delete** is recorded in the platform audit trail: which account, which actor (interactive session vs. API token), which cell and key, and when. The recorded event contains the key name only, never the value. ## The trust boundary The vault protects you against the realistic, common failure modes, but no hosted secret store can protect a secret from the platform that has to hand it to your running code in the end. Concretely: **The vault protects against:** - Secrets leaking through **source control**: the value is never in `ribo.toml`, the bundle, or git history. - Compromise or exposure of the **storage layer**: backups and replicas hold only AES-256-GCM ciphertext, and the key lives elsewhere. - **Other tenants**: vault entries are scoped to your account; no API path crosses that boundary. - **Read-back by leaked credentials with narrow scopes**: a stolen token without `vault:write` can't overwrite secrets, and *no* token can read one. **The vault does not protect against:** - **The platform operator.** Tissue's infrastructure decrypts your secret to hand it to your Cell; that is the service working as designed. Operators do not have a "read secret" tool, but you are trusting the platform, exactly as you do with the equivalent feature on any hosted serverless provider. - **Your own Cell's code.** Anything running in the Cell can read `env.API_KEY` and send it anywhere. Review your dependencies; a Cell's secret is only as safe as the code you deploy. - **Anyone allowed to deploy your Cell.** Deploy rights effectively include the ability to exfiltrate the injected secrets from inside the Cell. If your threat model cannot accept the platform seeing a secret at dispatch time, keep that secret outside Tissue and have your Cell talk to it indirectly (for example, a backend you host that holds the credential itself). ## Rotating a secret Vault values are injected when a Cell instance is loaded, so a rotation is two steps, and it isn't done until the second one: ```bash ribo vault set my-cell API_KEY # 1. store the new value ribo deploy # 2. redeploy so running instances reload it ``` Without the redeploy, an already-running Cell instance keeps the old value until it is next evicted. Rotate immediately if a token with `vault:write` scope leaks, a teammate with access leaves, or an upstream provider reports a credential exposure. ## Practical recommendations - **Set before deploy.** A `vault` binding whose value is missing at deploy time is stored as a placeholder, and your Cell will see the placeholder string, a silent failure. Run `ribo vault set` first. - **Use narrow API tokens in CI.** A pipeline that only deploys needs `cells:write`; give it `vault:write` only if it actually rotates secrets. - **Prefer vault over `${VAR}` substitution for anything sensitive.** Environment substitution in `type = "text"` bindings is for non-secret, environment-specific values; the resolved value still travels inside the deploy bundle. - **One credential per key.** Don't pack JSON blobs of multiple credentials into one entry; separate keys rotate and audit independently. --- # Cells: compute / Access control (Gate) Source: https://docs.tissue.systems/docs/cells/gate/ # Access control (Gate) By default every Cell is public: anyone who knows the URL can call it. A **gate** puts an access policy in front of a Cell's public URL, enforced at the edge **before your code runs**. Visitors who don't satisfy the policy get a hosted sign-in or denial page; your Cell never sees the request. A gate needs **no code changes**. You declare who may enter; the platform handles login pages, magic links, sessions, and revocation. --- ## Audiences The policy's `audience` says who gets in: | Audience | Who may access the Cell | |---|---| | `link` | Only holders of a **capability link** you mint (`tal_` token, shared as a URL) | | `private` | Only you. Sign in with your Tissue Cloud account | | `account` | Any member of the Cell's account | | `emails` | Listed email addresses (`allow`), verified by emailed one-time code | | `domain` | Anyone with an email under the listed domains (`domains`), e.g. `yourco.com` | | `sso` | Anyone your identity provider signs in (Google, GitHub, or any OIDC issuer), subject to `domains`/`allow`. See [federated sign-in](#federated-sign-in) | | `public` | No restriction (gate configured but open; useful as a staging state) | Two extra knobs apply to every audience: - `allow`: extra email addresses admitted alongside the main audience. - `links = true|false`: whether capability links are accepted (default `true`). --- ## Gating a Cell from ribo.toml Add a `[gate]` block and deploy: ```toml [cell] name = "internal-dash" js = "./cell.js" [gate] audience = "domain" domains = ["yourco.com"] allow = ["contractor@example.com"] # extra individual allowance [gate.session] ttl = "7d" # session lifetime, 1h–90d (default 30d) ``` The policy rides along with `ribo deploy` and is validated before anything is written. A typo in the gate config fails the deploy rather than deploying the Cell open. The simplest gate shares with specific people via links only: ```toml [gate] audience = "link" ``` **Deploys are the source of truth for ribo.toml gates.** A deploy whose ribo.toml has a `[gate]` block replaces the Cell's stored policy; a deploy *without* one removes a previously deployed gate. A policy set via the API or dashboard (source `api`) is different: deploys without a `[gate]` block leave it alone. --- ## Federated sign-in `audience = "sso"` delegates sign-in to an identity provider instead of emailed codes. Visitors pick a provider on the hosted sign-in page, authenticate there, and come back with a normal gate session. Your Cell reads the same headers as for every other audience. Declare each provider as a `[gate.source.]` table: ```toml [gate] audience = "sso" domains = ["acme.com"] # optional; constrains the IdP-asserted email allow = ["bob@gmail.com"] # optional extra allowance [gate.source.google] type = "google" # preset — issuer https://accounts.google.com implied client_id = "1234-abc.apps.googleusercontent.com" # secret: ribo vault set GATE_OIDC_GOOGLE [gate.source.github] type = "github" # preset — plain OAuth2 against github.com, NOT OIDC client_id = "Iv1abc..." [gate.source.okta] # generic OIDC — Okta, Entra, Authentik, Keycloak, Pocket ID… type = "oidc" issuer = "https://acme.okta.com" client_id = "0oa..." scopes = "openid email profile groups" # optional; default "openid email profile" groups_claim = "groups" # optional; default "groups" label = "Acme Okta" # optional button text; default: source name ``` Each source needs its **client secret** in the Cell's vault before deploying. The key is `GATE_OIDC_` plus the source name uppercased, with `-` replaced by `_`: ```bash ribo vault set internal-dash GATE_OIDC_GOOGLE ``` A deploy with a source whose secret is missing fails and prints that exact command. Setting up each provider's console side (Google, GitHub, Authentik, Keycloak, Pocket ID, Microsoft Entra ID) has its own page: [Connect an identity provider](https://docs.tissue.systems/docs/cells/gate-sso/). **The provider authenticates; the gate decides membership.** `domains` and `allow` apply to the email address the provider asserts, exactly as they do for the email audiences, so a Google sign-in from outside `acme.com` is denied even though Google vouched for it. One guard rail: a source that would admit everyone at a public provider (a `google` or `github` source, or an `oidc` source pointed at a shared consumer issuer such as `https://accounts.google.com` or a Microsoft `common`/`consumers`/`organizations` tenant) is rejected at deploy time when `domains` and `allow` are both empty. With your own single-tenant provider (`type = "oidc"`), both may be empty. There, who may sign in is the provider's decision. **The redirect URI is per hostname.** Every hostname the Cell serves on registers its own callback with the provider: `https://..tissue.dev/.tissue/gate/oidc//callback`. A [custom domain](https://docs.tissue.systems/docs/cells/custom-domains/) registers its hostname's version too. Two things about sessions: - **Editing the gate policy signs everyone out.** Any policy change bumps the policy version, and sessions minted under an older version stop verifying at the edge, and visitors sign in again through their provider. - **Signing out of the Cell is not signing out of the provider.** Revoking a gate session ends access to the Cell; the visitor's session at Google, GitHub, or their IdP is untouched, so their next visit typically signs straight back in without a prompt. --- ## Capability links For `audience = "link"` (or any gate with `links` enabled), mint a shareable URL: ```console $ ribo gate link internal-dash ✓ Created link ab12cd34ef56 for internal-dash token: tal_ab12cd34ef56.… url: https://internal-dash.strand-9c.tissue.dev/?k=tal_ab12cd34ef56.… expires: in 30d This is the only time the token is shown — anyone with the URL gets in. ``` The token is shown **once** and never stored in recoverable form. Copy it then, or revoke and mint a new one. Opening the URL exchanges the token for a browser session; the `?k=` disappears from the address bar and the visitor browses normally. Links can be scoped: ```console $ ribo gate link internal-dash --ttl 12h # short-lived $ ribo gate link internal-dash --ttl 0 # never expires $ ribo gate link internal-dash --path /reports # only paths under /reports $ ribo gate link internal-dash --read-only # GET/HEAD only ``` List and revoke: ```console $ ribo gate links internal-dash $ ribo gate link internal-dash --revoke ab12cd34ef56 ``` Revoking a link stops **new** sign-ins through it; sessions it already minted stay valid until they expire or you revoke them (below). --- ## Sessions and revocation Every admitted visitor gets a session cookie (`HttpOnly`, `Secure`; lifetime from `[gate.session] ttl`, default 30 days). Inspect and revoke them: ```console $ ribo gate status internal-dash # policy + active session/link counts $ ribo gate sessions internal-dash # who is signed in, from where, until when $ ribo gate sessions internal-dash --revoke 9f3a1b2c… # kick one viewer (sid from the list) $ ribo gate sessions internal-dash --revoke-all # everyone signs in again ``` `--revoke-all` is immediate and platform-enforced: the edge rejects any session issued before the revocation, so it works even if a cookie was copied somewhere you can't reach. Manage the allow list without redeploying: ```console $ ribo gate allow internal-dash sam@example.com $ ribo gate allow internal-dash sam@example.com --remove ``` --- ## Reading the visitor in your Cell A gate needs no code from you, but once it admits someone your Cell can find out who. Every request that passes the gate arrives with the verified identity in headers: | Header | Value | |---|---| | `x-tissue-gate-sub` | Stable subject id: `email:sam@example.com`, the signed-in Tissue user for `account` and `private`, `link:` for a capability link, or `oidc::` / `github:` for [federated sign-in](#federated-sign-in) | | `x-tissue-gate-email` | The verified address. Absent when there isn't one: a capability link identifies a holder, not a person | | `x-tissue-gate-source` | How they got in: `email`, `account`, `link:`, or `sso:` (the `[gate.source.]` that signed them in) | | `x-tissue-gate-groups` | JSON array of the visitor's group names from the identity provider, e.g. `["platform-ops","dev"]`. Present only when the provider supplied groups; capped at sign-in (32 groups, 128 characters each). Non-ASCII characters arrive `\u`-escaped, so the value is plain ASCII and `JSON.parse` recovers the original names | | `x-tissue-gate-jwt` | The session token, for passing the identity to a service of your own. Omitted for requests that authenticated with a link token directly | You can trust these without checking anything. The platform deletes **every** inbound `x-tissue-*` header from public traffic before it injects its own, so a visitor cannot forge one. The gate's session cookie is stripped from the request as well: your Cell reads the identity but can never replay the session. An ungated Cell gets none of these headers, so their absence means the request is public. ### Rust Header names arrive lowercased. Fields you leave out of the struct are ignored, so declare only what you read. ```rust use std::collections::HashMap; use serde::{Deserialize, Serialize}; use serde_json::{json, Value}; use wasm_bindgen::prelude::*; #[derive(Deserialize)] struct IncomingRequest { method: String, url: String, headers: HashMap, } #[derive(Serialize)] struct WasmResponse { status: u16, headers: HashMap, body: String, } /// The gate's verified viewer, or `None` on a Cell with no gate. struct Viewer { sub: String, email: Option, source: String, } fn viewer(headers: &HashMap) -> Option { Some(Viewer { sub: headers.get("x-tissue-gate-sub")?.clone(), email: headers.get("x-tissue-gate-email").cloned(), source: headers.get("x-tissue-gate-source").cloned().unwrap_or_default(), }) } fn json_resp(status: u16, body: Value) -> String { let resp = WasmResponse { status, headers: [("content-type".into(), "application/json".into())].into(), body: body.to_string(), }; serde_json::to_string(&resp).unwrap_or_default() } #[wasm_bindgen] pub fn fetch(req_json: String) -> String { let req: IncomingRequest = match serde_json::from_str(&req_json) { Ok(r) => r, Err(e) => return json_resp(400, json!({ "error": e.to_string() })), }; match viewer(&req.headers) { // Signed in with an email: audiences `emails`, `domain`, `account`, // `private` and `sso`. Some(v) if v.email.is_some() => json_resp(200, json!({ "hello": v.email, "subject": v.sub, "source": v.source, "path": req.url, "method": req.method, })), // A capability-link holder — authenticated, but no address to show. Some(v) => json_resp(200, json!({ "hello": "link holder", "subject": v.sub, "source": v.source, })), // No gate on this Cell, so this is an ordinary public request. None => json_resp(200, json!({ "hello": "anonymous" })), } } ``` Build and deploy it like any other [Rust Cell](https://docs.tissue.systems/docs/cells/writing/#rust-wasm-cells); the `[gate]` block goes in the same `ribo.toml`: ```toml [cell] name = "internal-dash" wasm = "./pkg/internal_dash_bg.wasm" build = "wasm-pack build --target web --out-dir pkg" bindgen_glue = "./pkg/internal_dash.js" [gate] audience = "domain" domains = ["yourco.com"] ``` ### JavaScript The same headers, off the standard `Request`: ```js export default { async fetch(request) { const email = request.headers.get("x-tissue-gate-email"); const source = request.headers.get("x-tissue-gate-source"); return Response.json({ hello: email ?? "link holder", source }); }, }; ``` --- ## Calling a gated Cell from a program A capability-link token works as a Bearer credential, so scripts and services reach a gated Cell without a browser session. Mint one with `ribo gate link`, keep it out of the source, and send it as `Authorization: Bearer tal_…`: ```rust let token = std::env::var("TISSUE_LINK_TOKEN")?; // tal_… let res = reqwest::Client::new() .get("https://internal-dash.strand-9c.tissue.dev/reports.json") .bearer_auth(token) .send() .await?; ``` The gate answers a program the way a program expects. With no credential, or one it cannot verify, the response is `401` with `WWW-Authenticate: Bearer` and a body of `{"error": "gate_auth_required", "login": "…"}`. That `login` value is a URL to hand a human; the program itself is never redirected into a sign-in page. A token that is real but used outside its scope (`--path`, `--read-only`) gets `403 {"error": "gate_forbidden"}`, so the two cases stay distinguishable. Browsers are the exception: a request that accepts `text/html` is redirected to the sign-in page instead. --- ## Managing gates via the REST API Everything above is also available under `/v1/cells/{address}/gate` for tokens with the `cells:read` / `cells:write` scopes. See the [REST API reference](https://docs.tissue.systems/docs/api/) (Gate section). The policy body is JSON in the same shape as ribo.toml: ```console $ curl -X PUT https://api.tissue.systems/v1/cells/$ADDR/gate \ -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \ -d '{"policy": {"audience": "emails", "allow": ["sam@example.com"]}}' ``` `DELETE /v1/cells/{address}/gate` removes the gate entirely. The Cell is public again and all its links and sessions are deleted. AI agents can do the same through the [MCP server](https://docs.tissue.systems/docs/mcp/tools/) (`gate_status`, `gate_set`, `gate_link_create`, …). --- ## What the gate does and doesn't cover - The gate protects the Cell's **public URL** (its `*.tissue.dev` address and any [custom domains](https://docs.tissue.systems/docs/cells/custom-domains/)). All paths are covered; there is no way to leave a path open. - [Pulse](https://docs.tissue.systems/docs/pulse/overview/) scheduled invocations are platform-internal and keep firing on a gated Cell. - Gate checks add almost no latency: sessions are verified at the edge with a public key, without a database lookup per request. - API clients authenticate with a capability-link token as a Bearer credential: see [calling a gated Cell from a program](#calling-a-gated-cell-from-a-program). --- # Cells: compute / Connect an identity provider Source: https://docs.tissue.systems/docs/cells/gate-sso/ # Connect an identity provider With `audience = "sso"`, a gated Cell hands sign-in to an identity provider: visitors authenticate there, and the gate turns the provider's assertion into an ordinary Cell session. This page is the provider-by-provider setup: what to configure in each console, the `ribo.toml` block, and where the client secret goes. The policy model itself (audiences, `domains`/`allow`, sessions, the headers your Cell reads) is on the [Access control (Gate)](https://docs.tissue.systems/docs/cells/gate/) page. A policy holds up to 8 `[gate.source.]` tables. The hosted sign-in page shows one button per source, labeled by its `label` key or, absent that, the source name. --- ## What any provider needs Tissue Cloud speaks standard OpenID Connect, so any compliant provider works, hosted or self-hosted. In provider terms, the requirements are: - **A discovery document** at `/.well-known/openid-configuration`. The `issuer` value inside it must equal the issuer you configure. The gate checks this, and it's the most common thing to get wrong. To catch it before you deploy, open `/.well-known/openid-configuration` in a browser and confirm its `"issuer"` field is character-for-character what you put in `ribo.toml`, trailing slash included. - **Authorization-code flow** with **PKCE (S256)**. No implicit flow, no device flow. - **An email claim.** The gate requests `openid email profile` by default; the ID token must carry a non-empty `email`, and `email_verified: false` from the provider is a denial. - **`client_secret_post` token authentication**: the client id and secret travel in the token-request body. Every provider below supports it. ### Register a server-side client, not a browser one Every console asks what kind of client you are registering, and several have a second field for browser origins beside the redirect URI. Answer both the same way everywhere: the gate is a **confidential, server-side client**. The visitor's browser only follows redirects; the code exchange runs on Tissue's servers, with the client secret, from an address the provider never sees. No JavaScript on your Cell's pages ever calls the provider, so there is no origin to authorize and no implicit or SPA flow to enable. | Provider | Client type | Fill in | Leave empty or off | |---|---|---|---| | Google | Web application | Authorized redirect URIs | **Authorized JavaScript origins** | | GitHub | OAuth App (not a GitHub App) | Authorization callback URL | Enable Device Flow | | Authentik | OAuth2/OpenID Provider, **Confidential** | Redirect URI, matching mode *Strict* | — | | Keycloak | OpenID Connect, **Client authentication on** | Valid redirect URIs | **Web origins**, Implicit flow, Direct access grants | | Pocket ID | OIDC client (**not** a public client) | Callback URL | — | | Microsoft Entra ID | Platform **Web** (never *Single-page application*) | Redirect URI | Implicit grant checkboxes, Allow public client flows | Leaving the browser fields empty costs nothing: a filled-in origin list does not break sign-in either, it's never consulted. Picking the browser *client type* does break it: a provider that thinks it is talking to a public client refuses the secret the gate sends. Two Tissue-side constants appear in every walkthrough. **The redirect URI.** Register this with the provider, once per hostname the Cell serves on: ``` https://..tissue.dev/.tissue/gate/oidc//callback ``` There is nothing to invent here. `..tissue.dev` is the Cell's own address: the host a visitor sees in the address bar when they open it, printed on the `url` line of `ribo deploy`, listed in the dashboard, and shown at the top of the gate's own sign-in page. `` is the `[gate.source.]` table name (a source named `keycloak` gives `.../oidc/keycloak/callback`), and the `/.tissue/gate/oidc/…` path is reserved on every Cell host, so you never route it. Register it once per hostname because the gate constructs the redirect URI from the host the visitor actually arrived on and sends the provider that exact string. A Cell reached through a [custom domain](https://docs.tissue.systems/docs/cells/custom-domains/) sends the visitor back through the same domain, so that hostname needs its own registration. Providers compare the value literally, down to the scheme and the trailing path. **The client secret.** It never goes in `ribo.toml`. Store it in the Cell's vault under `GATE_OIDC_`: the source name uppercased, with `-` replaced by `_` (so `[gate.source.my-idp]` reads its secret from `GATE_OIDC_MY_IDP`): ```bash ribo vault set my-cell GATE_OIDC_OKTA # prompts for the secret ``` Set it before `ribo deploy`; a deploy whose sources are missing their secrets fails with the exact command to run. --- ## Google Google sign-in uses an OAuth client from the Google Cloud console. There is no separate step that issues a client id: Google mints the id and the secret together when you create the client, on one screen. 1. In the [Google Cloud console](https://console.cloud.google.com/), pick or create a project, then open **APIs & Services → Credentials**. Consoles moved to the newer Google Auth Platform show the same screens under **Google Auth Platform → Clients**. Nothing needs enabling under **Library**; sign-in isn't one of the APIs you turn on. 2. First-time setup asks for an **OAuth consent screen** (**Branding** and **Audience** in the newer console): app name, user-support address, developer contact. Choose **Internal** if every visitor is in your own Google Workspace organization; otherwise **External**, and read the publishing note below. The gate runs its own membership check after Google's sign-in either way. 3. **Create credentials → OAuth client ID**, application type **Web application**. The client's name is console-side only. Visitors never see it. 4. Under **Authorized redirect URIs**, click **+ Add URI** and paste your Cell's callback from the top of this page, with `google` as the source name: ``` https://..tissue.dev/.tissue/gate/oidc/google/callback ``` 5. **Leave Authorized JavaScript origins empty.** That field authorizes pages that call Google from browser JavaScript; the gate never does (see [Register a server-side client](#register-a-server-side-client-not-a-browser-one)). The redirect URI is the only field that counts here, and it's the one to check first when a sign-in fails. 6. **Create**. Google shows **Your Client ID** and **Your Client secret** in a panel, with a **Download JSON** button. The client id ends in `.apps.googleusercontent.com` and stays readable on the client's page for good. That's the value for `ribo.toml`, and you can come back for it. The secret is the half to capture now: recent consoles show it only at creation. If you lose it, add a new secret on the client's page and re-run `ribo vault set`; the old one keeps working until you delete it. ```toml [gate] audience = "sso" domains = ["yourco.com"] [gate.source.google] type = "google" # preset — issuer https://accounts.google.com implied client_id = "1234-abc.apps.googleusercontent.com" ``` ```bash ribo vault set my-cell GATE_OIDC_GOOGLE ``` A `google` source with no `domains` and no `allow` is rejected at deploy time: it would admit anyone with a Google account. List the domains or addresses that belong in. **An External app in *Testing* admits only its test users.** A new External app starts there, and Google refuses everyone else at its own sign-in screen, before the gate is reached, so nothing in your policy changes the outcome. Listed testers get an "unverified app" interstitial. **Publish app** clears both, and clears them immediately: the gate asks for `openid email profile`, all non-sensitive scopes, so publishing does not queue the app for Google's verification review. Internal apps never enter Testing. --- ## GitHub GitHub sign-in uses an **OAuth App**, not a GitHub App. (A GitHub App is the installable kind with repository permissions; the gate needs only identity, which is the OAuth App's job.) 1. On GitHub, open **Settings → Developer settings → OAuth Apps → New OAuth App**. Registering it under the organization your visitors belong to (**Organization settings → Developer settings**) lets any owner rotate the secret later; under a personal account, only that account can. 2. **Application name** is what GitHub shows visitors on its authorization screen. **Homepage URL** is required by the form and unused by the gate; put your Cell's URL there. Leave **Enable Device Flow** unchecked. 3. Set **Authorization callback URL** to your Cell's callback, with `github` as the source name. An OAuth App holds exactly one, and GitHub matches its host exactly, so register the hostname visitors actually use: a Cell reached through a custom domain cannot also sign visitors in on its `tissue.dev` host from the same app. 4. **Register application**. The **Client ID** is on the app's page and stays there. **Generate a new client secret** for the other half. GitHub stores only a hash and shows the value once; if it scrolls away, generate another and re-run `ribo vault set`. ```toml [gate] audience = "sso" allow = ["ann@example.com", "bob@example.com"] [gate.source.github] type = "github" # preset — plain OAuth2 against github.com, NOT OIDC client_id = "9a1f0c2b7d4e6a8c0135" ``` ```bash ribo vault set my-cell GATE_OIDC_GITHUB ``` GitHub is plain OAuth2 rather than OIDC; the gate asks for `read:user user:email`, reads the account's **primary, verified email** through the GitHub API, and applies the `domains`/`allow` check to it. If an organization restricts third-party OAuth application access, an owner has to approve the app before its members can sign in. A visitor whose GitHub account has no verified email is asked to verify one on GitHub first. GitHub sources supply no groups. As with `google`, a policy with `domains` and `allow` both empty is rejected at deploy time. --- ## Authentik 1. In the Authentik admin interface, open **Applications → Providers → Create** and pick **OAuth2/OpenID Provider**: client type **Confidential**, with your Cell's callback as the **Redirect URI** and matching mode **Strict**. Versions that take a list accept one entry per hostname; regex mode buys nothing here. 2. Create an **Application** bound to that provider (**Applications → Create**). 3. The provider's protocol settings hold both credentials: **Client ID** is generated when you save, **Client Secret** sits under it, and Authentik keeps showing both. Unlike Google or GitHub, you can come back for the secret. 4. The provider's overview page shows the **issuer**, a URL like `https://auth.example.com/application/o/my-cell/`. The trailing slash is part of it; configure it exactly as shown. ```toml [gate] audience = "sso" [gate.source.authentik] type = "oidc" issuer = "https://auth.example.com/application/o/my-cell/" client_id = "..." label = "Acme sign-in" ``` ```bash ribo vault set my-cell GATE_OIDC_AUTHENTIK ``` Authentik's default `profile` scope already includes a `groups` claim, so group names reach your Cell with the default `scopes`. There's nothing extra to map. --- ## Keycloak 1. In the Keycloak admin console, pick your realm and open **Clients → Create client**: type **OpenID Connect**, with **Client authentication** turned on (that makes it a confidential client with a secret). The **Client ID** you type here is the `client_id` value; Keycloak doesn't generate one. On the capability screen leave **Standard flow** on and the rest off; **Direct access grants** and **Implicit flow** belong to other kinds of client. 2. Set **Valid redirect URIs** to your Cell's callback, `https://..tissue.dev/.tissue/gate/oidc/keycloak/callback`, the redirect URI from the top of this page with `keycloak` as the source name. Keycloak also accepts a path wildcard, `https://..tissue.dev/*`, if you would rather not pin the exact path; add one entry per hostname the Cell serves on. 3. Leave **Web origins** empty. It's Keycloak's version of Google's JavaScript origins: a CORS allow-list for browser clients, which the gate isn't. Filling it in is harmless, but don't put `*` in it. 4. The secret is on the client's **Credentials** tab, readable whenever you need it, with **Regenerate** beside it. 5. The issuer is `https:///realms/`; the realm's **OpenID Endpoint Configuration** link shows it. ```toml [gate] audience = "sso" [gate.source.keycloak] type = "oidc" issuer = "https://sso.example.com/realms/acme" client_id = "my-cell" ``` ```bash ribo vault set my-cell GATE_OIDC_KEYCLOAK ``` **Groups need a client-scope mapper.** Keycloak doesn't put group membership in tokens by default. On the client, open the **Client scopes** tab, pick the client's dedicated scope, and **Add mapper → By configuration → Group Membership**. Set the token claim name to `groups` and turn **Full group path** off, so names arrive as `ops` rather than `/ops`. --- ## Pocket ID Pocket ID is a small self-hosted OIDC provider built around passkeys. Visitors sign in with a passkey rather than a password, and the gate consumes the result like any other issuer. 1. In the Pocket ID admin, add an **OIDC client** and set its **callback URL** to your Cell's callback. Don't mark it a **public client**: a public client has no secret, and the gate authenticates with one. 2. Copy the **client id** and **client secret** from the panel Pocket ID shows on save. Regenerate the secret from the client's page if it gets away from you, then re-run `ribo vault set`. 3. The issuer is your Pocket ID base URL: the bare origin, with no realm or application path appended (unlike Authentik and Keycloak, whose issuers carry a path). ```toml [gate] audience = "sso" [gate.source.pocketid] type = "oidc" issuer = "https://id.example.com" client_id = "..." ``` ```bash ribo vault set my-cell GATE_OIDC_POCKETID ``` To pass user groups through to your Cell, add `groups` to the requested scopes: `scopes = "openid email profile groups"`. --- ## Microsoft Entra ID Entra ID's free tier covers OIDC sign-in; no premium license is needed for this. 1. In the [Microsoft Entra admin center](https://entra.microsoft.com/), open **App registrations → New registration**. Pick the single-tenant account type, then add a redirect URI under the **Web** platform, not **Single-page application**, which registers the same string as a public browser client and makes Entra reject the gate's secret at the token request. 2. The **Application (client) ID** on the overview page is your `client_id`; the **Directory (tenant) ID** beside it goes into the issuer. Both stay readable there; neither is shown only once. 3. Under **Certificates & secrets**, create a **New client secret** and copy its **Value** column, shown once and never again. The **Secret ID** beside it is a handle for the credential, not the credential; a sign-in that fails with an invalid-client error usually means the id went into the vault. 4. Under **Authentication**, leave the implicit-grant checkboxes (**Access tokens**, **ID tokens**) unticked and **Allow public client flows** set to No. **Use the tenant-specific issuer.** The `common` endpoint's discovery document advertises a templated issuer that can never match a configured one, so the gate rejects it. Configure the tenant-id form: ```toml [gate] audience = "sso" [gate.source.entra] type = "oidc" issuer = "https://login.microsoftonline.com//v2.0" client_id = "..." label = "Acme" ``` ```bash ribo vault set my-cell GATE_OIDC_ENTRA ``` Two Entra-specific claim notes: - **Email.** Some tenants omit the `email` claim from ID tokens. If sign-ins are denied with no address shown, add `email` as an optional claim (**Token configuration → Add optional claim → ID → email**) and confirm the user has an email set on their profile. Entra's v2 tokens omit `email_verified` entirely; the gate accepts an absent claim and refuses only a value that explicitly says the address is unverified. - **Groups arrive as GUIDs.** Add the claim under **Token configuration → Add groups claim**; unless your tenant is directory-synced and configured to emit names, the values are group object IDs, and that is what your Cell receives in `x-tissue-gate-groups`. --- ## Troubleshooting | Symptom | Cause and fix | |---|---| | The provider shows a **redirect URI mismatch** error | The registered URI differs from `https:///.tissue/gate/oidc//callback` for the hostname the visitor used. Register the exact URI (scheme, host, and path) once per hostname, custom domains included. | | Google refuses before the gate is reached: **Access blocked**, or a screen about the app not being verified | The OAuth client's consent screen is *External* and still in **Testing**. Add the address under **Test users**, or **Publish app**. The gate's scopes are non-sensitive, so publishing needs no Google review. | | Entra returns **AADSTS9002326**, cross-origin token redemption | The redirect URI is registered under the **Single-page application** platform. Remove it there and add it under **Web**. | | Sign-in succeeds at the provider, then the gate denies with an **unverified email** | OIDC: the provider sent `email_verified: false`. GitHub: the account has no verified email. Verify one on GitHub and retry. | | A configuration-error page names a **`ribo vault set` command** | The client secret is missing from the Cell's vault, or was deployed as a placeholder. Run the command it names; the fix takes effect on the next sign-in, no redeploy needed. | | Deploy or sign-in fails with an **issuer mismatch** | The issuer in the provider's discovery document must equal the configured one. Entra: use the tenant-specific issuer, never `common`. Authentik: keep the trailing slash exactly as the provider prints it. | | **`x-tissue-gate-groups` is absent or empty** | The provider sent no usable groups claim. Request the right scope (`scopes = "openid email profile groups"` where the provider expects it), add the mapper (Keycloak) or token claim (Entra), and check that `groups_claim` names the claim the provider actually emits. The claim must be a JSON array of strings. | Whichever provider you connect, the secret's custody is the same: the client secret is stored encrypted in the Cell's vault, is read only when a visitor signs in, and never appears in `ribo.toml`, a deploy, or the dashboard. --- # Cells: compute / Analytics & access log Source: https://docs.tissue.systems/docs/cells/analytics/ # Analytics & access log Every Cell records its own traffic, with no script tag, no code change and nothing to configure. The dashboard's **Overview** tab shows who is visiting (humans and bots, countries, browsers, top paths) and how the Cell is behaving (error rate, response time, scheduled and sensor activity). The **Access log** tab lists individual requests. Analytics describe traffic; they are not billing. Tissue Cloud bills CPU time and stored bytes only; requests are free and unmetered. --- ## What is measured For each request the platform records the UTC hour, whether the caller looked like a human browser or a bot, the response status, and the response time. Human traffic is additionally broken down by country, browser family, request path, and referrer site; bot traffic is broken down by crawler name. Platform-originated invocations (Pulse fires and Synapse sensor dispatches) are counted as **events**, separately from visitor traffic. A Cell on a `* * * * *` schedule shows 1,440 pulse events a day, not 1,440 visitors. All aggregation happens on Tissue's own infrastructure. There is no third-party analytics service, no tracking pixel, and nothing is loaded into your visitors' browsers. --- ## Visitors, without cookies Unique-visitor counts use no cookie and no stored identifier. Each request is keyed by a hash of the visitor's IP address, user agent, the Cell's address, and a **salt that rotates at UTC midnight**: ``` visitor = sha256(daily_salt ‖ ip ‖ user_agent ‖ cell_address) ``` The raw IP and user agent never enter the analytics store. Only the hash does, and once the salt rotates, yesterday's hashes cannot be linked to today's. The same person is a "new visitor" every day, so visitor counts are approximate by design; the dashboard marks them as such. --- ## Bot classification Classification is user-agent based. Well-known crawlers (search engines, AI crawlers, uptime monitors, link-preview fetchers) are matched by name; anything else that self-identifies as automated is grouped under **Unknown agents**. The dashboard tags named crawlers as *Search*, *AI crawler*, or *Monitor*. When you're deciding what your `robots.txt` should say, you can see how much of your traffic is AI crawlers and which ones. Two caveats: a bot that fakes a normal browser user agent is counted as a browser, and a privacy proxy can shift a visitor's country. Treat the split as a good estimate, not an audit. --- ## Countries The visitor's IP is resolved to a two-letter country code at ingest, and only the code is stored in analytics. Geolocation runs locally against the [DB-IP](https://db-ip.com) Lite database (**IP geolocation by DB-IP**), with no lookup ever leaving the platform. --- ## Retention | Data | Kept for | |---|---| | Access log (individual requests, incl. IP) | 30 days | | Hourly analytics (traffic, countries, browsers, paths, bots) | 90 days | | Daily visitor counts | 400 days | Deleting a Cell deletes its analytics. --- ## Analytics API **Base URL**: `https://api.tissue.systems` · **Auth**: `Authorization: Bearer ` (CLI JWT or `tok_` API token) · **Scope**: `cells:read` ### GET /v1/cells/{address}/analytics Returns the rollups behind the Overview tab. `hours` may be `24`, `168` (7 days), or `720` (30 days); other values snap to the nearest window. Default is `168`. ```bash curl "https://api.tissue.systems/v1/cells/dd0d1cd5x7k2q/analytics?hours=24" \ -H "Authorization: Bearer $TISSUE_TOKEN" ``` ```json { "series": [{ "t": "2026-08-09T14", "requests": 412, "human": 371, "bots": 41, "s4xx": 3, "s5xx": 0, "avgMs": 12 }], "totals": { "requests": 5210, "human": 4903, "bots": 307, "s2xx": 5100, "s3xx": 80, "s4xx": 27, "s5xx": 3, "avgMs": 14 }, "visitors": { "human": 892, "bots": 55, "approx": true }, "countries": [["US", 2101], ["DE", 512]], "browsers": [["Chrome", 2900], ["Safari", 1203]], "botAgents": [["Googlebot", 120], ["~unknown", 88]], "paths": [["/", 3100], ["/api/notes", 900]], "referrers": [["news.ycombinator.com", 340]], "events": { "http": 5210, "pulse": 288, "sensor": 0 } } ``` `series` is gap-filled (quiet hours appear as zeros). Breakdown lists are `[name, count]` pairs for **human** traffic only; bots are broken down in `botAgents`, where `~unknown` collects unnamed agents and `~other` folds the tail past the top entries. ### GET /v1/cells/{address}/access-log Returns individual requests, newest first: `{ "entries": [...], "total": n }`. | Parameter | Meaning | |---|---| | `limit`, `offset` | Paging (default `limit=25`) | | `status` | Exact code (`404`) or class (`4xx`) | | `method` | HTTP method | | `event` | `http`, `pulse`, or `sensor` | | `bot` | `true` (bots only) or `false` (humans only) | | `path` | Substring match on the URL path | ```bash curl "https://api.tissue.systems/v1/cells/dd0d1cd5x7k2q/access-log?status=5xx&bot=false" \ -H "Authorization: Bearer $TISSUE_TOKEN" ``` Entries carry the request line, status, duration, IP, referrer, and, when resolved, `country`, `browser`, `bot`, `event`, and the daily `visitor` hash. --- # Cells: compute / Full export (Explant) Source: https://docs.tissue.systems/docs/cells/explant/ # Exporting a Cell in full (explant) An explant is a complete, verifiable copy of one Cell: the deployed source, the configuration, a consistent snapshot of every database it is bound to, and every object in every bucket it is bound to. One command requests it, waits for the build, downloads it, and verifies every file on the way in: ```bash $ ribo explant export orders-api ✓ Queued export exp_9f2c41d8a03b of cell orders-api 4218/4218 files, 1.2 GB of 1.2 GB ✓ Wrote 1.2 GB to orders-api-2026-08-22T14-03Z Verify: cd orders-api-2026-08-22T14-03Z && sha256sum -c manifest-sha256.txt Read: orders-api-2026-08-22T14-03Z/annex/NOTES.md ``` The result is a directory of ordinary files in ordinary formats: JavaScript source, SQLite databases, your objects under their original keys, JSON metadata. Nothing in it needs ribo, or Tissue, to read, and nothing in the source needs Tissue to run: see [Running it elsewhere](#running-it-elsewhere). [The account export](https://docs.tissue.systems/docs/account/export/) is the complement, not the same feature: it lists everything the account owns, without content. An explant is the content of one Cell. --- ## What is in the bag ``` orders-api-2026-08-22T14-03Z/ explant.json the manifest: inventory, hashes, per-plane timestamps bagit.txt BagIt 1.0 marker (RFC 8493) — archive tools know the shape bag-info.txt manifest-sha256.txt one SHA-256 line per payload file fetch.txt only when payload was left out: what, where, how big data/ source/cell.js the deployed artifact, verbatim (Wasm Cells: .wasm + glue) config/ribo.toml reconstructed from the registry: bindings, build, pulse config/bindings.json the binding list; vault entries as names, never values c3/orders.db a consistent SQLite snapshot, taken online c3/orders.schema.sql the schema as text — readable, greppable, diffable g7/invoices/ objects verbatim, original key paths preserved g7/invoices/_objects.json per-object size, etag, content type, last-modified annex/ domains.json custom domains the Cell answered on (informational) pulse.json resolved schedules NOTES.md what this explant does not contain, in plain English ``` **The shape is BagIt, not ours.** BagIt (RFC 8493) is the format libraries and digital archives use to hand each other data: payload under `data/`, a checksum manifest beside it, `bagit.txt` and `bag-info.txt` as plain-text tags at the root. That is why the word here is *bag*. Any tool that validates bags validates this one without knowing what Tissue is, including `fetch.txt`, the format's own way of naming payload the bag does not carry. **Every payload file is hashed, and the manifest is hashed over the hashes.** `sha256sum -c manifest-sha256.txt` from the bag root proves the copy complete. An explant is verified, not assumed. ribo checks each hash as the file lands, and anyone you hand the bag to can re-check with stock tools. **Consistency is per plane, and the manifest says so.** Each database snapshot is transactionally consistent; the object listing is consistent with itself; the source is the deployed bytes. `explant.json` records an `asOf` timestamp per plane rather than pretending to one atomic cut across all three. No export product delivers that, and the honest ones say so. **Only the current deploy exists.** The platform keeps the bytes of a Cell's current version and nothing older, and the bag captures exactly that. --- ## Running it elsewhere A Cell is a fetch handler over standard `Request` and `Response`, and `data/source/cell.js` imports nothing from Tissue. Everything the platform provides arrives as a property of `env`. Supplying `env` yourself is the whole of the port. | In the bag | What supplies it elsewhere | |---|---| | `data/source/cell.js` | Bun and Deno serve a fetch handler natively; Node needs an adapter that turns a `node:http` request into a `Request` | | `env.DB`: `exec`, `prepare`, `bind`, `run`, `all`, `first`, `raw`, `batch` | any SQLite driver (`node:sqlite`, `better-sqlite3`, `bun:sqlite`) over `data/c3/.db` | | `env.BUCKET`: `get`, `head`, `put`, `delete`, `list` | any S3 client, once `data/g7//` is synced into a bucket of your own | Under Node that is about forty lines: ```js import { createServer } from "node:http"; import { DatabaseSync } from "node:sqlite"; import cell from "./data/source/cell.js"; const env = { DB: c3shim(new DatabaseSync("./data/c3/orders.db")) }; createServer(async (req, res) => { const out = await cell.fetch(toWebRequest(req), env, {}); res.writeHead(out.status, Object.fromEntries(out.headers)); res.end(Buffer.from(await out.arrayBuffer())); }).listen(8080); ``` `c3shim` maps `prepare().bind().all()` onto the SQLite handle; `toWebRequest` builds a `Request` from the Node request. On Bun or Deno both disappear: `Bun.serve({ fetch: (req) => cell.fetch(req, env, {}) })`. **The data ports even if the code does not come with you.** Each `data/c3/.db` is a SQLite file that the `sqlite3` CLI, Python's `sqlite3` module, Datasette and DB Browser open with no conversion, and `.schema.sql` is the same schema as text. Objects keep their original key paths, so they land in any S3-compatible store under the names your code already uses. Vector columns are the exception. They're [part of libSQL](https://docs.tissue.systems/docs/c3/vector-search/), the SQLite fork c3 runs on, and stock SQLite reads each vector as a plain blob and has none of the `vector_*` functions. A table with a vector index stays readable there, but an insert fails with `unknown function: libsql_vector_idx()`. To keep searching, open the file with a libSQL driver (`@libsql/client` for Node, `libsql` for Python or Rust). To write to it with stock SQLite, `DROP INDEX` the vector index first. **What does not travel is outside your function.** Gate is a perimeter: the Cell only reads `x-tissue-gate-*` headers, so the code is unchanged, but something in front of it has to do the sign-in. Pulse schedules are in `annex/pulse.json`, and anything that can call a URL on a timer replaces them. Vault values are not in the bag at all, only their names. --- ## The commands | Command | What it does | |---|---| | `ribo explant export []` | Request an export, wait for the build, download and verify it | | `ribo explant export --no-wait` | Request only; collect later | | `ribo explant download ` | Collect an export requested earlier | | `ribo explant list` | This Cell's exports: id, state, size, expiry | | `ribo explant rm ` | Delete a staged export before it expires | As with every ribo command, the Cell defaults to the `ribo.toml` in the current directory; name it explicitly from anywhere else. `-o ` chooses the destination. The default carries the cell name and the snapshot time, so two exports never land on top of each other. Downloads resume. Members are fetched in parallel and verified as they land; re-running a killed download skips everything already on disk and intact, so an interruption costs the one file it was in the middle of. Past 1 GB, ribo prints the size before fetching; past 10 GB it stops until you pass `--yes`. --- ## The HTTP API | Route | | |---|---| | `POST /v1/cells/{name}/explant` | Request an export → `202` with a `jobId` (`exp_…`) | | `GET /v1/cells/{name}/explant` | List this Cell's exports | | `GET /v1/cells/{name}/explant/{id}` | Job state; once ready, the full member inventory | | `GET /v1/cells/{name}/explant/{id}/download` | The whole bag as a single `.tar.zst` | | `GET /v1/cells/{name}/explant/{id}/member/{path}` | One member; the route ribo fetches through | | `DELETE /v1/cells/{name}/explant/{id}` | Delete the staged bag now | ```bash curl -X POST -H "Authorization: Bearer $TISSUE_TOKEN" \ https://api.tissue.systems/v1/cells/orders-api/explant # {"jobId":"exp_9f2c41d8a03b","state":"queued",...} curl -C - -o orders-api.tar.zst -H "Authorization: Bearer $TISSUE_TOKEN" \ https://api.tissue.systems/v1/cells/orders-api/explant/exp_9f2c41d8a03b/download ``` The single-file download states an exact `Content-Length` and honours `Range`, so `curl -C -` resumes a multi-gigabyte archive where it stopped and progress bars read true. Members are zstd-compressed once, at build time; `zstd -d < orders-api.tar.zst | tar -x` unpacks the archive anywhere, and `bsdtar -xf` reads it directly. --- ## Rules the endpoint enforces **Exporting takes its own permission.** The `explant:export` scope is never implied by `cells:read`. A signed-in session holds it like every other scope, but an API token must be minted with it explicitly. A token that can read your Cells cannot, by default, walk away with their data. **Ten exports per account per rolling 24 hours.** The eleventh answers `429`. An export is expensive to build and cheap to ask for. **Bags expire after 7 days.** The staged copy is deleted and the job's state becomes `expired`; request a fresh one. `ribo explant rm` deletes sooner. **An export outlives its Cell.** Ownership is checked against the export, not the Cell, so deleting a Cell does not delete a bag already built from it, and that's when somebody most needs to download one. **A locked account can still leave.** An account suspended for abuse cannot request a new export, but can download one already built. Withholding a customer's own data is not a sanction this platform uses. **Every step lands on the audit feed.** `explant.export.requested`, `explant.export.completed`, `explant.download` and `explant.export.deleted` appear under [Activity](https://docs.tissue.systems/docs/account/activity/), so a request you did not make is visible within minutes. --- ## What an explant does not contain - **Secret values.** Vault bindings appear by name only. Set them again wherever the copy lands; nothing in the bag can recover them. - **DNS.** `annex/domains.json` records the custom domains the Cell answered on; the records themselves live at your registrar. - **Account-level data.** Members, billing, API tokens and audit history belong to the account, and the [account export](https://docs.tissue.systems/docs/account/export/) covers them. - **Previous deploys.** Only the current version's bytes exist anywhere. - **The far end of a very large bucket.** Past 50,000 objects in one bucket, the remainder are listed in `fetch.txt` with their sizes and where to get them, `explant.json` marks the bag incomplete, and `NOTES.md` says so plainly. A thin bag still verifies. There is no import command yet, and the bag is designed so you do not need one: SQLite opens the databases, any S3 client puts the objects back, and the source is the same file you deployed, which is the same file another runtime serves ([Running it elsewhere](#running-it-elsewhere)). --- # Cells: compute / Custom domains Source: https://docs.tissue.systems/docs/cells/custom-domains/ # Custom domains Every Cell is reachable at a `*.tissue.dev` address the moment it is deployed. You can also serve it from your own domain (`api.yourdomain.com`, `app.example.com`, or a bare apex like `example.com`) by registering the domain on your Cell, proving you own it, and pointing DNS at the Cell. The whole flow is **self-serve**: no support ticket, no waiting on an operator. --- ## How it works Connecting a custom domain takes three steps: 1. **Register** the domain on your Cell. Tissue Cloud returns a one-time **TXT ownership challenge** and a **CNAME target**. 2. **Prove ownership** by publishing the TXT record at your DNS provider, then asking Tissue to verify it. 3. **Point the domain** at your Cell with a `CNAME` (subdomain) or `ALIAS`/`ANAME` (apex), then verify once more. Once DNS resolves to your Cell, TLS is provisioned **automatically** (Let's Encrypt, via on-demand TLS) on the first HTTPS request. There is nothing to configure and no certificate to upload. The Cell receives the request with your custom hostname intact in `request.url`; the platform does not rewrite the URL. --- ## Status lifecycle A registered domain moves through these states: | Status | Meaning | |---|---| | `pending` | Registered, but the TXT ownership challenge has not been seen yet. | | `verified` | Ownership proven. DNS is not yet pointing at the Cell. | | `active` | Live and serving over HTTPS. TLS has been provisioned. | | `failed` | Ownership could no longer be confirmed (e.g. the TXT record was removed). | Run `ribo domain verify ` (or click **Verify** in the dashboard) to re-check and advance the status. Tissue also re-checks registered domains on its own every few minutes, so a domain whose DNS has landed reaches `active` without you doing anything; verifying by hand only skips the wait. --- ## Step 1: Register the domain Registering the domain reserves it on your Cell and returns the records you'll need. A domain is **globally unique**: it can be attached to only one account at a time. ### CLI ```bash ribo domain add app.example.com ``` The Cell is taken from `[cell] name` in your `ribo.toml`, or pass `--cell ` to target a different Cell. The command prints the TXT ownership challenge and the CNAME target: ``` ✓ Registered app.example.com for cell my-api status: pending 1. Ownership (TXT) name _tissue-challenge.app.example.com value 3f8c1a...e2d9 (64-hex token) 2. Routing (CNAME — or ALIAS/ANAME for an apex) target my-api.strand-9c.tissue.dev ``` ### Dashboard Open your Cell, go to **Custom Domains**, and click **Add domain**. The same TXT challenge and CNAME target are shown on the domain's row. ### MCP / API Via the MCP server, call the `domain_add` tool. Over the REST API: ```bash curl -X POST https://api.tissue.systems/v1/domains \ -H "Authorization: Bearer $RIBO_TOKEN" \ -H "Content-Type: application/json" \ -d '{"cell": "my-api", "domain": "app.example.com"}' ``` --- ## Step 2: Prove ownership Ownership verification is required for security: without it, anyone could point an already-registered domain at Tissue and hijack traffic to it. At your DNS provider, add a `TXT` record: | Field | Value | |---|---| | Type | `TXT` | | Name / Host | `_tissue-challenge.app.example.com` | | Value | The 64-hex token shown at registration | There is **one TXT token per registration**, and it stays stable for the life of the registration, so you don't need to update it on redeploys. Then verify: ```bash ribo domain verify app.example.com ``` or click **Verify** in the dashboard. Once Tissue sees the record, the status moves from `pending` to `verified`. DNS changes can take a few minutes to propagate. If verification doesn't succeed immediately, wait and re-run it. --- ## Step 3: Point the domain at your Cell With ownership proven, point the hostname at your Cell's `tissue.dev` address. Find that address with `ribo list` (or from the output of your last `ribo deploy`); it's the CNAME target shown at registration, e.g. `my-api.strand-9c.tissue.dev`. ### Subdomains (`app.example.com`) Add a `CNAME` record: | Field | Value | |---|---| | Type | `CNAME` | | Name / Host | The subdomain, e.g. `app` | | Value / Target | `my-api.strand-9c.tissue.dev` | | TTL | `300` (5 minutes) or your provider's default | ### Apex / root domains (`example.com`) Standard DNS does not permit a `CNAME` at the apex of a domain. Most providers offer an `ALIAS` or `ANAME` record (or, on Cloudflare, CNAME flattening) that points the apex at a hostname instead. Use that, with the same `my-api.strand-9c.tissue.dev` target. **If your provider has no `ALIAS` or `ANAME`** (GoDaddy, Hover and Gandi are the common ones), point the apex at Tissue's serving edges with plain `A` records instead. This is a supported path, not a workaround: an apex naming any of these addresses is recognised as pointing at your Cell. | Type | Name / Host | Value | |---|---|---| | `A` | `@` | `172.96.161.58` | | `A` | `@` | `69.42.222.9` | Add both. A single address is enough for the domain to verify and go live, but an apex pinned to one edge stops answering when that edge does, and the second address leaves it served by the other. An `A` record holds a literal address, so unlike a `CNAME` it cannot follow the routing that picks an edge per request: apex traffic spreads across the addresses you list rather than preferring the nearest one. A `www` `CNAME` is unaffected. These addresses change rarely; if you use them, re-check this page when you next revisit your DNS. Then verify one last time: ```bash ribo domain verify example.com ``` Once DNS resolves to your Cell, the status moves to `active` and TLS is provisioned automatically on the first HTTPS request. `https://example.com` is then live. --- > **Cloudflare users: use a grey cloud.** The record pointing at Tissue must be set to **"DNS only"** (grey cloud icon), **not** proxied (orange cloud). A proxied record terminates TLS at Cloudflare and breaks the HTTP-01 certificate challenge, so your domain will never obtain a certificate. This applies to both the `CNAME` (subdomain) and the CNAME-flattened apex record. --- ## DNS provider setup Step-by-step for the most common providers. In every case you add **two records**: the `_tissue-challenge…` **TXT** (Step 2, ownership) and the **CNAME** (Step 3, routing). Throughout, `` is the value shown at registration and `my-api.strand-9c.tissue.dev` is your Cell's hostname (yours will differ; use the one from `ribo list`). Most providers auto-append your domain to the **Name/Host** field, so you enter only the prefix (`_tissue-challenge.app`, `app`); if yours wants the full name, type `_tissue-challenge.app.example.com`. ### Cloudflare **DNS → Records → Add record.** - **TXT**: Name `_tissue-challenge.app`, Content ``. - **CNAME**: Name `app`, Target `my-api.strand-9c.tissue.dev`, **Proxy status: DNS only (grey cloud)**. - **Apex**: Name `@`; Cloudflare flattens the CNAME automatically. Still **grey cloud**. > The grey cloud is mandatory: a proxied (orange) record breaks certificate issuance. ### GoDaddy **My Products → DNS → Add.** - **TXT**: Host `_tissue-challenge.app`, Value ``, TTL 600s (Custom). - **CNAME**: Host `app`, Points to `my-api.strand-9c.tissue.dev`. (GoDaddy may require a trailing dot: `my-api.strand-9c.tissue.dev.`) - **Apex**: GoDaddy has **no** `ALIAS`/`ANAME` at the root. Add an `A` record on Host `@` for each address in [Apex / root domains](#apex-root-domains-example-com) above. - **Turn Domain Forwarding off first.** GoDaddy's forwarding occupies the apex and takes precedence over `A` records you add by hand. It also forwards only the root: with forwarding on, `example.com/` redirects but `example.com/faq` returns a 404. ### Namecheap **Domain List → Manage → Advanced DNS → Add New Record.** - **TXT Record**: Host `_tissue-challenge.app`, Value ``. - **CNAME Record**: Host `app`, Value `my-api.strand-9c.tissue.dev`. - **Apex**: use an **ALIAS Record**, Host `@`, Target `my-api.strand-9c.tissue.dev`. ### Google Domains / Squarespace Domains **DNS → Manage custom records → Create new record** (Squarespace: **Domains → DNS → Add record**). - **TXT**: Host `_tissue-challenge.app`, Data ``. - **CNAME**: Host `app`, Data `my-api.strand-9c.tissue.dev`. - **Apex**: set Host `@`; CNAME at the root is synthesized/flattened. ### AWS Route 53 **Hosted zones → your zone → Create record.** - **TXT**: Record name `_tissue-challenge.app`, value `""` (**quotes required** in Route 53). - **CNAME**: Record name `app`, value `my-api.strand-9c.tissue.dev`. - **Apex**: Record type **A**, toggle **Alias** on, route to *"another value"* → `my-api.strand-9c.tissue.dev`. ### Porkbun **Domain Management → your domain → DNS.** - **TXT**: Subdomain `_tissue-challenge.app`, Answer ``. - **CNAME**: Subdomain `app`, Answer `my-api.strand-9c.tissue.dev`. - **Apex**: add an **ALIAS** record, Subdomain blank (`@`), Answer `my-api.strand-9c.tissue.dev`. ### DNSimple **Domains → your domain → DNS → Add Record.** - **TXT**: Name `_tissue-challenge.app`, Content ``. - **CNAME**: Name `app`, Target `my-api.strand-9c.tissue.dev.` (trailing dot recommended). - **Apex**: use an **ALIAS** record, Name blank, Target `my-api.strand-9c.tissue.dev.`. ### Hover **Your domain → DNS → Add A Record** (the form adds any record type). - **TXT**: Hostname `_tissue-challenge.app`, Value ``. - **CNAME**: Hostname `app`, Target `my-api.strand-9c.tissue.dev`. - **Apex**: Hover has **no** `ALIAS`/`ANAME`. Use a subdomain (e.g. `www`). ### Gandi **Domain → DNS Records → Add.** - **TXT**: Name `_tissue-challenge.app`, Value ``. - **CNAME**: Name `app`, Hostname `my-api.strand-9c.tissue.dev.` (trailing dot). - **Apex**: Gandi LiveDNS has no native `ALIAS`. Use a subdomain, or Gandi's web-redirect from the apex to `www`. ### DigitalOcean **Networking → Domains → your domain.** - **TXT**: Hostname `_tissue-challenge.app`, Value ``. - **CNAME**: Hostname `app`, "Is an alias of" `my-api.strand-9c.tissue.dev.`. - **Apex**: DigitalOcean DNS has no `ALIAS`/`ANAME`. Use a subdomain. **Another provider?** Any provider with `CNAME` support works for subdomains. For an apex/root domain you need `ALIAS`/`ANAME` support or CNAME flattening; if your provider has neither, point a subdomain (e.g. `www`) at your Cell and redirect the apex to it. Look for a "DNS", "DNS Zone Editor", or "Advanced DNS" section in your control panel. --- ## Managing domains List the domains registered on your Cell and their current status: ```bash ribo domain list # app.example.com active dd0d1cd5k2mx7 # example.com verified dd0d1cd5k2mx7 ``` (The `CELL` column shows the cell's 13-character *address*, not its name.) Remove a domain (it stops serving immediately, and the name is freed for reuse): ```bash ribo domain rm app.example.com ``` See the [ribo CLI reference](https://docs.tissue.systems/docs/ribo/reference/#ribo-domain) for the full command set. --- ## The Cell sees your custom hostname Once a domain is `active`, your Cell sees requests arriving at the custom hostname: ```js export default { async fetch(request, env) { const url = new URL(request.url); // url.hostname → "app.example.com" // url.pathname → whatever path the client requested return Response.json({ host: url.hostname, path: url.pathname }); }, }; ``` A single Cell can serve any number of custom domains; repeat the three steps for each one. No configuration in `ribo.toml` is required. --- ## Troubleshooting **Verification never advances past `pending`.** Tissue can't see the TXT record yet. Confirm the record name is exactly `_tissue-challenge.` and the value matches the token from registration, then allow a few minutes for DNS propagation and re-run `ribo domain verify`. Check the record directly with `dig _tissue-challenge.app.example.com TXT`. **Verification reaches `verified` but never `active`.** The domain's ownership is proven but DNS isn't yet pointing at your Cell. Confirm the `CNAME` (or apex `ALIAS`/`ANAME`) target matches your Cell's `tissue.dev` hostname exactly, then verify again. Compare hostnames, not addresses: a `tissue.dev` name answers with the address of the Tissue edge nearest whoever asked, so `dig` run from two places can return two different IPs for one Cell and both are right. **Browser shows a certificate error for the custom hostname.** The certificate is provisioned on the first HTTPS request after DNS resolves, so give it a moment. If it persists, the most common cause is a **proxied (orange-cloud) Cloudflare record** intercepting the HTTP-01 challenge. Switch the record to **DNS only**. **Your domain uses a CAA record.** If your domain has a [CAA record](https://datatracker.ietf.org/doc/html/rfc8659) restricting certificate authorities, add an entry allowing `letsencrypt.org`; Tissue issues custom-domain certificates via Let's Encrypt. Without it, issuance fails even after the domain is `verified`. **Status flipped to `failed`.** Ownership could no longer be confirmed, usually because the TXT challenge record was removed. Re-add it and run `ribo domain verify` to recover. **You can't add a CNAME because the name already has other records.** A name with a `CNAME` cannot carry any other record type (`MX`, `TXT`, `A`, etc.); this is a DNS-wide rule. Use a different subdomain, or move the conflicting records. --- ## A note on certificate transparency When Tissue issues a certificate for your domain, the hostname is recorded in public [Certificate Transparency](https://certificate.transparency.dev/) logs. This is standard for every TLS certificate from every provider, not specific to Tissue, but it does mean the domain name becomes publicly discoverable once a certificate is issued. --- ## See also - [Cells overview](https://docs.tissue.systems/docs/cells/overview/): Cell addresses and default URLs - [Writing Cells](https://docs.tissue.systems/docs/cells/writing/): reading `request.url` and routing - [ribo CLI reference](https://docs.tissue.systems/docs/ribo/reference/#ribo-domain): `ribo domain` commands - [ribo.toml reference](https://docs.tissue.systems/docs/cells/configuration/): deploying Cells --- # Cells: compute / Limitations Source: https://docs.tissue.systems/docs/cells/limitations/ # Cell limitations These are the current boundaries of what Cells can do. Most reflect deliberate design choices; some are areas of active development. --- ## Storage and state **No persistent local filesystem.** Cells are stateless. There is no writable disk; only the bindings declared in `ribo.toml` provide persistent storage. Use c3 for structured data and g7 for files and binary objects. **No shared memory.** Cells are isolated from each other. Two Cells cannot share a variable, a cache, or any in-memory state. Communication must go through c3 or g7. --- ## Networking **`fetch()` only.** Cells can make outbound HTTP/HTTPS requests using the standard `fetch()` API. There is no access to raw TCP/UDP sockets, DNS resolution, or other network primitives. **Outbound requests go through an egress gateway.** Every request your Cell's `fetch()` makes is routed through a gateway that runs *outside* your Cell, and a request to an internal address is refused before it reaches a socket. Refused requests come back as **HTTP 403** with a JSON body: ```json { "error": "egress_blocked", "message": "fetch to internal address blocked: http://10.0.0.5/" } ``` What is refused: | | Examples | |---|---| | Loopback and private ranges | `127.0.0.0/8`, `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`, `169.254.0.0/16` (incl. cloud metadata `169.254.169.254`), `100.64.0.0/10` | | IPv6 equivalents | `::1`, `fc00::/7` (ULA), `fe80::/10` (link-local), IPv4-mapped forms of the above | | Internal hostnames | `localhost`, `metadata.google.internal`, `metadata`, `instance-data` | | Platform infrastructure | The tissue servers' own addresses | | Non-HTTP schemes | Anything that is not `http:` or `https:` | Obfuscated forms of a blocked address are decoded before the check: `http://2130706433/`, `http://0x7f.1/` and `http://127.1/` are all `127.0.0.1`, and all refused. This has no effect on ordinary use: calling a public API, a webhook, or another Cell by its `*.tissue.dev` (or custom-domain) name all work normally. Cells reach c3, g7 and other platform services through their **bindings**, not through `fetch()`, so those are unaffected too. If you need a Cell to talk to a service on a private network, that is not currently supported; the gateway has no allowlist you can extend yet. **No WebSockets.** Neither inbound nor outbound WebSocket connections are currently supported. Long-lived connections must be modelled as a sequence of HTTP requests. --- ## Compute **`ctx.waitUntil()` is available.** A Cell's `fetch(request, env, ctx)` receives a standard `ExecutionContext`. Call `ctx.waitUntil(promise)` to keep the Cell running after the `Response` is returned to the client, until `promise` settles, which is useful for flushing logs or writing an analytics event. For background work that isn't tied to a specific request, use [pulse](https://docs.tissue.systems/docs/pulse/overview/) to run a handler on a cron schedule instead. **10 seconds of CPU per request.** A request that spends more than 10 seconds on the processor is stopped and the client gets an error. Waiting doesn't count. A slow `fetch()`, a c3 query or a g7 read uses none of the budget; only the CPU your code burns adds up. Ten seconds is far more than a request normally needs. If you're getting close, move the work into a [pulse](https://docs.tissue.systems/docs/pulse/overview/) handler that does it in chunks. **No spawning processes or threads.** Cells run in a single-threaded V8 context. You cannot spawn child processes or worker threads. --- ## Crypto **PBKDF2 is capped at 1,000,000 iterations.** `crypto.subtle.deriveBits()` with a `PBKDF2` algorithm refuses an iteration count above one million: ``` NotSupportedError: Pbkdf2 failed: iteration counts above 1000000 are not supported (requested 2000000). ``` The ceiling exists because a Cell shares a machine with other tenants and an unbounded key-derivation loop is a way to monopolise it. It sits well above current guidance (OWASP recommends 600,000 iterations for PBKDF2-HMAC-SHA256), so password hashing at a recommended work factor is unaffected. If you need a higher work factor than the cap allows, use a memory-hard KDF (scrypt or Argon2, via WASM) rather than raising the iteration count. The rest of the Web Crypto API is standard: `crypto.subtle` digest/sign/verify/encrypt/decrypt, `crypto.getRandomValues()`, and `crypto.randomUUID()` all behave as specified, with no tissue-specific limits. --- ## WASM Cells specifically **JSON serialization boundary.** Request and response data crosses the JS/WASM boundary as JSON strings. This means binary request bodies are not supported for WASM Cells, and binary response bodies must be base64-encoded or represented as text. **No streaming.** Because the whole request must be serialized to JSON before `fetch` is called, and the whole response deserialized from JSON after it returns, request and response bodies are fully buffered for WASM Cells. JS Cells don't have this restriction: `request.body` and `Response` bodies are standard `ReadableStream`s and are streamed in both directions. See [js-stream-demo](https://github.com/tissue-systems/tissue-examples/tree/main/js-stream-demo). **No async Rust without `wasm-bindgen`.** Standard Rust async runtimes (Tokio, async-std) do not work in WASM. Async from WASM requires `wasm-bindgen` futures, which adds complexity. --- ## Code size A deploy upload (JavaScript source, or WASM binary + glue) is capped at **20 MB**. Below that there is no per-file limit, but large bundles increase cold-start latency, so keep compiled WASM under a few megabytes for best performance. --- ## See also - [c3 limitations](https://docs.tissue.systems/docs/c3/limitations/): SQLite constraints - [g7 limitations](https://docs.tissue.systems/docs/g7/limitations/): object storage constraints --- # c3: structured data / Overview Source: https://docs.tissue.systems/docs/c3/overview/ # c3: structured data **c3** is the SQL database service built into tissue.systems. Each account gets access to a persistent, full-featured SQLite database per database name. Cells interact with c3 through a binding declared in `ribo.toml`: no connection strings, no credentials, no network setup. The name comes from the [C3 carbon fixation pathway](https://en.wikipedia.org/wiki/C3_carbon_fixation), which converts carbon into stable, structured molecules. c3 does the same for your data. --- ## The data model c3 uses **SQLite** as its storage engine. Data is organized in the standard relational model: - A **database** is a named container for tables. You create databases with `ribo db create`. Each database is isolated from all others. - A **table** holds rows of structured data. You define tables in SQL with `CREATE TABLE`. - **Columns** have a declared type: `INTEGER`, `TEXT`, `REAL`, `BLOB`, or `NULL`. Your account can have as many databases as you need. Two accounts can both have a database named `myapp`; they are completely separate. --- ## Data types SQLite uses a flexible type system with five storage classes: | Type | Description | JS equivalent | |-----------|--------------------------------|--------------------| | `INTEGER` | Signed integer, up to 8 bytes | `number` (integer) | | `REAL` | 8-byte IEEE 754 floating point | `number` (float) | | `TEXT` | UTF-8 string | `string` | | `BLOB` | Raw bytes | not bindable, see below | | `NULL` | Absence of value | `null` | Column type declarations like `TEXT NOT NULL` are recommendations, not hard constraints; SQLite stores whatever value you insert. Use `NOT NULL` and `CHECK` constraints to enforce types at the database level. Binary values cannot be bound as parameters: query parameters travel as JSON, so there is no way to send raw bytes through the binding (an `ArrayBuffer` or `Uint8Array` would be stringified, not stored as a `BLOB`). Store binary data as base64-encoded `TEXT`, or keep it in g7 object storage and store a reference in c3. Existing `BLOB` columns read back as arrays of byte numbers, not `ArrayBuffer`. For structured data like JSON objects and arrays, use `TEXT` and serialize with `JSON.stringify` / `JSON.parse`. For dates and timestamps, use `TEXT` in ISO 8601 format (`2024-05-01T14:30:00Z`) or `INTEGER` as Unix epoch seconds. SQLite's built-in `datetime()` functions understand both. --- ## Creating a database ```bash ribo db create myapp ``` Database names must be lowercase, alphanumeric, and may contain hyphens (`my-database`). Create as many as you need: one per application, or one per concern within an application. --- ## Binding a database to a Cell In `ribo.toml`, declare a `[[bindings]]` block for each database the Cell needs: ```toml [cell] name = "my-cell" js = "./cell.js" [[bindings]] type = "c3" binding = "DB" database = "myapp" ``` The `binding` value becomes a property on the `env` object inside your Cell. Multiple databases get separate bindings: ```toml [[bindings]] type = "c3" binding = "USERS" database = "users" [[bindings]] type = "c3" binding = "EVENTS" database = "event-log" ``` Any name is valid for `binding`. Convention is `ALL_CAPS`. --- ## Schema initialization c3 databases start empty; there are no tables until you create them. A common pattern is to run your `CREATE TABLE IF NOT EXISTS` statements at the top of every `fetch` call. `exec()` accepts a multi-statement SQL string (every semicolon-separated statement runs, in order), so the whole schema fits in one call: ```js const SCHEMA = ` CREATE TABLE IF NOT EXISTS posts ( id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT NOT NULL, body TEXT NOT NULL, created_at TEXT NOT NULL DEFAULT (datetime('now')) ); CREATE TABLE IF NOT EXISTS tags ( id INTEGER PRIMARY KEY AUTOINCREMENT, post_id INTEGER NOT NULL REFERENCES posts(id), name TEXT NOT NULL ); `; export default { async fetch(request, env) { await env.DB.exec(SCHEMA); // your handler logic }, }; ``` `IF NOT EXISTS` makes this safe to call on every request: SQLite checks the schema catalog and skips creation when the table already exists. Multi-statement strings work only when no bind parameters are given; with parameters, `exec()` runs a single prepared statement. That's fine for schema DDL, which never carries parameters. (From the CLI, `ribo db exec --file schema.sql` handles multi-statement files too.) --- ## Writing and reading data ```js export default { async fetch(request, env) { await env.DB.exec( "CREATE TABLE IF NOT EXISTS notes (id INTEGER PRIMARY KEY AUTOINCREMENT, text TEXT NOT NULL)" ); const url = new URL(request.url); if (request.method === "POST") { const { text } = await request.json(); const { meta } = await env.DB.prepare( "INSERT INTO notes (text) VALUES (?)" ).bind(text).run(); return Response.json({ id: meta.last_insert_rowid }); } if (url.pathname.startsWith("/notes/")) { const id = parseInt(url.pathname.slice(7)); const note = await env.DB.prepare( "SELECT * FROM notes WHERE id = ?" ).bind(id).first(); if (!note) return new Response("Not found", { status: 404 }); return Response.json(note); } const { results } = await env.DB.prepare( "SELECT * FROM notes ORDER BY id DESC LIMIT 50" ).all(); return Response.json(results); }, }; ``` --- ## Transactions `batch()` runs its statements as a **single transaction**: the whole batch is wrapped in `BEGIN IMMEDIATE` … `COMMIT` on one connection. Use it whenever a group of writes must succeed or fail together: ```js await env.DB.batch([ env.DB.prepare("INSERT INTO orders (user_id, total) VALUES (?, ?)").bind(userId, total), env.DB.prepare("UPDATE users SET order_count = order_count + 1 WHERE id = ?").bind(userId), env.DB.prepare("INSERT INTO audit_log (action, user_id) VALUES (?, ?)").bind("order_created", userId), ]); ``` Statements run in order, and a `SELECT` inside a batch sees the writes made by earlier statements in the same batch. If any statement errors, the entire batch is rolled back: nothing is committed, including the statements that ran before the error. The binding does not expose raw `BEGIN` / `COMMIT` statements; `batch()` is the transaction mechanism. A batch cannot span multiple `fetch` invocations. Submit all related statements together within a single handler call. --- ## Indexes SQLite uses a table scan by default. Add indexes for columns you query often: ```sql CREATE INDEX IF NOT EXISTS idx_posts_created_at ON posts(created_at); CREATE INDEX IF NOT EXISTS idx_tags_post_id ON tags(post_id); CREATE UNIQUE INDEX IF NOT EXISTS idx_users_email ON users(email); ``` Include these in your schema initialization block and they will be created alongside the tables. --- ## Schema migrations For apps that evolve over time, a simple version-tracked migration pattern works well: ```js const MIGRATIONS = [ "CREATE TABLE IF NOT EXISTS schema_version (version INTEGER NOT NULL)", `CREATE TABLE IF NOT EXISTS posts ( id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT NOT NULL, body TEXT NOT NULL, created_at TEXT NOT NULL DEFAULT (datetime('now')) )`, ]; async function migrate(db) { await db.exec("CREATE TABLE IF NOT EXISTS schema_version (version INTEGER NOT NULL)"); const row = await db.prepare("SELECT MAX(version) as v FROM schema_version").first(); const current = row?.v ?? -1; for (let i = current + 1; i < MIGRATIONS.length; i++) { await db.batch([ db.prepare(MIGRATIONS[i]), db.prepare("INSERT INTO schema_version (version) VALUES (?)").bind(i), ]); } } export default { async fetch(request, env) { await migrate(env.DB); // ... }, }; ``` Each migration runs once and is recorded. New migrations added to the array run on the next request. --- ## Multiple databases per Cell You can bind more than one database to a single Cell: ```toml [[bindings]] type = "c3" binding = "USERS_DB" database = "users" [[bindings]] type = "c3" binding = "ANALYTICS_DB" database = "analytics" ``` ```js export default { async fetch(request, env) { const user = await env.USERS_DB.prepare( "SELECT * FROM users WHERE id = ?" ).bind(userId).first(); await env.ANALYTICS_DB.prepare( "INSERT INTO page_views (user_id, path, ts) VALUES (?, ?, datetime('now'))" ).bind(userId, path).run(); return Response.json(user); }, }; ``` Each binding targets a separate, independent database. --- ## Managing databases with ribo ```bash ribo db create myapp # create a new database ribo db list # list all databases for your account ribo db exec myapp "SELECT * FROM posts LIMIT 5" # run SQL directly ribo db exec myapp --file schema.sql # load a .sql file (schema, seed data, migrations) ribo db drop myapp # permanently delete a database and all data ``` `ribo db exec` is useful for inspecting data, running one-time migrations, or debugging during development. Use `--file` for multi-statement SQL files; it handles schemas and bulk data loads of any size in a single request. --- ## See also - [c3 API reference](https://docs.tissue.systems/docs/c3/api/): full query API with examples - [c3 limitations](https://docs.tissue.systems/docs/c3/limitations/): constraints and known limits - [Vector search](https://docs.tissue.systems/docs/c3/vector-search/): embeddings and nearest-neighbour queries - [ribo.toml reference](https://docs.tissue.systems/docs/cells/configuration/): declaring bindings --- # c3: structured data / API reference Source: https://docs.tissue.systems/docs/c3/api/ # c3 API reference The c3 binding is available as `env.` inside any Cell that declares a `[[bindings]]` block with `type = "c3"`. All methods return Promises. --- ## exec Run a raw SQL string and discard the result. Use for DDL statements, schema initialization, and any SQL that does not return rows. ```js await env.DB.exec("CREATE TABLE IF NOT EXISTS items (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL)"); await env.DB.exec("DROP TABLE IF EXISTS old_cache"); await env.DB.exec("CREATE INDEX IF NOT EXISTS idx_items_name ON items(name)"); ``` `exec` accepts **multi-statement** SQL: pass a semicolon-separated string and every statement runs, in order, which is convenient for schema initialization: ```js await env.DB.exec(` CREATE TABLE IF NOT EXISTS items (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL); CREATE INDEX IF NOT EXISTS idx_items_name ON items(name); `); ``` Multi-statement strings work only when no bind parameters are given. With parameters, `exec` runs a single prepared statement; parameters and multi-statement strings do not mix. (From the CLI, `ribo db exec --file script.sql` handles multi-statement files too.) **Do not interpolate user input into `exec` strings.** Use `prepare().bind()` for any value that comes from outside your code. ### Return value Returns `{ results, meta }` where `meta` is `{ duration_ms, rows_affected, last_insert_rowid }`: wall-clock time in milliseconds, rows changed, and the rowid of the most recent insert. For a multi-statement string, `rows_affected` is the total across all statements. These are rarely needed for DDL. --- ## prepare Create a parameterized statement. Placeholders are positional `?` characters. ```js const stmt = env.DB.prepare("SELECT * FROM items WHERE category = ? AND price < ?"); ``` Returns a statement object. Call `.bind(...values)` before executing to supply parameter values, then call a terminal method (`run`, `all`, `first`, or `raw`). `prepare` itself does not execute the query; it only compiles the statement. The query runs when you call a terminal method. --- ## bind Bind values to a prepared statement's `?` placeholders, in order. ```js stmt.bind(value1, value2, ...) ``` Returns the same statement with the values attached (`bind` mutates the statement and returns it). Chainable: ```js await env.DB.prepare("INSERT INTO items (name, price) VALUES (?, ?)").bind("widget", 9.99).run(); ``` ### Supported value types | JavaScript type | SQLite storage class | |------------------------------|----------------------| | `number` (integer) | `INTEGER` | | `number` (float) | `REAL` | | `string` | `TEXT` | | `null` | `NULL` | | `boolean` | `INTEGER` (1 or 0) | Binary values (`ArrayBuffer`, `Uint8Array`) are **not** supported as parameters: values travel as JSON, so raw bytes cannot be bound and would not be stored as a `BLOB`. Store binary data as base64-encoded `TEXT`, or use g7 object storage for binary payloads. `BLOB` columns read back as arrays of byte numbers, not `ArrayBuffer`. Pass `null` explicitly to store a SQL `NULL`: ```js await env.DB.prepare("INSERT INTO users (name, bio) VALUES (?, ?)").bind("Alice", null).run(); ``` --- ## run Execute a statement that does not return rows. Returns a result object with a `meta` property containing execution metadata. ```js const { meta } = await env.DB.prepare( "INSERT INTO items (name, price) VALUES (?, ?)" ).bind("gadget", 14.99).run(); meta.last_insert_rowid // integer: rowid of the inserted row (INSERT only) meta.rows_affected // integer: rows changed (UPDATE or DELETE) meta.duration_ms // number: query execution time in milliseconds ``` Use `run()` for `INSERT`, `UPDATE`, and `DELETE`. ### Example: INSERT and return the new row ```js const { meta } = await env.DB.prepare( "INSERT INTO posts (title, body) VALUES (?, ?)" ).bind(title, body).run(); const post = await env.DB.prepare( "SELECT * FROM posts WHERE id = ?" ).bind(meta.last_insert_rowid).first(); return Response.json(post); ``` ### Example: UPDATE with rows_affected check ```js const { meta } = await env.DB.prepare( "UPDATE items SET price = ? WHERE id = ?" ).bind(newPrice, id).run(); if (meta.rows_affected === 0) { return new Response("Not found", { status: 404 }); } return Response.json({ updated: true }); ``` --- ## all Execute a `SELECT` statement and return all matching rows as an array of plain objects. ```js const { results } = await env.DB.prepare( "SELECT * FROM posts ORDER BY created_at DESC LIMIT ?" ).bind(50).all(); // results: [{ id: 5, title: "...", body: "..." }, ...] ``` Each row is a plain JavaScript object with column names as keys. Column types are mapped to JavaScript types as described in the `bind` section above. Returns `{ results: object[] }`. There is no `meta` property on `all()` results. ### Empty results When no rows match, `results` is an empty array, not `null`. Check `results.length` rather than the array itself: ```js const { results } = await env.DB.prepare( "SELECT * FROM items WHERE category = ?" ).bind("unknown").all(); if (results.length === 0) { return Response.json({ items: [] }); } ``` --- ## first Execute a `SELECT` statement and return the first matching row, or `null` if there are no results. ```js // Return the full row as an object const item = await env.DB.prepare( "SELECT * FROM items WHERE id = ?" ).bind(42).first(); // → { id: 42, name: "widget", price: 9.99 } or null // Return a single column value const name = await env.DB.prepare( "SELECT name FROM items WHERE id = ?" ).bind(42).first("name"); // → "widget" or null ``` When a column name is passed, `first()` returns the raw column value rather than a row object. `first` is equivalent to appending `LIMIT 1`, and is more efficient than `all()` when you only need one row. ### Existence check ```js const exists = await env.DB.prepare( "SELECT 1 FROM users WHERE email = ?" ).bind(email).first() !== null; ``` ### Aggregate values ```js const count = await env.DB.prepare( "SELECT COUNT(*) as n FROM posts WHERE published = 1" ).first("n"); // → 42 (number) const latest = await env.DB.prepare( "SELECT MAX(created_at) as ts FROM events" ).first("ts"); // → "2024-05-01T14:30:00" (string) or null if table is empty ``` --- ## raw Execute a `SELECT` statement and return rows as arrays of values rather than objects. Column names are omitted. ```js const rows = await env.DB.prepare( "SELECT id, name, price FROM items WHERE active = 1" ).bind(1).raw(); // → [[1, "widget", 9.99], [2, "gadget", 14.99], ...] ``` Use `raw()` when you need to minimize response size or when the column names are redundant (for example, when building a CSV export). To include column names as the first row: ```js const { results } = await env.DB.prepare( "SELECT id, name, price FROM items" ).all(); const columnNames = Object.keys(results[0] ?? {}); const rows = [columnNames, ...results.map(r => Object.values(r))]; ``` --- ## batch Execute multiple statements in a single round-trip, as a **single transaction**. The whole batch is wrapped in `BEGIN IMMEDIATE` … `COMMIT` on one connection: statements run in order, and if any statement errors, everything is rolled back, with no partial commits. ```js const results = await env.DB.batch([ env.DB.prepare("INSERT INTO orders (user_id, total) VALUES (?, ?)").bind(userId, total), env.DB.prepare("UPDATE users SET order_count = order_count + 1 WHERE id = ?").bind(userId), env.DB.prepare("INSERT INTO audit_log (action, ref_id) VALUES (?, ?)").bind("order_placed", orderId), ]); // results: array of { results?, meta }, one entry per statement ``` Returns an array of result objects, one per statement, in the same order as the input array. SELECT statements within a batch return their rows in `results[i].results`, and they see the writes made by earlier statements in the same batch. ### Error handling If a statement fails, `batch()` rejects with an error, no further statements run, and the entire batch is rolled back; statements that ran before the error are **not** retained. The database is left exactly as it was before the batch started. This makes `batch()` the tool for operations that need all-or-nothing semantics. A balance transfer is the classic example: either both updates commit, or neither does: ```js // Atomic: if either UPDATE fails, both are rolled back // and no money is lost. await env.DB.batch([ env.DB.prepare("UPDATE accounts SET balance = balance - ? WHERE id = ?").bind(amount, fromId), env.DB.prepare("UPDATE accounts SET balance = balance + ? WHERE id = ?").bind(amount, toId), ]); ``` ### Mixed SELECT and write in one batch ```js const [selectResult, _insertResult] = await env.DB.batch([ env.DB.prepare("SELECT COUNT(*) as total FROM items"), env.DB.prepare("INSERT INTO log (action) VALUES (?)").bind("counted"), ]); const total = selectResult.results[0].total; ``` --- ## Common patterns ### Pagination ```js const PAGE_SIZE = 20; const page = Math.max(0, parseInt(new URL(request.url).searchParams.get("page") ?? "0")); const { results } = await env.DB.prepare( "SELECT * FROM posts ORDER BY created_at DESC LIMIT ? OFFSET ?" ).bind(PAGE_SIZE, page * PAGE_SIZE).all(); const countRow = await env.DB.prepare( "SELECT COUNT(*) as n FROM posts" ).first("n"); return Response.json({ posts: results, page, total: countRow, pages: Math.ceil(countRow / PAGE_SIZE), }); ``` ### Upsert (insert or update) ```js await env.DB.prepare(` INSERT INTO settings (key, value, updated_at) VALUES (?, ?, datetime('now')) ON CONFLICT(key) DO UPDATE SET value = excluded.value, updated_at = excluded.updated_at `).bind("theme", "dark").run(); ``` ### Soft delete ```js await env.DB.prepare( "UPDATE posts SET deleted_at = datetime('now') WHERE id = ?" ).bind(id).run(); // Exclude soft-deleted rows in queries: const { results } = await env.DB.prepare( "SELECT * FROM posts WHERE deleted_at IS NULL ORDER BY created_at DESC" ).all(); ``` ### JSON values ```js // Store a JSON object in a TEXT column await env.DB.prepare( "INSERT INTO events (type, payload) VALUES (?, ?)" ).bind("user.signup", JSON.stringify({ email, plan: "free" })).run(); // Retrieve and parse const row = await env.DB.prepare( "SELECT payload FROM events WHERE id = ?" ).bind(id).first("payload"); const payload = JSON.parse(row); ``` ### Full-text search For simple substring search, `LIKE` works with no setup: ```js const query = `%${searchTerm.replace(/[%_\\]/g, "\\$&")}%`; const { results } = await env.DB.prepare( "SELECT * FROM posts WHERE title LIKE ? OR body LIKE ? ESCAPE '\\'" ).bind(query, query).all(); ``` For heavier search requirements, SQLite's FTS5 extension is available. Create a virtual table with `CREATE VIRTUAL TABLE ... USING fts5(...)` and query it with `MATCH`: ```js await env.DB.exec("CREATE VIRTUAL TABLE IF NOT EXISTS posts_fts USING fts5(title, body)"); const { results } = await env.DB.prepare( "SELECT rowid, title FROM posts_fts WHERE posts_fts MATCH ? ORDER BY rank" ).bind(searchTerm).all(); ``` ### Similarity search To search by meaning rather than by words, store an embedding in an `F32_BLOB` column and rank rows by distance to the query's embedding. Bind the embedding as a plain array: ```js const { results } = await env.DB.prepare(` SELECT id, title, vector_distance_cos(embedding, vector32(?)) AS distance FROM docs WHERE embedding IS NOT NULL ORDER BY distance LIMIT 10 `).bind(queryEmbedding).all(); ``` [Vector search](https://docs.tissue.systems/docs/c3/vector-search/) covers the column type, inserting, the approximate index and its trade-offs. ### Date range queries ```js const { results } = await env.DB.prepare(` SELECT * FROM events WHERE created_at >= datetime('now', '-7 days') ORDER BY created_at DESC `).all(); ``` --- ## See also - [c3 Overview](https://docs.tissue.systems/docs/c3/overview/): data model, schema management, transactions - [c3 limitations](https://docs.tissue.systems/docs/c3/limitations/): constraints and known limits --- # c3: structured data / Vector search Source: https://docs.tissue.systems/docs/c3/vector-search/ # Vector search c3 can store embeddings and rank rows by how close they are to a query vector, in plain SQL. The vector column type, the distance functions and an approximate nearest-neighbour index are built into the database engine, so there is no extension to load and nothing to set up beyond your schema. c3 doesn't make the embeddings. Your Cell gets them from a model provider (OpenAI, Voyage, Cohere, a model you host) with a `fetch`, keeps the API key in a [`vault` binding](https://docs.tissue.systems/docs/cells/configuration/#vault-encrypted-secret), and stores the numbers it gets back. --- ## A vector column Declare the column as `F32_BLOB(n)`, where `n` is the number of dimensions your embedding model returns: ```js await env.DB.exec(` CREATE TABLE IF NOT EXISTS docs ( id INTEGER PRIMARY KEY, title TEXT NOT NULL, body TEXT NOT NULL, embedding F32_BLOB(1536) ) `); ``` Each value is stored as `n` 32-bit floats, so a 1536-dimension embedding takes 6 KiB per row. Pick `n` to match the model: `text-embedding-3-small` returns 1536, many open models return 384 or 768. Inserting a vector of the wrong length into an indexed column fails with `dimensions are different`, and comparing two vectors of different lengths fails with `vectors must have the same length`. --- ## Inserting vectors Wrap the parameter in `vector32(?)` and bind the embedding as a plain JavaScript array. Parameters travel as JSON, so the array arrives as the text `[0.012,-0.034,...]`, which is the format `vector32()` reads: ```js const embedding = await embed(env, `${title}\n\n${body}`); // number[] await env.DB.prepare( "INSERT INTO docs (title, body, embedding) VALUES (?, ?, vector32(?))" ).bind(title, body, embedding).run(); ``` `JSON.stringify(embedding)` works the same way if you'd rather be explicit. A `Float32Array` does not: it serializes as an object (`{"0":0.012,...}`) and the insert fails with `vector: must start with '['`. Convert it first with `Array.from(floats)`. To load many rows, send them in one `batch()`. It's a single round trip and a single transaction: ```js await env.DB.batch(items.map((item, i) => env.DB.prepare( "INSERT INTO docs (title, body, embedding) VALUES (?, ?, vector32(?))" ).bind(item.title, item.body, embeddings[i]) )); ``` Most providers embed a list of inputs in one request, so embed the whole batch at once too. --- ## Searching The simplest search compares the query vector against every row and sorts by distance. Smaller is closer: ```js const q = await embed(env, searchText); const { results } = await env.DB.prepare(` SELECT id, title, vector_distance_cos(embedding, vector32(?)) AS distance FROM docs WHERE embedding IS NOT NULL ORDER BY distance LIMIT 10 `).bind(q).all(); ``` Keep the `WHERE embedding IS NOT NULL`. A row with no embedding yet makes the whole query fail with `unexpected value type: got NULL`, rather than sorting to the end. Because it's ordinary SQL, filters go in the same `WHERE` clause and apply before the ranking: ```js const { results } = await env.DB.prepare(` SELECT id, title, vector_distance_cos(embedding, vector32(?)) AS distance FROM docs WHERE embedding IS NOT NULL AND account_id = ? AND created_at >= ? ORDER BY distance LIMIT 10 `).bind(q, accountId, since).all(); ``` A full scan is exact, and it's fast at the sizes most Cells hold. Scanning 10,000 rows of 1536 dimensions takes a few tens of milliseconds, and the time grows in proportion to rows × dimensions. Check `meta.duration_ms` on the result to see what your own query costs. ### Reading a vector back Selecting the column directly returns the raw bytes as an array of numbers, which is rarely what you want. `vector_extract` returns it as text: ```js const row = await env.DB.prepare( "SELECT vector_extract(embedding) AS embedding FROM docs WHERE id = ?" ).bind(id).first(); const vector = JSON.parse(row.embedding); // number[] ``` ### Functions | Function | Returns | |---|---| | `vector32(text)` | A float32 vector from `'[1.0, 2.0, ...]'` text | | `vector_extract(vector)` | The vector as `'[1,2,...]'` text | | `vector_distance_cos(a, b)` | Cosine distance: 0 for the same direction, 1 for unrelated, up to 2 for opposite | | `vector_distance_l2(a, b)` | Euclidean distance | Use cosine distance unless your embedding model's documentation says otherwise. --- ## The approximate index For tables too large to scan on every query, c3 can keep an approximate nearest-neighbour index on a vector column. Queries through it read a small part of the table instead of all of it. The trade-offs are real, so start with the scan above and add the index when `meta.duration_ms` tells you to. ### Create it on an empty table ```js await env.DB.exec(` CREATE INDEX IF NOT EXISTS docs_embedding_idx ON docs (libsql_vector_idx(embedding, 'compress_neighbors=float8', 'max_neighbors=16')) `); ``` Create the index in your schema setup, before any rows go in. From then on every insert, update and delete keeps it current. Building the index over rows that are already in the table is slow, and a statement that runs past c3's 30-second limit is cancelled. 2,000 rows of 1536 dimensions is already enough to hit it. See [adding an index to a full table](#adding-an-index-to-a-full-table) below. ### Querying through it `vector_top_k(index, query, k)` returns the rowids of the `k` nearest rows. Join it back to the table to get the columns: ```js const { results } = await env.DB.prepare(` SELECT d.id, d.title FROM vector_top_k('docs_embedding_idx', vector32(?), 10) AS t JOIN docs d ON d.rowid = t.id `).bind(q).all(); ``` The results come back nearest first. If you also want the distance, compute it in the same query: `vector_distance_cos(d.embedding, vector32(?1))` with the query bound once as `?1`. Two things differ from the scan: - **It's approximate.** The index can miss some of the true nearest rows, so the ten it returns may not be exactly the ten a full scan would return. - **Filters apply after the index.** A `WHERE` on the joined table drops rows from the `k` the index already picked, so asking for 10 and filtering can leave you with 3. Ask for more than you need and add a `LIMIT`, or use the full scan when the filter narrows the table a lot. ### Options Options are extra string arguments to `libsql_vector_idx`: | Option | Meaning | |---|---| | `'metric=cosine'` | Distance used by the index: `cosine` (the default) or `l2` | | `'compress_neighbors=float8'` | Store neighbour vectors at 8 bits instead of 32 | | `'max_neighbors=16'` | Neighbours kept per row. Fewer is smaller and faster, and finds slightly less | The index stores copies of neighbouring vectors for every row, and with the defaults it is far larger than the table itself. In our test, 2,000 rows of 1536 dimensions took 16 MB with no index, 82 MB with the options shown above, and over 600 MB with the defaults, and inserts were around eight times slower with the defaults too. Pass `compress_neighbors=float8` and a `max_neighbors` value unless you have measured a reason not to. An unknown option fails at `CREATE INDEX` time with `invalid vector index parameter`. ### Adding an index to a full table Create a new table with the index already on it, copy the rows across in chunks small enough to finish well inside 30 seconds, then swap the names: ```js await env.DB.exec(` CREATE TABLE docs_new (id INTEGER PRIMARY KEY, title TEXT NOT NULL, body TEXT NOT NULL, embedding F32_BLOB(1536)); CREATE INDEX docs_new_embedding_idx ON docs_new (libsql_vector_idx(embedding, 'compress_neighbors=float8', 'max_neighbors=16')); `); let last = 0; for (;;) { const { meta } = await env.DB.prepare(` INSERT INTO docs_new SELECT * FROM docs WHERE id > ? ORDER BY id LIMIT 200 `).bind(last).run(); if (meta.rows_affected === 0) break; last = meta.last_insert_rowid; } ``` Run the copy from a script or one request at a time rather than one long Cell invocation. Once it finishes, `DROP TABLE docs` and `ALTER TABLE docs_new RENAME TO docs`. The index keeps its name, so queries use `vector_top_k('docs_new_embedding_idx', ...)` after the swap. If a `CREATE INDEX` on a full table does run out of time, c3 removes the half-built index, and the error says the index was not created. Nothing is left behind, so use the copy above and the same name works. --- ## Scan or index | | Full scan | Index | |---|---|---| | Results | Exact | Approximate | | Filters | Applied before ranking | Applied after the top `k` | | Setup | None | `CREATE INDEX` on an empty table | | Storage | The vectors | The vectors plus several times that for the index | | Insert cost | Same as any row | Noticeably higher | | Query time | Grows with the table | Stays low | For tens of thousands of rows, the scan is usually the right answer. --- ## Moving the data elsewhere The vector columns and functions are part of libSQL, the SQLite fork c3 runs on. A database snapshot from an [explant](https://docs.tissue.systems/docs/cells/explant/) opens in the stock `sqlite3` tool and ordinary columns read normally, but the vector functions aren't there, and a table with a vector index can't be written to: inserts fail with `unknown function: libsql_vector_idx()`. Drop the vector index before taking the file to plain SQLite, or open it with a libSQL build. --- ## A complete Cell [`js-vec-search`](https://github.com/tissue-systems/tissue-examples/tree/main/js-vec-search) in tissue-examples is a working semantic search Cell: it embeds documents with OpenAI, stores them in c3 and serves a search page. For keyword search instead, see [full-text search](https://docs.tissue.systems/docs/c3/api/#full-text-search) with FTS5. --- ## See also - [c3 API reference](https://docs.tissue.systems/docs/c3/api/): `prepare`, `bind`, `batch` - [c3 limitations](https://docs.tissue.systems/docs/c3/limitations/): statement timeout, result caps - [ribo.toml reference](https://docs.tissue.systems/docs/cells/configuration/): `c3` and `vault` bindings --- # c3: structured data / Limitations Source: https://docs.tissue.systems/docs/c3/limitations/ # c3 limitations --- ## Write concurrency **Single-writer model.** SQLite allows only one writer at a time per database. Concurrent write requests to the same Cell are serialized: one waits while the other holds the write lock. Read requests are unaffected and proceed concurrently. The queue is rarely a problem: write operations in SQLite are fast (microseconds to low milliseconds), so the wait is negligible unless you have extreme write throughput. If your workload is write-heavy, minimize the work done per statement and use `batch()` to coalesce multiple writes into a single round-trip. --- ## No stored procedures Stored procedures do not exist in SQLite. Run the equivalent SQL statements in your handler or in a `batch()` call. (Triggers, by contrast, *are* supported: `CREATE TRIGGER` works normally, as does full-text search via FTS5.) --- ## No streaming results All query results are returned as a complete in-memory array. For very large result sets, use cursor-based pagination (`LIMIT` / `OFFSET` or keyset pagination on an indexed column) rather than fetching thousands of rows at once. --- ## No interactive transactions The binding API does not expose raw `BEGIN` / `COMMIT`, so you cannot hold a transaction open across multiple calls or invocations. For multi-statement atomicity, use `batch()`: the whole batch runs as a single transaction on one connection, and any statement error rolls back every statement in the batch. Submit all related writes together within a single `fetch` or `pulse` invocation. --- ## No cross-database queries Each c3 binding targets a single database. There is no way to `JOIN` across two databases in a single query. If you need data from two databases in one response, query each binding separately and join the results in JavaScript. --- ## No connection pooling Each Cell invocation uses a single database connection for the duration of the request. There is no persistent connection pool between requests. Connection setup is fast, but on very latency-sensitive paths, cut the number of round-trips by using `batch()`. --- ## Statements c3 will not run Four statements are rejected before they reach SQLite, on every path, including inside a `batch()`: | Statement | Why | Error | |---|---|---| | `ATTACH` / `DETACH` | Every database is a file in a shared directory; attaching one reaches outside your account | `ATTACH is not allowed on a c3 database` | | `VACUUM` | `VACUUM INTO ''` writes a full copy of the database to an arbitrary path | `VACUUM is not allowed on a c3 database` | | `PRAGMA` | Several pragmas (`cache_size`, `mmap_size`, `temp_store`) are one-statement memory-exhaustion primitives against a process shared by every account, and `writable_schema` edits the schema table directly | `PRAGMA is not allowed on a c3 database` | **Introspection still works.** Use the read-only `pragma_*` table-valued functions instead of the statement form: ```sql SELECT * FROM pragma_table_info('notes'); -- works SELECT * FROM pragma_index_list('notes'); -- works PRAGMA table_info(notes); -- rejected ``` Everything else is ordinary SQLite: `CREATE TRIGGER`, FTS5, CTEs, window functions, `JSON` functions and so on all work normally, along with libSQL's [vector columns and functions](https://docs.tissue.systems/docs/c3/vector-search/). --- ## Query and payload caps These bound a single request. Exceeding one is an error, not a truncation: you always get all your rows or a clear failure, never a silent partial result. | Cap | Limit | Error | |---|---|---| | Rows in one result set | 100,000 | `Result set too large: more than 100000 rows. Add a LIMIT or paginate.` | | Size of one result set | 64 MiB | `Result set too large: over 67108864 bytes. Add a LIMIT or paginate.` | | Request body (your SQL + bound parameters) | 32 MiB | HTTP 413 | If you hit a result-set cap, add a `LIMIT` and paginate (keyset pagination on an indexed column is the cheapest form). A recursive CTE with no termination condition is the usual way to hit it by accident. **Statements time out after 30 seconds.** A statement still running at 30 seconds is cancelled and fails with `Query exceeded the 30000 ms statement timeout and was cancelled.` Ordinary queries never get close. The usual way to hit it is building an index over a large table in one statement, a [vector index](https://docs.tissue.systems/docs/c3/vector-search/#create-it-on-an-empty-table) especially: create indexes before the data goes in, or copy the rows into an indexed table in chunks. --- ## Size and retention **Keep databases modest.** Very large databases increase query latency and memory usage during reads. Keep individual databases under a few hundred megabytes for best performance. Very large `BLOB` values (images, documents) belong in g7 object storage, not in c3. **Databases persist until explicitly dropped.** `ribo db drop ` permanently and irreversibly deletes a database. There is no automatic expiry, retention policy, or recycle bin. --- ## No binary/UUID primary key type SQLite has no native UUID column type. Store UUIDs as `TEXT` (36-character hyphenated string). A 16-byte `BLOB` encoding is not practical through the binding, since binary parameters cannot be bound. `crypto.randomUUID()` returns a text UUID suitable for direct storage. --- ## See also - [c3 Overview](https://docs.tissue.systems/docs/c3/overview/) - [c3 API reference](https://docs.tissue.systems/docs/c3/api/) --- # g7: object storage / Overview Source: https://docs.tissue.systems/docs/g7/overview/ # g7: object storage **g7** is the object storage service built into tissue.systems. The name is a numeronym: **g** + **7** (the seven letters of *lycogen*) + **n** = *glycogen*, the same convention behind `i18n` (internationalisation) and `k8s` (Kubernetes). Glycogen is the molecule animals use for compact, stable energy storage; g7 is where your Cells store their files and binary objects. --- ## What g7 is g7 provides key-value object storage organised into **buckets**. Each object is identified by a key (a path-like string) and can hold any content: images, PDFs, JSON blobs, compiled assets, or arbitrary binary data. Objects are: - **Durable**: stored redundantly and persistent across redeploys - **Scoped to your account**: bucket names are namespaced per account - **Accessible from Cells**: via the `env.` object at runtime --- ## Creating a bucket ```bash ribo bucket create my-bucket ``` Bucket names must be lowercase alphanumeric with hyphens. --- ## Binding a bucket to a Cell In `ribo.toml`: ```toml [[bindings]] type = "g7" binding = "IMAGES" bucket = "user-avatars" ``` The binding appears as `env.IMAGES` inside the Cell. You can bind multiple buckets: ```toml [[bindings]] type = "g7" binding = "UPLOADS" bucket = "raw-uploads" [[bindings]] type = "g7" binding = "PROCESSED" bucket = "processed-images" ``` --- ## Using g7 in a Cell ```js export default { async fetch(request, env) { const url = new URL(request.url); if (request.method === "PUT" && url.pathname.startsWith("/upload/")) { const key = url.pathname.slice(8); await env.UPLOADS.put(key, request.body, { contentType: request.headers.get("content-type") ?? "application/octet-stream", }); return Response.json({ ok: true, key }); } if (url.pathname.startsWith("/file/")) { const key = url.pathname.slice(6); const res = await env.UPLOADS.get(key); if (!res) return new Response("Not found", { status: 404 }); return new Response(res.body, { headers: { "content-type": res.headers.get("content-type") ?? "application/octet-stream" }, }); } return new Response("Not found", { status: 404 }); }, }; ``` --- ## See also - [Managing buckets](https://docs.tissue.systems/docs/g7/buckets/): create, list, and delete buckets with ribo - [Static sites](https://docs.tissue.systems/docs/g7/static-sites/): serve a directory of files with zero code - [g7 API reference](https://docs.tissue.systems/docs/g7/api/): full object API - [S3 API](https://docs.tissue.systems/docs/g7/s3-api/): reach a bucket from the AWS CLI, Python, or any S3 client - [g7 limitations](https://docs.tissue.systems/docs/g7/limitations/): size caps, unsupported features --- # g7: object storage / Managing buckets Source: https://docs.tissue.systems/docs/g7/buckets/ # Managing buckets Buckets are the top-level containers in g7. Each bucket holds objects identified by string keys. Buckets are scoped to your account: two different accounts can both have a bucket named `uploads` without conflict, but within your account each bucket name must be unique. --- ## Create a bucket ```bash ribo bucket create ``` Bucket name rules: - **3–49 characters** - Lowercase letters, numbers, and hyphens only (no underscores) - Must start and end with a letter or number ```bash ribo bucket create avatars ribo bucket create raw-uploads ribo bucket create processed-images ``` Buckets are private by default. Pass `--public` to allow anonymous `GET`/`HEAD` on the bucket's objects (see [Public access and external clients](#public-access-and-external-clients) below). --- ## List buckets ```bash ribo bucket list ``` avatars raw-uploads processed-images --- ## List objects in a bucket ```bash ribo bucket ls ``` List the objects stored in a bucket with their sizes. ```bash ribo bucket ls avatars ``` portraits/alice.jpg 24601 portraits/bob.png 38912 thumbnails/alice.jpg 4096 --- ## Upload, download, and sync files You don't need an S3 client to move files in and out of a bucket; `ribo` does it directly. One side of each command is a local path, the other a `bucket:key` reference; the direction is inferred from which side carries the `bucket:` prefix. ```bash # copy a single file up or down ribo bucket cp ./photo.jpg avatars:portraits/alice.jpg ribo bucket cp avatars:portraits/alice.jpg ./alice.jpg # copy a whole tree (-r) ribo bucket cp -r ./dist site-assets:site/ ribo bucket cp -r site-assets:site/ ./restore # one-way sync (transfers only missing/changed files) ribo bucket sync ./dist site-assets:site/ --delete # delete an object, or every object under a prefix ribo bucket rm avatars:portraits/alice.jpg ribo bucket rm -r avatars:thumbnails/ ``` `sync` skips files that are unchanged (same size and content), making it ideal for pushing build output or pulling backups. See the [ribo CLI reference](https://docs.tissue.systems/docs/ribo/reference/#ribo-bucket-cp) for the full flag list. --- ## Delete a bucket ```bash ribo bucket drop ``` This removes the bucket and all objects inside it. **This is irreversible.** ```bash ribo bucket drop old-uploads ``` --- ## Public access and external clients Cell bindings are the primary way to use a bucket, but not the only one: **Public-read buckets.** Create a bucket with `--public`, or toggle an existing one: ```bash ribo bucket create avatars --public ribo bucket set avatars --public # or --private to revert ``` Anonymous clients can then `GET`/`HEAD` the bucket's objects at `https://g7.tissue.dev//` (object URLs use the bucket's account-namespaced storage name; a pre-signed URL shows the full form). Public-read only ever applies to object reads; listing, writes, and deletes always require credentials. Object downloads live on `g7.tissue.dev`, the same domain your Cells serve from, so a file someone uploads can never run as a page on `tissue.systems`. An object URL that still names `g7.tissue.systems` gets a permanent redirect to the same path on `g7.tissue.dev`. **Pre-signed URLs.** The management API can mint a short-lived signed URL for a single upload or download (`POST /v1/buckets/:bucket/presign`), useful for handing a browser or external service one-off access without sharing credentials. Download links come back on `g7.tissue.dev` and upload links on `g7.tissue.systems`. **S3 API.** `https://g7.tissue.systems` accepts SigV4-signed requests with per-bucket credentials, so the AWS CLI, boto3, rclone, and other S3 clients can read and write a bucket directly. See the [S3 API](https://docs.tissue.systems/docs/g7/s3-api/) page for credentials, install steps, and examples. --- ## Binding a bucket to a Cell Once a bucket exists, declare it in `ribo.toml`: ```toml [[bindings]] type = "g7" binding = "AVATARS" bucket = "avatars" ``` The `binding` name becomes a property on `env` inside the Cell (`env.AVATARS`). See the [g7 API reference](https://docs.tissue.systems/docs/g7/api/) for how to use it. --- ## Automatic bucket creation for FILES bindings When you use a `files` binding, ribo automatically creates a dedicated bucket during `ribo deploy`. You do not need to create it manually: ```toml [[bindings]] type = "files" binding = "ASSETS" dir = "./public" ``` ribo creates a bucket named after your Cell's address and the binding name, then uploads the directory contents. The bucket is owned by your account and persists across redeploys. --- ## See also - [g7 Overview](https://docs.tissue.systems/docs/g7/overview/) - [g7 API reference](https://docs.tissue.systems/docs/g7/api/) - [Static sites](https://docs.tissue.systems/docs/g7/static-sites/) --- # g7: object storage / Static sites Source: https://docs.tissue.systems/docs/g7/static-sites/ # Static sites g7 and the `files` binding let you deploy a directory of static files (HTML, CSS, JavaScript, images, and any other assets) directly to tissue.systems. No Cell code required for the common case. --- ## The static shorthand The simplest way to deploy a static site is the `static` field in `ribo.toml`: ```toml [cell] name = "my-site" static = "./public" ``` That's the entire configuration. `ribo deploy` will: 1. Create a g7 bucket for your files 2. Upload every file in `./public` (recursively) 3. Generate a pass-through Cell that routes all requests through the file tree 4. Deploy it to a live URL ```bash ribo deploy # deployed my-site # address ab1cd2 # url https://my-site.strand-9c.tissue.dev # files FILES→ab1cd2-files (12 files) ``` --- ## Routing behaviour The file-serving layer follows standard static site conventions: | Request path | File served | |------------------|------------------------------------------------------| | `/` | `index.html` | | `/about` | `about` (exact, if exists), then `about/index.html` | | `/css/style.css` | `css/style.css` | | `/missing` | `404.html` (if exists), otherwise a plain 404 | Every path is first tried exactly as requested. If an extension-less path doesn't match a file, `/index.html` is tried as a fallback, enabling clean URLs for multi-page sites. --- ## Directory structure example public/ index.html about/ index.html css/ style.css js/ app.js 404.html Deploy with: ```bash ribo deploy ``` All files are uploaded at deploy time and served from g7. Subsequent `ribo deploy` calls re-upload the full directory, replacing any previously uploaded files. --- ## Hybrid: static files + dynamic logic For sites that need both static assets and a server-side API, use the `files` binding alongside a JS Cell: ```toml [cell] name = "my-app" js = "./cell.js" build = "npm run build" [[bindings]] type = "files" binding = "ASSETS" dir = "./dist" ``` In the Cell, serve static assets for most paths and handle API routes yourself: ```js export default { async fetch(request, env) { const url = new URL(request.url); // API routes if (url.pathname.startsWith("/api/")) { return handleApi(request, env); } // Everything else: static files return env.ASSETS.fetch(request); }, }; ``` `env.ASSETS.fetch(request)` applies the same routing rules as the `static` shorthand: it serves `index.html` for directory paths and returns a 404 for missing files. --- ## Updating files Re-running `ribo deploy` re-uploads the entire directory. The live URL immediately serves the new files. There is no separate "sync" step. --- ## See also - [g7 Overview](https://docs.tissue.systems/docs/g7/overview/) - [g7 API reference](https://docs.tissue.systems/docs/g7/api/): direct object access via `get()`, `put()`, `delete()` - [ribo.toml reference](https://docs.tissue.systems/docs/cells/configuration/): full config schema --- # g7: object storage / API reference Source: https://docs.tissue.systems/docs/g7/api/ # g7 API reference A g7 binding (`env.`) exposes methods for reading and writing objects in a bucket. There are two binding types: **G7Bucket** (declared with `type = "g7"`) and **FilesBucket** (declared with `type = "files"`). --- ## G7Bucket Bound from a `type = "g7"` entry in `ribo.toml`. Use this for arbitrary object storage: uploads, generated assets, cached data, or any binary content. ### get Retrieve an object by key. Returns a plain `Response` whose body streams the object's content, or `null` if the key does not exist. ```js const res = await env.BUCKET.get("images/avatar.png"); if (res === null) { return new Response("Not found", { status: 404 }); } return new Response(res.body, { headers: { "content-type": res.headers.get("content-type") ?? "application/octet-stream", }, }); ``` The return value is a standard `Response`: read the content via `res.body` (a `ReadableStream`) or the usual `res.text()` / `res.arrayBuffer()` / `res.json()` helpers, and read metadata from the response headers: | Header | Description | |------------------|----------------------------------| | `content-type` | MIME type stored with the object | | `content-length` | Size in bytes | | `etag` | Entity tag | ### head Check if an object exists and retrieve its metadata, without downloading the body. Returns a flat `{ contentType, size, etag }` object, or `null` if the key does not exist. ```js const meta = await env.BUCKET.head("reports/2026-05.pdf"); if (meta) { console.log(meta.size, meta.contentType); } ``` ### put Upload an object. The body can be a string, `ArrayBuffer`, `ReadableStream`, or `Blob`. The length of the body has to be known when the upload starts. A string, an `ArrayBuffer` and a `Blob` all carry one; so does a `ReadableStream` taken from a `File` or `Blob`, and a `request.body` whose own request arrived with a `Content-Length`. A stream of unknown length (a `TransformStream` you write into, or a forwarded body that arrived chunked) is rejected with `411 Length Required`; read it into an `ArrayBuffer` first. ```js await env.BUCKET.put("reports/2026-05.pdf", pdfBuffer, { contentType: "application/pdf", }); ``` ```js // From a request body await env.BUCKET.put( "uploads/" + filename, request.body, { contentType: request.headers.get("content-type") } ); ``` **Options:** | Option | Type | Description | |---------------|----------|----------------------------------| | `contentType` | `string` | MIME type stored with the object | ### delete Remove an object by key. Deleting a non-existent key is not an error. ```js await env.BUCKET.delete("uploads/old-file.png"); ``` ### list List objects in the bucket. Returns an object with a `objects` array. ```js const { objects } = await env.BUCKET.list(); for (const obj of objects) { console.log(obj.key, obj.size); } ``` With a prefix filter: ```js const { objects } = await env.BUCKET.list({ prefix: "uploads/2026/" }); ``` **Options:** | Option | Type | Description | |----------|----------|------------------------------------------------| | `prefix` | `string` | Filter keys to those starting with this prefix | | `limit` | `number` | Maximum number of results (default: 1000) | **Returned object shape:** | Property | Type | Description | |----------------|----------|-------------------------| | `key` | `string` | Object key | | `size` | `number` | Size in bytes | | `lastModified` | `string` | Last-modified timestamp | | `etag` | `string` | Entity tag | --- ## FilesBucket Bound from a `type = "files"` entry in `ribo.toml` (or generated automatically by the `static` shorthand). Wraps a g7 bucket and adds path-based serving with index and 404 fallback logic. ### fetch Serve a request from the file tree. Applies static site routing rules. ```js return env.ASSETS.fetch(request); ``` Routing rules: | Request path | File served | |------------------|------------------------------------------------------------| | `/` | `index.html` | | `/about` | `about` (exact), then `about/index.html` (directory index) | | `/css/style.css` | `css/style.css` | | anything missing | `404.html` with status 404, or a plain-text 404 | ### get Retrieve an object by key, returning the raw `Response` (or `null` if not found), just like `G7Bucket.get()`, but without the routing rules that `fetch()` applies. ```js const res = await env.ASSETS.get("css/style.css"); if (res) { return res; } ``` --- ## Common patterns ### Upload from a form ```js if (request.method === "POST" && url.pathname === "/upload") { const form = await request.formData(); const file = form.get("file"); // File object await env.UPLOADS.put(file.name, file.stream(), { contentType: file.type, }); return Response.json({ ok: true, key: file.name }); } ``` ### Proxy with caching headers ```js const res = await env.ASSETS.get("data.json"); if (!res) return new Response("Not found", { status: 404 }); return new Response(res.body, { headers: { "content-type": "application/json", "cache-control": "public, max-age=3600", }, }); ``` ### Delete all objects with a prefix ```js const { objects } = await env.BUCKET.list({ prefix: "temp/" }); for (const obj of objects) { await env.BUCKET.delete(obj.key); } ``` --- ## See also - [g7 Overview](https://docs.tissue.systems/docs/g7/overview/) - [Managing buckets](https://docs.tissue.systems/docs/g7/buckets/) - [Static sites](https://docs.tissue.systems/docs/g7/static-sites/) - [S3 API](https://docs.tissue.systems/docs/g7/s3-api/) - [g7 limitations](https://docs.tissue.systems/docs/g7/limitations/) --- # g7: object storage / S3 API Source: https://docs.tissue.systems/docs/g7/s3-api/ # S3 API g7 buckets speak the S3 API. Point any S3 client at `https://g7.tissue.systems` with a bucket's credentials and it can list, read, write, and delete objects. The AWS CLI, boto3, rclone, and the S3 SDK for your language all work without a plugin or a compatibility layer. This is the access path for everything outside a Cell: CI jobs pushing build artifacts, a laptop pulling backups, a media pipeline that already speaks S3. Inside a Cell, use the [g7 binding](https://docs.tissue.systems/docs/g7/api/) instead. It's faster and needs no credentials. --- ## Endpoint | | | |---|---| | Endpoint URL | `https://g7.tissue.systems` | | Region | `tissue` | | Addressing | Path-style (`https://g7.tissue.systems//`) | | Authentication | AWS Signature Version 4, in request headers or presigned query strings | Every client needs the endpoint URL and the region set explicitly. Most also need path-style addressing; the AWS CLI and boto3 pick it up on their own once `endpoint_url` is set, and the examples below show the setting for clients that do not. --- ## Get credentials for a bucket Each bucket has its own access key. **A key unlocks exactly one bucket.** It can't see or touch anything else in your account, so it's safe to hand a key to a single CI job or a single machine. From the dashboard: open the bucket, then **Show credentials**. From the API, with a token carrying the `buckets:write` scope: ```bash curl -X POST https://api.tissue.systems/v1/buckets/avatars/s3-credentials \ -H "Authorization: Bearer $TISSUE_TOKEN" ``` ```json { "bucket": "avatars", "accessKeyId": "GKa1b2c3d4e5f60718293a4b5c", "secretAccessKey": "…", "region": "tissue", "endpoint": "https://g7.tissue.systems" } ``` The call returns the bucket's existing key rather than minting a new one, so it is safe to run twice. Treat the secret like a password: it can write and delete every object in the bucket. Rotating a key isn't self-serve yet, so [contact support](https://support.tissue.systems) if one leaks. --- ## Install the AWS CLI The examples use **AWS CLI v2**. Version 1 is unmaintained; if `aws --version` reports `aws-cli/1.x`, upgrade. **macOS** ```bash curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg" sudo installer -pkg AWSCLIV2.pkg -target / ``` Or with Homebrew: ```bash brew install awscli ``` **Linux (x86_64)** ```bash curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" unzip awscliv2.zip sudo ./aws/install ``` On ARM machines (a Raspberry Pi, an Ampere or Graviton VM), substitute `awscli-exe-linux-aarch64.zip`. **Windows** ```powershell msiexec.exe /i https://awscliv2.amazonaws.com/AWSCLIV2.msi ``` Confirm the install: ```bash aws --version ``` aws-cli/2.35.7 Python/3.14.6 Darwin/25.5.0 source/arm64 --- ## Configure the AWS CLI **Environment variables** suit CI jobs and throwaway shells: ```bash export AWS_ACCESS_KEY_ID=GKa1b2c3d4e5f60718293a4b5c export AWS_SECRET_ACCESS_KEY=… export AWS_DEFAULT_REGION=tissue export AWS_ENDPOINT_URL=https://g7.tissue.systems aws s3 ls s3://avatars/ ``` **A named profile** suits a workstation you use every day. In `~/.aws/config`: ```ini [profile tissue] region = tissue endpoint_url = https://g7.tissue.systems ``` In `~/.aws/credentials`: ```ini [tissue] aws_access_key_id = GKa1b2c3d4e5f60718293a4b5c aws_secret_access_key = … ``` Then pass `--profile tissue` to any command: ```bash aws --profile tissue s3 ls s3://avatars/ ``` A profile per bucket keeps the one-key-one-bucket boundary visible in the command you type. If you would rather not configure anything, `--endpoint-url` works on every invocation: ```bash aws --endpoint-url https://g7.tissue.systems s3 ls s3://avatars/ ``` --- ## AWS CLI examples The commands below assume `AWS_ENDPOINT_URL` and credentials are already in the environment. **List objects** ```bash aws s3 ls s3://avatars/ aws s3 ls s3://avatars/portraits/ --recursive ``` **Upload and download** ```bash aws s3 cp ./photo.jpg s3://avatars/portraits/alice.jpg aws s3 cp s3://avatars/portraits/alice.jpg ./alice.jpg ``` Objects larger than 8 MB are split into parts and uploaded in parallel automatically, so a multi-gigabyte file is one `cp` like any other. **Set the content type** so browsers render the object instead of downloading it: ```bash aws s3 cp ./index.html s3://site-assets/index.html \ --content-type text/html \ --cache-control "public, max-age=3600" ``` **Sync a directory**, transferring only what changed: ```bash aws s3 sync ./dist s3://site-assets/ --delete aws s3 sync s3://site-assets/ ./restore ``` **Move, copy, and delete** ```bash aws s3 mv s3://avatars/old.jpg s3://avatars/archive/old.jpg aws s3 rm s3://avatars/portraits/alice.jpg aws s3 rm s3://avatars/thumbnails/ --recursive ``` **Presign a URL** so someone without credentials can fetch one object: ```bash aws s3 presign s3://avatars/portraits/alice.jpg --expires-in 3600 ``` **Lower-level calls** through `s3api` when you need the raw response: ```bash aws s3api head-object --bucket avatars --key portraits/alice.jpg aws s3api list-objects-v2 --bucket avatars --prefix portraits/ --max-keys 100 aws s3api get-object --bucket avatars --key video.mp4 --range 'bytes=0-1048575' first-mb.bin ``` --- ## Python Install boto3: ```bash pip install boto3 ``` Build a client once and reuse it: ```python import boto3 from botocore.client import Config s3 = boto3.client( "s3", endpoint_url="https://g7.tissue.systems", region_name="tissue", aws_access_key_id="GKa1b2c3d4e5f60718293a4b5c", aws_secret_access_key="…", config=Config(s3={"addressing_style": "path"}), ) ``` `addressing_style` is explicit here because a client that falls back to virtual-host style would try to resolve `avatars.g7.tissue.systems`, which does not exist. **Write and read an object** ```python s3.put_object( Bucket="avatars", Key="portraits/alice.jpg", Body=open("photo.jpg", "rb"), ContentType="image/jpeg", ) obj = s3.get_object(Bucket="avatars", Key="portraits/alice.jpg") data = obj["Body"].read() ``` **Upload and download files**, with parts and retries handled for you: ```python s3.upload_file("backup.tar.gz", "backups", "2026-08-09/backup.tar.gz") s3.download_file("backups", "2026-08-09/backup.tar.gz", "restore.tar.gz") ``` **List every object**, paginating past the 1000-key response limit: ```python paginator = s3.get_paginator("list_objects_v2") for page in paginator.paginate(Bucket="avatars", Prefix="portraits/"): for obj in page.get("Contents", []): print(obj["Key"], obj["Size"]) ``` **Presign a URL** for a browser upload or a one-off download: ```python download = s3.generate_presigned_url( "get_object", Params={"Bucket": "avatars", "Key": "portraits/alice.jpg"}, ExpiresIn=3600, ) upload = s3.generate_presigned_url( "put_object", Params={"Bucket": "avatars", "Key": "incoming/photo.jpg"}, ExpiresIn=900, ) ``` A presigned URL carries its own signature, so the holder needs no credentials and no S3 client. A plain `PUT` or `GET` is enough. It stops working when it expires. A download link you presign against `g7.tissue.systems` answers with a redirect to a fresh link for the same object on `g7.tissue.dev`, carrying whatever time the original had left. Downloads are served from the domain your Cells use, so an uploaded file never runs as a page on `tissue.systems`. Upload links aren't redirected and work on `g7.tissue.systems` as signed. **Copy and delete** ```python s3.copy_object( Bucket="avatars", Key="archive/alice.jpg", CopySource="avatars/portraits/alice.jpg", ) s3.delete_object(Bucket="avatars", Key="portraits/alice.jpg") ``` --- ## Other S3 clients **rclone**: add a remote to `~/.config/rclone/rclone.conf`: ```ini [tissue] type = s3 provider = Other endpoint = https://g7.tissue.systems region = tissue force_path_style = true access_key_id = GKa1b2c3d4e5f60718293a4b5c secret_access_key = … ``` ```bash rclone copy ./dist tissue:site-assets/ rclone sync tissue:backups/ ./restore ``` Any other client needs the same four things: the endpoint URL, region `tissue`, path-style addressing, and the bucket's key pair. --- ## How this differs from Amazon S3 **A key names its bucket.** The bucket segment in a request URL is not what selects the bucket; the access key is. Two consequences: - `aws s3 ls` with no bucket returns nothing. There is no ListBuckets operation, because a key can only ever see one bucket. - Typing the wrong bucket name does not fail; the request lands on the key's own bucket. A key cannot reach another bucket by any spelling, so this is a boundary rather than a leak, but a typo in a script is silent. **Path-style addressing only.** `https://g7.tissue.systems//`. Virtual-host style (`.g7.tissue.systems`) does not resolve. **The region is `tissue`.** It is part of the signature, so a client configured for `us-east-1` will sign against the wrong scope with some SDKs. **Signatures expire in 15 minutes.** A request signed more than 15 minutes away from server time is rejected. If everything returns 403 on a machine that worked yesterday, check its clock first. **100 MiB per request.** A single `PUT` is capped at 100 MiB. Larger objects go up as multipart uploads, where the cap applies per part rather than to the object. The AWS CLI and boto3 do this for you above 8 MB, and there is no ceiling on the finished object. **Bucket-level configuration is not implemented.** Versioning, tagging, and object ACLs return `NotImplemented`. Bucket visibility is a g7 setting rather than an S3 ACL: `ribo bucket set --public` or `--private`, described in [Managing buckets](https://docs.tissue.systems/docs/g7/buckets/). --- ## See also - [Managing buckets](https://docs.tissue.systems/docs/g7/buckets/): creating buckets, `ribo` file transfer, public access - [g7 API reference](https://docs.tissue.systems/docs/g7/api/): the binding API for use inside a Cell - [g7 limitations](https://docs.tissue.systems/docs/g7/limitations/): what g7 does not do --- # g7: object storage / Limitations Source: https://docs.tissue.systems/docs/g7/limitations/ # g7 limitations These are the current boundaries of what g7 can do. --- The limits below describe the g7 binding and the management API. The [S3 API](https://docs.tissue.systems/docs/g7/s3-api/) reaches the same buckets through a different path and lifts several of them. Where it does, it's called out. --- ## Upload size **100 MiB per PUT.** A single `put()` call (or `PUT` through the management proxy) cannot exceed 100 MiB. Over the S3 API the cap applies per multipart part rather than per object, so objects of any size upload as long as each part stays under 100 MiB. The AWS CLI and boto3 split large files into parts on their own. **Every upload declares its length.** A `PUT` carries either a `Content-Length` or, for an `aws-chunked` streaming upload, an `x-amz-decoded-content-length`. A request with neither is answered `411 Length Required`. The AWS CLI, boto3 and a browser `fetch()` of a `File` or `Blob` all send one; a hand-rolled chunked upload (`curl -T -`) does not. --- ## Unsupported features **No multipart upload.** Through the binding, objects must be uploaded in a single request; chunked or resumable uploads are not available. The S3 API does support multipart uploads. **No conditional writes.** There is no `If-None-Match` or `If-Match` semantics on `put()`. Last write wins. **No object versioning.** Overwriting an existing key replaces it permanently. There is no version history or soft-delete. **No list delimiter.** `list()` does not support a `delimiter` parameter for simulating a directory hierarchy. Use prefix filtering and parse paths in application code. **No custom metadata.** Through the binding, objects store a content type (the `contentType` option on `put()`) but no arbitrary key-value metadata and no stored `Cache-Control`; set caching headers when you serve the object. The S3 API stores `Cache-Control`, `Content-Disposition`, and `x-amz-meta-*` headers with the object. **No server-side copy.** The binding has no copy or move operation; to copy an object, read it and write it under the new key. The S3 API supports `CopyObject` within a bucket. **No bucket-level configuration.** Versioning, tagging, and object ACLs are not implemented, over either access path. --- ## Access **Buckets are private by default.** A Cell binding is the primary access path, but it is not the only one. For access from outside a Cell, three mechanisms exist: - **Public-read buckets**: `ribo bucket create --public` (or `ribo bucket set --public`) allows anonymous `GET`/`HEAD` on a bucket's objects. Listing and writes are never public. - **Pre-signed URLs**: short-lived signed URLs for a single upload or download, minted via the management API (`POST /v1/buckets/:bucket/presign`). - **S3 API**: `https://g7.tissue.systems` accepts SigV4-signed requests with per-bucket credentials, so external tools and standard S3 clients can read and write directly. See [Managing buckets](https://docs.tissue.systems/docs/g7/buckets/) and the [S3 API](https://docs.tissue.systems/docs/g7/s3-api/) for details. --- ## See also - [g7 Overview](https://docs.tissue.systems/docs/g7/overview/) - [g7 API reference](https://docs.tissue.systems/docs/g7/api/) - [S3 API](https://docs.tissue.systems/docs/g7/s3-api/) - [Cell limitations](https://docs.tissue.systems/docs/cells/limitations/) --- # Pulse: scheduled jobs / Overview Source: https://docs.tissue.systems/docs/pulse/overview/ # Pulse: scheduled Cell invocations **Pulse** lets a Cell run on a recurring schedule without any incoming HTTP request. Declare one or more cron schedules in `ribo.toml` and export a `pulse` handler from your Cell. The platform fires the handler at each scheduled time. The name fits the tissue metaphor: a pulse is the periodic signal that keeps a system alive between external stimuli. --- ## Declaring a schedule Add one or more `[[pulse]]` blocks to `ribo.toml`: ```toml [cell] name = "my-cell" js = "./cell.js" [[pulse]] schedule = "0 * * * *" # every hour at :00 [[pulse]] schedule = "*/15 * * * *" # every 15 minutes ``` Multiple `[[pulse]]` blocks are allowed. Each fires independently on its own schedule. Cron syntax is standard 5-field POSIX (`min hour dom month dow`). All times are UTC. `ribo deploy` checks every schedule's shape before uploading, and the platform re-checks it on the way in: an expression the scheduler can't parse (an hour of `25`, a field the wrong shape, a day-of-month the month field never reaches) fails the deploy with a `400` naming the expression, and no part of the Cell is published. A Cell may declare at most **25** schedules. One field departs from `crontab(5)`: day-of-week counts from **1 = Sunday** through 7 = Saturday, so `0` is not a day and Monday is `2`. --- ## The pulse handler Export a `pulse` function from your Cell module alongside `fetch`: ```js export default { async fetch(request, env) { return new Response("ok"); }, async pulse(event, env) { // event.scheduledTime = Date the pulse was dispatched (within ~30s after the cron slot) // event.cron = the cron expression that triggered this pulse console.log(`pulse fired at ${event.scheduledTime.toISOString()} (${event.cron})`); await doPeriodicWork(env); }, }; ``` The `pulse` export is optional. A Cell without it silently ignores any `[[pulse]]` schedules declared in `ribo.toml`. The `env` argument is identical to the one passed to `fetch`; all declared bindings (c3, g7, text) are fully available. --- ## Cron schedule reference 5-field POSIX cron: `min hour dom month dow` | Field | Range | Examples | |---------|-------------|-------------------------------------------------------------------| | `min` | 0–59 | `0` (top of hour), `*/15` (every 15 min), `5,35` (at :05 and :35) | | `hour` | 0–23 | `9` (9am UTC), `0,12` (midnight and noon) | | `dom` | 1–31 | `1` (1st of month), `*/7` (every 7 days) | | `month` | 1–12 | `*` (every month), `1,7` (January and July) | | `dow` | 1–7 (Sun=1) | `2-6` (Monday to Friday), `2` (Mondays), `1,7` (weekends) | A `0` in the day-of-week field is refused at deploy. The count starts at Sunday, so `1-5` is Sunday through Thursday and Monday to Friday is written `2-6`. The month and day-of-week fields also take names, case-insensitively: `jan`…`dec` or `january`…`december`, and `sun`…`sat` or `sunday`…`saturday` (`tue` and `thu` also accept `tues` and `thurs`). A name stands where a number would, as in `0 0 * * mon-fri` and `0 0 * jan,jul *`, but a bare name takes no step, so write `mon-fri/2` rather than `mon/2`, and both ends of a range must be written the same way. In the day-of-month and day-of-week fields, `?` means the same as `*`. Everything else is refused at deploy with a message naming the field: no `@hourly`-style shorthand, no `L`, no `1#2`. ### Common schedule examples * * * * * every minute */5 * * * * every 5 minutes 0 * * * * every hour 0 0 * * * daily at midnight UTC 0 9 * * 2-6 9am UTC Monday through Friday 0 0 1 * * 1st of every month at midnight 30 6 * * * 6:30am UTC daily --- ## How delivery works The tissue scheduler polls for due pulse schedules every 30 seconds and dispatches them as internal HTTP events to the Cell runtime. The platform coordinates across servers so each slot fires exactly once. Pulses are **best-effort**: if the Cell is unavailable or throws an unhandled exception when a pulse fires, the event is not retried. The next scheduled tick fires normally. **Granularity**: The minimum cron interval is 1 minute. Pulses fire within ~30 seconds of the scheduled time. **All schedules are UTC.** There is no timezone support in cron expressions. --- ## Handling multiple schedules When a Cell has more than one `[[pulse]]` block, use `event.cron` to distinguish between them: ```js export default { async pulse(event, env) { switch (event.cron) { case "* * * * *": await runMinuteTasks(env); break; case "0 * * * *": await runHourlyReport(env); break; case "0 0 * * *": await runDailyCleanup(env); break; } }, }; ``` --- ## Deploy output When you deploy a Cell with pulse schedules, `ribo deploy` confirms the registered schedules: deployed my-cell address ab1cd2 kind js url https://my-cell.strand-9c.tissue.dev pulse 0 * * * *, */15 * * * * --- ## Pulse with c3 for reliable work tracking Because pulses are best-effort and not retried on failure, use c3 to record work items and detect missed ticks if your use case requires reliability: ```js const SCHEMA = ` CREATE TABLE IF NOT EXISTS pulse_log ( id INTEGER PRIMARY KEY AUTOINCREMENT, scheduled_at TEXT NOT NULL, cron TEXT NOT NULL, completed_at TEXT, error TEXT ) `; export default { async pulse(event, env) { await env.DB.exec(SCHEMA); // Record that this tick started const { meta } = await env.DB.prepare( "INSERT INTO pulse_log (scheduled_at, cron) VALUES (?, ?)" ).bind(event.scheduledTime.toISOString(), event.cron).run(); const logId = meta.last_insert_rowid; try { await doWork(env); await env.DB.prepare( "UPDATE pulse_log SET completed_at = datetime('now') WHERE id = ?" ).bind(logId).run(); } catch (err) { await env.DB.prepare( "UPDATE pulse_log SET error = ? WHERE id = ?" ).bind(err.message, logId).run(); } }, }; ``` --- ## Example: heartbeat log A Cell that records every pulse tick to a c3 database and renders the log as JSON. **ribo.toml** ```toml [cell] name = "heartbeat" js = "./cell.js" [[pulse]] schedule = "* * * * *" # every minute [[bindings]] type = "c3" binding = "DB" database = "heartbeats" ``` **cell.js** ```js const SCHEMA = ` CREATE TABLE IF NOT EXISTS heartbeats ( id INTEGER PRIMARY KEY AUTOINCREMENT, scheduled_at TEXT NOT NULL, cron TEXT NOT NULL, recorded_at TEXT NOT NULL ) `; export default { async pulse(event, env) { await env.DB.exec(SCHEMA); await env.DB.prepare( "INSERT INTO heartbeats (scheduled_at, cron, recorded_at) VALUES (?, ?, ?)" ).bind(event.scheduledTime.toISOString(), event.cron, new Date().toISOString()).run(); // Trim old rows to keep the table small await env.DB.exec( "DELETE FROM heartbeats WHERE id NOT IN (SELECT id FROM heartbeats ORDER BY id DESC LIMIT 200)" ); }, async fetch(request, env) { await env.DB.exec(SCHEMA); const { results } = await env.DB.prepare( "SELECT * FROM heartbeats ORDER BY id DESC LIMIT 50" ).all(); return Response.json(results); }, }; ``` --- ## Example: daily digest email A Cell that queries c3 at 8am UTC every day and sends an email summary via an external API. ```toml [[pulse]] schedule = "0 8 * * *" # 8am UTC daily [[bindings]] type = "c3" binding = "DB" database = "app" [[bindings]] type = "text" binding = "SENDGRID_KEY" value = "SG...." ``` ```js export default { async pulse(event, env) { const { results } = await env.DB.prepare(` SELECT COUNT(*) as signups FROM users WHERE created_at >= datetime('now', '-1 day') `).all(); const body = { personalizations: [{ to: [{ email: "you@example.com" }] }], from: { email: "noreply@yourapp.com" }, subject: `Daily digest for ${event.scheduledTime.toDateString()}`, content: [{ type: "text/plain", value: `New signups yesterday: ${results[0].signups}` }], }; await fetch("https://api.sendgrid.com/v3/mail/send", { method: "POST", headers: { "content-type": "application/json", authorization: `Bearer ${env.SENDGRID_KEY}`, }, body: JSON.stringify(body), }); }, }; ``` --- ## Example: periodic cleanup Remove old rows on a daily schedule to keep tables compact. ```toml [[pulse]] schedule = "0 2 * * *" # 2am UTC daily ``` ```js export default { async pulse(event, env) { const cutoff = new Date(Date.now() - 30 * 24 * 60 * 60 * 1000).toISOString(); const { meta } = await env.DB.prepare( "DELETE FROM events WHERE created_at < ?" ).bind(cutoff).run(); console.log(`Deleted ${meta.rows_affected} old events`); }, }; ``` --- ## See also - [Pulse API reference](https://docs.tissue.systems/docs/pulse/api/): event object properties and handler details - [ribo.toml reference](https://docs.tissue.systems/docs/cells/configuration/): full `[[pulse]]` schema - [c3 Overview](https://docs.tissue.systems/docs/c3/overview/): structured data for Cells --- # Pulse: scheduled jobs / API reference Source: https://docs.tissue.systems/docs/pulse/api/ # Pulse API reference --- ## Handler signature ```js export default { async pulse(event, env) { // ... }, }; ``` The `pulse` export is optional. If present, it is called for every scheduled tick. If absent, the Cell silently ignores any pulse schedules declared in `ribo.toml`. --- ## The event object | Property | Type | Description | |----|----|----| | `event.scheduledTime` | `Date` | When the pulse was dispatched (UTC). The scheduler polls every 30 seconds, so this is up to ~30 s after the exact cron slot, so don't compare it to the cron boundary for equality; truncate/round down if you need the slot. | | `event.cron` | `string` | The cron expression that triggered this pulse (e.g. `"0 * * * *"`). Useful when a Cell has multiple `[[pulse]]` schedules and needs to distinguish between them. | --- ## The env object `env` is identical to the `env` passed to `fetch`. All bindings declared in `ribo.toml` (c3 databases, g7 buckets, text values) are available in the pulse handler. ```js async pulse(event, env) { // c3: reads and writes work exactly as in fetch const { results } = await env.DB.prepare("SELECT COUNT(*) as n FROM jobs").all(); // g7: object storage is fully accessible await env.BUCKET.put("report.txt", buildReport(results)); // outbound fetch: unrestricted await fetch("https://hooks.example.com/notify", { method: "POST", body: JSON.stringify({ fired: event.scheduledTime }), }); } ``` --- ## Return value The return value of `pulse` is ignored. There is no HTTP response to produce. The function can return `void`, `undefined`, or a `Promise` of either. Unhandled exceptions are logged by the platform and do not affect subsequent pulse firings. --- ## Distinguishing multiple schedules If your Cell has more than one `[[pulse]]` block, use `event.cron` to branch: ```js async pulse(event, env) { switch (event.cron) { case "* * * * *": await runMinuteTask(env); break; case "0 * * * *": await runHourlyTask(env); break; case "0 0 * * *": await runDailyTask(env); break; } } ``` --- ## Common patterns ### Periodic cleanup ```js async pulse(event, env) { const cutoff = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString(); await env.DB.prepare("DELETE FROM events WHERE created_at < ?").bind(cutoff).run(); } ``` ### Aggregate and report ```js async pulse(event, env) { const { results } = await env.DB.prepare( "SELECT COUNT(*) as total FROM orders WHERE created_at > datetime('now', '-1 hour')" ).all(); const count = results[0]?.total ?? 0; await fetch("https://monitoring.example.com/metric", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ metric: "orders_per_hour", value: count, ts: event.scheduledTime }), }); } ``` ### Sync from an external API ```js async pulse(event, env) { const res = await fetch("https://api.example.com/data"); const items = await res.json(); for (const item of items) { await env.DB.prepare( "INSERT OR REPLACE INTO items (id, name, updated_at) VALUES (?, ?, ?)" ).bind(item.id, item.name, new Date().toISOString()).run(); } } ``` --- ## Limitations **Best-effort delivery.** If the Cell is unavailable or throws an unhandled error during a pulse, the event is not retried. Use c3 to record state and detect missed ticks if your use case requires reliability. **Minimum interval: 1 minute.** Cron expressions with sub-minute intervals are not supported. **UTC only.** All cron schedules are evaluated in UTC. There is no timezone support. **No `waitUntil`.** The `ctx` argument is not passed to `pulse`. Long-running work must complete before the handler returns (or await it inline). --- ## See also - [Pulse overview](https://docs.tissue.systems/docs/pulse/overview/) - [ribo.toml reference](https://docs.tissue.systems/docs/cells/configuration/): `[[pulse]]` declaration - [c3 API reference](https://docs.tissue.systems/docs/c3/api/): structured data in Cells - [g7 API reference](https://docs.tissue.systems/docs/g7/api/): object storage in Cells --- # Vesicle: webhook inbox / Overview Source: https://docs.tissue.systems/docs/vesicle/overview/ # Vesicle: webhook inbox A vesicle endpoint is a URL that accepts HTTP deliveries and stores them under your account. It exists independently of your Cells: you can create one, give it to a vendor, and read what arrives before writing any code. Binding it to a Cell and a path makes it deliver; until then it captures. Endpoints are account-scoped. The URL is a write capability: holding it lets a sender deliver, and nothing else. Reading captures requires your session or an API token carrying `vesicle:read`. The name fits the tissue metaphor: a vesicle is the membrane-bound package a cell uses to hold ingested material until it is processed. --- ## Creating an endpoint ```console $ ribo vesicle endpoint create github https://api.tissue.systems/hook/hk_9f3c8a1b... (capture only — no route bound) ``` An endpoint id is `hk_` followed by 32 lowercase hex characters, and the ingest URL is that id under `https://api.tissue.systems/hook/`. The endpoint answers from the moment it is created. No Cell has to exist, and nothing has to be deployed. Ingest accepts any HTTP method and records it. There is no authentication on the URL itself. The id **is** the credential, so treat it the way you treat a password and [rotate it](#rotating-and-revoking) if it turns up somewhere you did not put it. A path suffix is kept: a delivery to `/hook/hk_9f3c…/orders/created` records the path `/orders/created`, and once the endpoint is bound that suffix is appended to the bound route. Create it with a binding already in place if the Cell exists: ```bash ribo vesicle endpoint create github --cell deploy-bot --route /github ``` From the API, `POST /v1/vesicle/endpoints` (scope `vesicle:write`) takes the same fields: ```bash curl -X POST https://api.tissue.systems/v1/vesicle/endpoints \ -H "Authorization: Bearer $TISSUE_TOKEN" -H "Content-Type: application/json" \ -d '{"name": "github"}' ``` ```json { "id": "hk_9f3c8a1b4e7d2c6058a1b3d5f7092e4c", "name": "github", "url": "https://api.tissue.systems/hook/hk_9f3c8a1b4e7d2c6058a1b3d5f7092e4c", "cell": null, "cell_address": null, "route": null, "verify": "none", "ack": "immediate", "retries": 8, "created_at": "2026-08-11T17:04:02Z", "rotated_from": null, "grace_until": null, "revoked_at": null, "captures": { "captured": 0, "delivered": 0, "retrying": 0, "rejected": 0, "dead": 0 } } ``` In the dashboard, the **Webhooks** section lists every endpoint with its ingest URL and a copy button, which is the practical way to get 32 hex characters into a vendor's settings screen. An AI assistant connected over [MCP](https://docs.tissue.systems/docs/mcp/overview/) uses `vesicle_endpoint_create`. ### What the sender sees | Case | Response | |---|---| | Captured, endpoint unbound or `ack = "immediate"` | `202 {"ok":true,"id":"cap_…","state":"captured"}` | | Bound and `ack = "on-success"` | your Cell's response verbatim: status, content-type, body | | Unknown, revoked, or past its rotation grace window | `404 {"error":{"code":"not_found","message":"No such endpoint."}}` | | Body over 64 KiB | `413 {"error":{"code":"payload_too_large",…}}` | | Over the per-endpoint rate limit | `429` | | `verify` is configured and the signature fails | `401`, and nothing is stored | --- ## Reading what arrived `ribo vesicle tail` follows an endpoint and prints deliveries as they land: ```console $ ribo vesicle tail github POST · 8437 bytes · content-type: application/json { "action": "opened", "issue": { "number": 412, "title": "..." }, "repository": {...} } ``` That is the request as the vendor sent it, which is frequently not the shape their documentation describes. List and inspect stored captures afterwards: ```bash ribo vesicle list github # newest first ribo vesicle list github --state dead --since 2026-08-10 ribo vesicle show cap_7b21 # headers and body, redacted by default ribo vesicle show cap_7b21 > test/fixtures/issue-opened.json ``` `ribo vesicle show` writes JSON to stdout, so a shell redirect turns a real delivery into a test fixture, in place of one written by hand from a doc. The same two reads over the API are `GET /v1/vesicle/endpoints/{id}/captures` (a list, never carrying bodies) and `GET /v1/vesicle/captures/{cid}` (one capture verbatim). A list row: ```json { "id": "cap_7b21f4a90c3e5d81b6a2c4e0", "endpoint_id": "hk_9f3c8a1b4e7d2c6058a1b3d5f7092e4c", "received_at": "2026-08-11T17:05:41Z", "method": "POST", "path": "/", "size": 8437, "content_type": "application/json", "source_ip": "203.0.113.9", "verify": "none", "state": "captured", "attempts": 0, "last_status": 0, "next_attempt_at": null } ``` The detail form adds the request itself: ```json { "headers": { "content-type": "application/json", "authorization": "«redacted»" }, "body": "{\"action\":\"opened\",\"issue\":{…}}", "body_encoding": "utf8", "redacted": true, "attempts_log": [{ "at": "2026-08-11T17:05:41Z", "status": 502, "error": null }] } ``` `body_encoding` is `utf8` for text and `base64` for anything that is not valid UTF-8, so a binary payload survives the round trip. In the dashboard the endpoint detail page is a capture timeline: each row expands to the verbatim request, with per-capture actions for replay, drop, and copy as `curl`. --- ## Binding to a Cell Binding sets the Cell and the path a capture is delivered to: ```bash ribo vesicle endpoint bind github --cell deploy-bot --route /github ribo vesicle endpoint unbind github # back to capture-only ``` The Cell has to exist in your account before you can bind to it: a name that does not resolve is answered `404` and the bind is refused. A mistyped name would otherwise look healthy and dead-letter every delivery, which is the failure this feature exists to prevent. So the order is create the endpoint, hand out the URL, write and deploy the Cell, then bind. The endpoint captures throughout. **Binding does not backfill.** Deliveries captured while the endpoint was unbound stay in the `captured` state and are never dispatched on their own. Writing a handler is a code event, not a business event, and three weeks of a vendor's stored deliveries firing the instant a route appears is rarely what anyone wants. Those captures reach the Cell only through an explicit [replay](#replaying-a-delivery), one at a time or as a range. An endpoint that is collecting captures with no route bound is a real failure mode: the sender gets a `202` for every delivery, so the vendor's dashboard reads *published* while nothing has reached your code. The Webhooks page shows a standing warning on any unbound endpoint that has captures, for exactly that reason. --- ## What a Cell receives A dispatch is the captured request, reissued at the bound Cell. The method, body and content-type are verbatim; the path is the endpoint's `route` plus any captured suffix. Captured request headers are forwarded except hop-by-hop headers and `host`, and the platform adds four of its own: | Header | Value | |---|---| | `x-tissue-event` | `vesicle`, the same slot [pulse](https://docs.tissue.systems/docs/pulse/overview/) and [synapse](https://docs.tissue.systems/docs/synapse/overview/) use | | `x-tissue-vesicle-endpoint` | the endpoint's name, e.g. `github` | | `x-tissue-vesicle-id` | the capture id, e.g. `cap_7b21…`, stable across every retry and replay of that delivery | | `x-tissue-vesicle-attempt` | attempt number, starting at `1` | Any `x-tissue-*` header the sender supplied is **stripped** before dispatch, so a caller cannot forge a platform header and your Cell can trust these four without checking anything. A complete handler for the endpoint bound above: ```toml [cell] name = "deploy-bot" js = "./cell.js" [[bindings]] type = "c3" binding = "DB" database = "events" ``` ```js const SCHEMA = ` CREATE TABLE IF NOT EXISTS events ( capture_id TEXT PRIMARY KEY, endpoint TEXT NOT NULL, event TEXT, repo TEXT, action TEXT, stored_at TEXT NOT NULL ) `; export default { async fetch(request, env) { if (request.headers.get("x-tissue-event") !== "vesicle") { return new Response("not found", { status: 404 }); } const endpoint = request.headers.get("x-tissue-vesicle-endpoint"); const captureId = request.headers.get("x-tissue-vesicle-id"); const attempt = Number(request.headers.get("x-tissue-vesicle-attempt") ?? "1"); // The sender's own headers are forwarded, so GitHub's event type arrives too. const event = request.headers.get("x-github-event"); let payload; try { payload = await request.json(); } catch { // A 4xx is permanent: the delivery is marked rejected and never retried. return Response.json({ error: "expected JSON" }, { status: 400 }); } await env.DB.exec(SCHEMA); // The capture id is stable across retries and replays, so keying on it makes // a repeated delivery overwrite its own row instead of adding a second one. await env.DB.prepare( `INSERT OR REPLACE INTO events (capture_id, endpoint, event, repo, action, stored_at) VALUES (?, ?, ?, ?, ?, ?)` ).bind(captureId, endpoint, event ?? "", payload.repository?.full_name ?? "", payload.action ?? "", new Date().toISOString()).run(); return Response.json({ stored: captureId, attempt }, { status: 200 }); }, }; ``` The delivery arrives on the bound route, so a Cell with its own router handles it like any other `POST /github` and reads the four headers where it needs them. Deliveries are **at-least-once and unordered**. A retry, a replay, or a sender that posts the same event twice all reach the handler again, and two captures that arrive seconds apart can be delivered out of order. `x-tissue-vesicle-id` is the key to write against when that matters. --- ## Delivery, retries and dead-letter Every capture has a state, and the state is what the Webhooks page, `ribo vesicle list` and the API all report: | State | Meaning | |---|---| | `captured` | stored, no route bound; waiting for a replay | | `delivered` | the Cell answered 2xx or 3xx | | `retrying` | the Cell answered 5xx, timed out, or could not be reached; another attempt is scheduled | | `rejected` | the Cell answered 4xx. Permanent, never retried | | `dead` | retries exhausted | **A 4xx is never retried.** A handler that rejects a payload will reject it identically in an hour, so the delivery lands as `rejected` and waits for you. It still shows in the dead-letter view, because a handler rejecting a whole day of a vendor's deliveries is the most common way an integration fails and a dead-letter view that hid it would be useless. A 5xx, a timeout, or a connection failure retries on a fixed backoff: **1m, 5m, 30m, 2h, 6h, 12h, 24h, 24h**, then the capture goes `dead`. Nothing has to be configured for that to happen, and the schedule is long enough to cover a redeploy or an outage that runs for hours. To cut it short for one endpoint, `ribo vesicle endpoint set --retries ` keeps the first `n` steps; `0` turns redelivery off. `ack` decides what the sender is told and when: | `ack` | Behaviour | |---|---| | `immediate` | the sender gets `202` as soon as the delivery is stored, and dispatch happens after. Use it for senders with tight timeouts | | `on-success` | the sender gets your Cell's response verbatim. The semantics a webhook sender expects, with durability added underneath | An unbound endpoint always answers `202`, whatever `ack` says, because there is nothing to run yet. --- ## Replaying a delivery Replay is redelivery: the stored request is POSTed at a live Cell again. It is the way a `captured`, `rejected`, or `dead` delivery reaches a handler that is finally ready for it. ```bash ribo vesicle replay cap_7b21 # one, prints the Cell's response ribo vesicle replay github --all --since 2026-08-11 # a range ribo vesicle replay github --all --since 2026-08-11 --dry-run ``` A single replay returns what the handler did (status, headers, body, and how long it took), so you can read the result without going to look for a log: ```json { "capture_id": "cap_7b21f4a90c3e5d81b6a2c4e0", "dispatched": true, "status": 201, "headers": { "content-type": "application/json" }, "body": "{\"stored\":\"cap_7b21f4a90c3e5d81b6a2c4e0\",\"attempt\":1}", "duration_ms": 42 } ``` `--dry-run` reports what a range would send and dispatches nothing. Run it first on any range large enough that you would not want to be wrong about it. ### Replaying at a Cell on your own machine ```bash ribo vesicle replay cap_7b21 --to http://localhost:8080/26e9871aq7x2k/github ``` `--to` runs **from your machine**. ribo fetches the capture over `/v1` and performs the POST itself, so the target can be a runtime on `localhost` with no tunnel and no public URL pointed at your laptop. The platform never posts to a URL you name. Doing this server-side would mean an authenticated account could aim the platform's own network at an arbitrary address, which is a request-forgery primitive, and no convenience is worth shipping one. `--to` implies `--reveal` (a redacted signature header would not verify at the far end) and therefore writes the same audit event a reveal does. --- ## Verifying signatures Set `verify` and the signature is checked before anything is stored: | Value | Checks | |---|---| | `none` | nothing (default) | | `hmac:KEY` | a generic HMAC signature header | | `stripe:KEY` | Stripe's signing scheme | | `github:KEY` | GitHub's `x-hub-signature-256` | `KEY` is the name of a [vault binding](https://docs.tissue.systems/docs/cells/configuration/) on the Cell the endpoint is bound to. The secret stays in the vault and is never handed to your code, so a handler, including one an assistant wrote for you, never touches the signing key. ```bash ribo vault set deploy-bot GITHUB_WEBHOOK_SECRET # set the value first ribo deploy # then deploy the Cell that declares it ribo vesicle endpoint create github --cell deploy-bot --route /github \ --verify github:GITHUB_WEBHOOK_SECRET ``` To add or change the check on an endpoint you already have, use `set`. The URL doesn't change, so there's nothing to update on the vendor's side: ```bash ribo vesicle endpoint set github --verify github:GITHUB_WEBHOOK_SECRET ``` **Set the vault value before the deploy.** A `vault` binding whose value is missing at deploy time stores a literal placeholder, and the Cell then uses that placeholder string as the secret. Verification fails against every real delivery and nothing about the failure looks like a missing secret. Full detail in [ribo.toml reference](https://docs.tissue.systems/docs/cells/configuration/) and [`ribo vault`](https://docs.tissue.systems/docs/ribo/reference/#ribo-vault). A delivery whose signature does not verify is answered `401` and **is not stored**. It does not appear anywhere in the dashboard, because it never became a capture. --- ## Redaction A capture is a third party's raw HTTP request, which routinely means it carries credentials: the bearer token you gave the vendor, or an API key sitting in the body. Every read surface redacts by default. A name is masked when it is `authorization`, `x-api-key`, `cookie` or `set-cookie`, or when any word in it (splitting on `-` and `_`) is `signature`, `signatures`, `token`, `secret` or `password`. Matching whole words rather than suffixes is what catches GitHub's `x-hub-signature-256`, where the algorithm suffix sits after the word. The same rule applies to JSON body keys, so `access_token` and `client_secret` are masked too: ```console $ ribo vesicle show cap_7b21 { "headers": { "content-type": "application/json", "x-hub-signature-256": "«redacted»" }, "redacted": true, ... } ``` Revealing is explicit: `--reveal` on the CLI, `?reveal=true` on the API, `include_secrets: true` over MCP. Any of them returns the values intact, sets `"redacted": false`, and writes an `audit_events` row with the action `vesicle.capture.reveal`, so a reveal is always attributable afterwards. **Take particular care with a reveal over MCP.** An unredacted capture goes straight into the model's context, and from there into the conversation history and the model provider's logs. If you need the real value of a credential, read it in your terminal, and rotate it at the vendor if it has been anywhere it should not have been. --- ## Limits and retention | Limit | Value | |---|---| | Body size | 64 KiB. A larger delivery is answered `413` and is not stored | | Ingest rate | a per-endpoint rate limit; over it the sender gets `429` | | Retention | 30 days from receipt, delivered or not | Stored captures count against the owning account's storage quota. Delete one early with `ribo vesicle drop cap_7b21` (or `DELETE /v1/vesicle/captures/{cid}`, scope `vesicle:delete`). --- ## Rotating and revoking An endpoint id travels in a URL that vendors log and paste into support tickets, so treat it as a bearer credential and rotate it once it has been somewhere public. ```bash ribo vesicle endpoint rotate github # new hk_, old one keeps working briefly ribo vesicle endpoint revoke github # stop answering ``` Rotation issues a new `hk_` id and keeps the old one capturing for a grace window of **7 days**, with a warning recorded on every capture that still arrives on it. After the window the old id answers `404`. The grace exists because a rotation the vendor has not applied yet would otherwise drop live events on the floor; use the window to update the vendor's settings, then check that captures have moved to the new id. Revoking stops the URL immediately. Captures already stored survive to their normal 30-day retention, so revoking an endpoint does not destroy the record of what it received. --- ## Scopes Three scopes gate the API, and they behave like every other [scope](https://docs.tissue.systems/docs/api/): | Scope | Allows | |---|---| | `vesicle:read` | list endpoints, list captures, read a capture (including a reveal) | | `vesicle:write` | create, bind, rebind, unbind, rotate, replay | | `vesicle:delete` | revoke an endpoint, drop a capture | A JWT session (`ribo login` or the dashboard) holds every scope implicitly. A `tok_` API token carries an explicit allow-list, so an integration or an agent can be given `vesicle:read` alone and can then inspect everything an endpoint received while changing nothing: ```bash ribo token create "webhook-reader" --scope vesicle:read ``` Ingest carries no scope at all. `POST /hook/hk_…` is not a `/v1` route, takes no `Authorization` header, and the only thing it can do is deliver. --- ## A complete integration An endpoint's first job is finding out what a sender actually sends. This is the whole sequence, from an empty directory to a handler with the vendor's real deliveries behind it. **1. Create the endpoint.** There is no Cell yet. ```console $ ribo vesicle endpoint create github https://api.tissue.systems/hook/hk_9f3c8a1b... (capture only — no route bound) ``` **2. Paste the URL into the sender** (for GitHub, *Settings → Webhooks → Add webhook* on the repository) and trigger one event, or wait for the next real one. The endpoint answers `202` and stores what arrives. **3. Watch it land.** ```console $ ribo vesicle tail github POST · 8437 bytes · content-type: application/json { "action": "opened", "issue": { "number": 412, "title": "..." }, "repository": {...} } ``` **4. Read the delivery in full**, and keep it as a fixture: ```bash ribo vesicle show cap_7b21 > test/fixtures/issue-opened.json ``` **5. Write the handler against that payload**: the field names in the fixture, not the ones a doc claims. The shape is [above](#what-a-cell-receives). Deploy it: ```bash ribo deploy ``` **6. Bind the endpoint** to the Cell and the route the handler serves: ```bash ribo vesicle endpoint bind github --cell deploy-bot --route /github ``` From here every new delivery goes through to the Cell. The ones captured in steps 2 to 5 do not move on their own. **7. Replay the backlog**, one delivery first so you can read the response: ```console $ ribo vesicle replay cap_7b21 201 application/json 42ms {"stored":"cap_7b21f4a90c3e5d81b6a2c4e0","attempt":1} $ ribo vesicle replay github --all --since 2026-08-11 --dry-run $ ribo vesicle replay github --all --since 2026-08-11 ``` The sender was never told anything after step 2, and never needs to be again: renaming the Cell or moving the handler somewhere else is a `bind` on your side. --- ## See also - [Vesicle API reference](https://docs.tissue.systems/docs/vesicle/api/): the `/v1/vesicle/*` routes and their scopes - [ribo CLI reference](https://docs.tissue.systems/docs/ribo/reference/#ribo-vesicle): every `ribo vesicle` command and flag - [ribo.toml reference](https://docs.tissue.systems/docs/cells/configuration/): vault bindings, used by `verify` - [c3 Overview](https://docs.tissue.systems/docs/c3/overview/): where a handler usually puts what it receives - [MCP server](https://docs.tissue.systems/docs/mcp/overview/): the `vesicle_*` tools an assistant uses --- # Vesicle: webhook inbox / API reference Source: https://docs.tissue.systems/docs/vesicle/api/ # Vesicle API reference The `/v1/vesicle/*` endpoints manage the [webhook inbox](https://docs.tissue.systems/docs/vesicle/overview/): issue ingest URLs, read what senders delivered, and replay a delivery into a Cell. **Base URL**: `https://api.tissue.systems` **Authentication**: `Authorization: Bearer `, where `` is a CLI JWT or a `tok_` API token. Each route lists the [scope](https://docs.tissue.systems/docs/api/) it requires. A JWT session holds every scope implicitly; an API token carries an explicit allow-list. Endpoints are **account-scoped**, so they are not nested under `/v1/cells/{address}`: an endpoint routinely exists before any Cell does. Only the per-Cell read view hangs off a Cell. The same operations are available through the [`ribo vesicle` CLI](https://docs.tissue.systems/docs/ribo/reference/#ribo-vesicle), the dashboard Webhooks page, and the MCP tools (`vesicle_endpoint_create`, `vesicle_endpoint_list`, `vesicle_endpoint_get`, `vesicle_endpoint_bind`, `vesicle_endpoint_rotate`, `vesicle_endpoint_revoke`, `vesicle_capture_list`, `vesicle_capture_get`, `vesicle_replay`). --- ## Routes | Method and path | Scope | Does | |---|---|---| | `POST /v1/vesicle/endpoints` | `vesicle:write` | Issue an ingest URL | | `GET /v1/vesicle/endpoints` | `vesicle:read` | List endpoints with binding state and capture counts | | `GET /v1/vesicle/endpoints/{id}` | `vesicle:read` | One endpoint, including its full ingest URL | | `PATCH /v1/vesicle/endpoints/{id}` | `vesicle:write` | Bind, rebind, unbind, or change `verify` / `ack` | | `POST /v1/vesicle/endpoints/{id}/rotate` | `vesicle:write` | Issue a new id; the old one keeps capturing for a grace window | | `DELETE /v1/vesicle/endpoints/{id}` | `vesicle:delete` | Revoke the endpoint; captures survive to their retention | | `GET /v1/vesicle/endpoints/{id}/captures` | `vesicle:read` | List captures, newest first, without bodies | | `GET /v1/vesicle/captures/{cid}` | `vesicle:read` | One capture verbatim, redacted unless `reveal=true` | | `POST /v1/vesicle/captures/{cid}/replay` | `vesicle:write` | Redeliver one capture, returning the Cell's response | | `POST /v1/vesicle/endpoints/{id}/replay` | `vesicle:write` | Redeliver a range, with an optional dry run | | `DELETE /v1/vesicle/captures/{cid}` | `vesicle:delete` | Drop one capture | | `GET /v1/cells/{address}/vesicle` | `vesicle:read` | The per-Cell view: endpoints bound here and recent delivery state | Ingest itself (`POST https://api.tissue.systems/hook/{endpoint_id}`) is not a `/v1` route and carries no scope. It takes no `Authorization` header, accepts any method, and the only thing it can do is deliver. Its response codes are in the [overview](https://docs.tissue.systems/docs/vesicle/overview/#what-the-sender-sees). --- ## Issue an endpoint `POST /v1/vesicle/endpoints` (scope `vesicle:write`) Body: `{name, cell?, route?, verify?, ack?}`. Omit `cell` and `route` for a capture-only endpoint; both can be set later with `PATCH`. ```bash curl -X POST https://api.tissue.systems/v1/vesicle/endpoints \ -H "Authorization: Bearer $TISSUE_TOKEN" -H "Content-Type: application/json" \ -d '{"name": "github", "ack": "immediate"}' ``` ```json { "id": "hk_9f3c8a1b4e7d2c6058a1b3d5f7092e4c", "name": "github", "url": "https://api.tissue.systems/hook/hk_9f3c8a1b4e7d2c6058a1b3d5f7092e4c", "cell": null, "cell_address": null, "route": null, "verify": "none", "ack": "immediate", "retries": 8, "created_at": "2026-08-11T17:04:02Z", "rotated_from": null, "grace_until": null, "revoked_at": null, "captures": { "captured": 0, "delivered": 0, "retrying": 0, "rejected": 0, "dead": 0 } } ``` | Field | Values | |---|---| | `name` | your label for the endpoint, unique within the account | | `cell` | the Cell name deliveries are dispatched to, or `null` | | `route` | the path they land on, e.g. `/github`, or `null` | | `verify` | `none`, `hmac:KEY`, `stripe:KEY`, `github:KEY`, where `KEY` is a [vault binding](https://docs.tissue.systems/docs/cells/configuration/) on the bound Cell | | `ack` | `immediate` (202 on receipt) or `on-success` (the Cell's response verbatim) | --- ## List endpoints `GET /v1/vesicle/endpoints` (scope `vesicle:read`) Every endpoint in the account, each with its binding state and capture counts by state. ```bash curl https://api.tissue.systems/v1/vesicle/endpoints \ -H "Authorization: Bearer $TISSUE_TOKEN" ``` ```json { "count": 1, "endpoints": [ { "id": "hk_9f3c8a1b4e7d2c6058a1b3d5f7092e4c", "name": "github", "url": "https://api.tissue.systems/hook/hk_9f3c8a1b4e7d2c6058a1b3d5f7092e4c", "cell": "deploy-bot", "cell_address": "26e9871aq7x2k", "route": "/github", "verify": "github:GITHUB_WEBHOOK_SECRET", "ack": "immediate", "captures": { "captured": 3, "delivered": 10, "retrying": 0, "rejected": 1, "dead": 0 } } ] } ``` A non-zero `captured` count on an endpoint with `route: null` means deliveries are arriving and nothing is running: the sender is being told `202` while the events sit unhandled. --- ## Get an endpoint `GET /v1/vesicle/endpoints/{id}` (scope `vesicle:read`) One endpoint in the full form shown under [issue an endpoint](#issue-an-endpoint), including the ingest URL. ```bash curl https://api.tissue.systems/v1/vesicle/endpoints/hk_9f3c8a1b... \ -H "Authorization: Bearer $TISSUE_TOKEN" ``` --- ## Bind, rebind, or unbind `PATCH /v1/vesicle/endpoints/{id}` (scope `vesicle:write`) Sets any of `cell`, `route`, `verify`, `ack`. Send `"route": null` to unbind and return the endpoint to capture-only. ```bash curl -X PATCH https://api.tissue.systems/v1/vesicle/endpoints/hk_9f3c8a1b... \ -H "Authorization: Bearer $TISSUE_TOKEN" -H "Content-Type: application/json" \ -d '{"cell": "deploy-bot", "route": "/github"}' ``` Returns the updated endpoint. The Cell need not exist at bind time. The binding resolves at dispatch, so an unresolvable name is a delivery failure, not a rejected request. **Binding does not backfill.** Captures taken while the endpoint was unbound stay in state `captured` and reach the Cell only through an explicit [replay](#replay-a-range). --- ## Rotate an endpoint `POST /v1/vesicle/endpoints/{id}/rotate` (scope `vesicle:write`) Issues a new `hk_` id with the same name, binding and settings. The old id keeps capturing for a grace window (7 days by default) and then answers `404`, so a rotation the vendor has not applied yet does not drop live deliveries. ```bash curl -X POST https://api.tissue.systems/v1/vesicle/endpoints/hk_9f3c8a1b.../rotate \ -H "Authorization: Bearer $TISSUE_TOKEN" ``` ```json { "id": "hk_41d7be09c5a83f2617e4d0b8a9c31f56", "name": "github", "url": "https://api.tissue.systems/hook/hk_41d7be09c5a83f2617e4d0b8a9c31f56", "rotated_from": "hk_9f3c8a1b4e7d2c6058a1b3d5f7092e4c", "grace_until": "2026-08-18T17:04:02Z" } ``` Captures that arrive on the old id during the window are stored with a warning recorded against them. --- ## Revoke an endpoint `DELETE /v1/vesicle/endpoints/{id}` (scope `vesicle:delete`) The URL stops answering immediately and returns `404` to any further delivery. Captures already stored survive to their normal 30-day retention. Returns `204 No Content`. ```bash curl -X DELETE https://api.tissue.systems/v1/vesicle/endpoints/hk_9f3c8a1b... \ -H "Authorization: Bearer $TISSUE_TOKEN" ``` --- ## List captures `GET /v1/vesicle/endpoints/{id}/captures` (scope `vesicle:read`) Captures for one endpoint, newest first. The list form never carries bodies. **Filters**: `state` (`captured`, `delivered`, `retrying`, `rejected`, `dead`), `since`, `until`, `limit`. ```bash curl "https://api.tissue.systems/v1/vesicle/endpoints/hk_9f3c8a1b.../captures?state=dead&limit=20" \ -H "Authorization: Bearer $TISSUE_TOKEN" ``` ```json { "count": 1, "captures": [ { "id": "cap_7b21f4a90c3e5d81b6a2c4e0", "endpoint_id": "hk_9f3c8a1b4e7d2c6058a1b3d5f7092e4c", "received_at": "2026-08-11T17:05:41Z", "method": "POST", "path": "/", "size": 8437, "content_type": "application/json", "source_ip": "203.0.113.9", "verify": "pass", "state": "dead", "attempts": 8, "last_status": 502, "next_attempt_at": null } ] } ``` `verify` on a capture is `none` when no check was configured, or `pass`. A signature that failed is answered `401` at ingest and never stored. --- ## Get a capture `GET /v1/vesicle/captures/{cid}` (scope `vesicle:read`) One capture verbatim: headers, body, source address, verification result, and the log of delivery attempts. ```bash curl https://api.tissue.systems/v1/vesicle/captures/cap_7b21f4a9... \ -H "Authorization: Bearer $TISSUE_TOKEN" ``` ```json { "id": "cap_7b21f4a90c3e5d81b6a2c4e0", "endpoint_id": "hk_9f3c8a1b4e7d2c6058a1b3d5f7092e4c", "received_at": "2026-08-11T17:05:41Z", "method": "POST", "path": "/", "size": 8437, "content_type": "application/json", "source_ip": "203.0.113.9", "verify": "pass", "state": "dead", "attempts": 8, "last_status": 502, "next_attempt_at": null, "headers": { "content-type": "application/json", "x-hub-signature-256": "«redacted»" }, "body": "{\"title\":\"…\"}", "body_encoding": "utf8", "redacted": true, "attempts_log": [ { "at": "2026-08-11T17:05:41Z", "status": 502, "error": null } ] } ``` **Redaction is the default.** Header names matching `authorization`, `x-api-key`, `cookie`, `*-signature` and `*-token`, and JSON body keys matching the same patterns, come back as `«redacted»`. Add `?reveal=true` to get the values intact: the response then carries `"redacted": false`, and the read writes an `audit_events` row with the action `vesicle.capture.reveal`. `body_encoding` is `utf8` for text and `base64` for anything that is not valid UTF-8. --- ## Replay one capture `POST /v1/vesicle/captures/{cid}/replay` (scope `vesicle:write`) Dispatches the stored request at the bound Cell once and returns what the handler did, so the caller can see the outcome without going to look for it. ```bash curl -X POST https://api.tissue.systems/v1/vesicle/captures/cap_7b21f4a9.../replay \ -H "Authorization: Bearer $TISSUE_TOKEN" ``` ```json { "capture_id": "cap_7b21f4a90c3e5d81b6a2c4e0", "dispatched": true, "status": 201, "headers": { "content-type": "application/json" }, "body": "{\"stored\":\"cap_7b21f4a90c3e5d81b6a2c4e0\",\"attempt\":1}", "duration_ms": 42 } ``` The Cell receives the [dispatch headers](https://docs.tissue.systems/docs/vesicle/overview/#what-a-cell-receives) as it would for a live delivery, with the same `x-tissue-vesicle-id`. Replaying at a URL of your choosing is a **client-side** operation: [`ribo vesicle replay --to `](https://docs.tissue.systems/docs/ribo/reference/#ribo-vesicle) fetches the capture over this API and performs the POST from your own machine. There is no server-side equivalent, and there will not be one: a caller-supplied target would make the platform a request-forgery instrument with an authenticated account behind it. --- ## Replay a range `POST /v1/vesicle/endpoints/{id}/replay` (scope `vesicle:write`) Body: `{since?, until?, ids?, state?, dry_run?}`. With `dry_run: true` the response reports what would be sent and nothing is dispatched. ```bash curl -X POST https://api.tissue.systems/v1/vesicle/endpoints/hk_9f3c8a1b.../replay \ -H "Authorization: Bearer $TISSUE_TOKEN" -H "Content-Type: application/json" \ -d '{"since": "2026-08-11T00:00:00Z", "state": "captured"}' ``` ```json { "endpoint": "github", "matched": 12, "dispatched": 12, "dry_run": false, "results": [ { "capture_id": "cap_7b21f4a90c3e5d81b6a2c4e0", "status": 201 } ] } ``` Redelivery is at-least-once and order is not guaranteed. A handler that must not act twice on one event should key on `x-tissue-vesicle-id`, which is stable across every attempt and replay of a capture. --- ## Drop a capture `DELETE /v1/vesicle/captures/{cid}` (scope `vesicle:delete`) Removes one capture and its stored body ahead of the 30-day retention. Returns `204 No Content`. ```bash curl -X DELETE https://api.tissue.systems/v1/vesicle/captures/cap_7b21f4a9... \ -H "Authorization: Bearer $TISSUE_TOKEN" ``` --- ## Vesicle activity for one Cell `GET /v1/cells/{address}/vesicle` (scope `vesicle:read`) The per-Cell view: the endpoints bound to this Cell and the recent delivery state of each, so a Cell dashboard is complete without knowing any endpoint ids. ```bash curl https://api.tissue.systems/v1/cells/26e9871aq7x2k/vesicle \ -H "Authorization: Bearer $TISSUE_TOKEN" ``` ```json { "cell": "deploy-bot", "cell_address": "26e9871aq7x2k", "endpoints": [ { "id": "hk_9f3c8a1b4e7d2c6058a1b3d5f7092e4c", "name": "github", "route": "/github", "captures": { "captured": 3, "delivered": 10, "retrying": 0, "rejected": 1, "dead": 0 }, "last_delivery_at": "2026-08-11T17:05:41Z" } ] } ``` --- ## See also - [Vesicle overview](https://docs.tissue.systems/docs/vesicle/overview/): endpoints, capture states, retries, replay, and a worked integration - [ribo CLI reference](https://docs.tissue.systems/docs/ribo/reference/#ribo-vesicle): the same operations from the terminal - [REST API](https://docs.tissue.systems/docs/api/): the full `/v1` API and the scope model --- # Synapse: sensor ingest / Overview Source: https://docs.tissue.systems/docs/synapse/overview/ # Synapse: sensor ingest **Synapse** is the serverless sensor/IoT ingest gateway for tissue.systems. Devices publish telemetry over MQTT; synapse authenticates each device, enforces per-account and per-device topic isolation and rate limits, and dispatches every reading into the owning Cell's `sensor` handler. The name fits the tissue metaphor: a synapse is the junction that transmits a signal from one cell to the next. Synapse is that junction for physical devices: it carries each reading from the sensor into your Cell, then gets out of the way. It is **stateless**: synapse stores no readings. Your Cell owns storage (typically [c3](https://docs.tissue.systems/docs/c3/overview/)). --- ## How it works ``` device ──MQTT(S):8883──▶ synapse (auth + ACL + rate-limit) ──HTTP POST──▶ Cell.sensor() ──▶ c3 ``` 1. A device opens an MQTT-over-TLS connection to `ingest.tissue.dev:8883` and authenticates with its `device_id` (username) and token (password). 2. It publishes a message to `tissue///`. 3. Synapse checks the device's rate limit, verifies the topic is inside the device's own namespace, and looks up the owning Cell. 4. Synapse POSTs the raw payload to the Cell runtime with `x-tissue-event: sensor` and identity headers. The router delivers it to your Cell's `sensor(event, env)` export. 5. Your Cell decodes the payload and does whatever it likes with it, usually an `INSERT` into c3. Dispatch is **best-effort**, exactly like [pulse](https://docs.tissue.systems/docs/pulse/overview/): if the Cell is unavailable or throws, the reading is not retried. Telemetry is loss-tolerant by design. --- ## Transport Synapse speaks **MQTT 3.1.1 over TLS (MQTTS)** on port `8883`. The production ingest host is `ingest.tissue.dev`, geo-routed to the nearest edge. Devices authenticate at MQTT CONNECT with: | Field | Value | |----------|------------------------------------------------| | username | the `device_id` (`dev_<8hex>`) | | password | the device token (`key_<64hex>`) | ### Coming soon - **CoAP over DTLS** as a second way in. - **MQTT over WebSocket**. - **Client certificates (mTLS)** for device sign-in. Devices sign in with a token today. --- ## Downlink (cloud → device) Data flows the other way too: a device may **subscribe** to topics inside its own namespace (by convention `tissue///cmd/#`), and your Cell publishes commands to it through the downlink endpoint: `POST https://ingest.tissue.dev/publish` with the device's own credentials and a topic *relative* to its namespace. Downlink `cmd/*` messages are routed to the device's live subscription and are **never** dispatched back into your Cell's `sensor()` handler, so a command can't masquerade as a reading. Full walkthrough with device-side code (LED, servo): [Connect your own device → Cloud to device](https://docs.tissue.systems/docs/synapse/byo-device/). ## Topics Every reading is published on a canonical topic: ``` tissue/// ``` - **Account isolation is broker-enforced**: a device can only publish under its own account prefix (`tissue//`). - **Per-device ACL is enforced per message**: a device may only publish within its own device prefix (`tissue///`); it cannot publish as another device, even inside the same account. - **One message per metric.** The `` segment is everything after the device id, so `tissue/acct_9c/dev_a1b2c3/env/humidity` carries the metric `env/humidity`. Inside the Cell, derive the metric from the topic: ```js const metric = event.topic.split("/").slice(3).join("/"); ``` --- ## Payload formats Synapse forwards the raw message bytes untouched; it does not parse the payload. Your Cell decides how to decode it. Common choices: | Format | Example | |---------------------------|----------------------------------| | JSON | `{"value": 21.4, "unit": "C"}` | | Bare number | `21.4` | | InfluxDB line protocol | `temperature,room=kitchen value=21.4` | The reference Cell (tissue-sense) tries JSON first and falls back to a bare number. --- ## The `sensor` handler Export a `sensor` function from your Cell module alongside `fetch`. Synapse calls it once per reading: ```js export default { async sensor(event, env) { const metric = event.topic.split("/").slice(3).join("/"); const body = event.json(); // decode the payload console.log(`${event.device} ${metric} = ${body.value}${body.unit ?? ""}`); }, async fetch(request, env) { return new Response("ok"); }, }; ``` The `sensor` export is optional. A Cell without it silently ignores any sensor events dispatched to it (synapse gets a `204` and moves on). The `env` argument is identical to the one passed to `fetch`; all declared bindings (c3, g7, text) are fully available. ### The event object | Property | Type | Description | |--------------------|--------------|--------------------------------------------------------------------| | `event.device` | `string` | The publishing device's id (`dev_...`) | | `event.account` | `string` | The owning account id | | `event.topic` | `string` | Full topic, `tissue///` | | `event.transport` | `string` | The ingest transport (`mqtt`) | | `event.bytes` | `Uint8Array` | The raw payload bytes | | `event.text()` | `string` | The payload decoded as UTF-8 text | | `event.json()` | `object` | The payload parsed as JSON (throws if not valid JSON) | | `event.receivedTime` | `Date` | When the runtime received the reading | --- ## Example: store readings in c3 A complete Cell that writes each reading into a c3 table and prunes old rows hourly with [pulse](https://docs.tissue.systems/docs/pulse/overview/). **ribo.toml** ```toml [cell] name = "tissue-sense" js = "./cell.js" [[pulse]] schedule = "0 * * * *" # hourly retention prune [[bindings]] type = "c3" binding = "DB" database = "tissue-sense" ``` **cell.js** ```js const SCHEMA = ` CREATE TABLE IF NOT EXISTS readings ( id INTEGER PRIMARY KEY AUTOINCREMENT, account_id TEXT NOT NULL, device_id TEXT NOT NULL, metric TEXT NOT NULL, value REAL NOT NULL, unit TEXT, recorded_at TEXT NOT NULL ) `; export default { // Fired by synapse, once per reading. async sensor(event, env) { await env.DB.exec(SCHEMA); // topic = tissue/// const metric = event.topic.split("/").slice(3).join("/") || "unknown"; // Decode JSON {value, unit}, falling back to a bare number. let value, unit; try { const body = event.json(); value = Number(body.value); unit = body.unit ?? null; } catch { value = Number(event.text()); unit = null; } if (Number.isNaN(value)) { console.log(`dropped non-numeric reading device=${event.device} metric=${metric}`); return; } await env.DB.prepare( "INSERT INTO readings (account_id, device_id, metric, value, unit, recorded_at) VALUES (?, ?, ?, ?, ?, ?)" ).bind(event.account, event.device, metric, value, unit, event.receivedTime.toISOString()).run(); }, // Hourly retention prune (> 14 days). async pulse(event, env) { await env.DB.exec(SCHEMA); const cutoff = new Date(Date.now() - 14 * 24 * 60 * 60 * 1000).toISOString(); await env.DB.prepare("DELETE FROM readings WHERE recorded_at < ?").bind(cutoff).run(); }, // Render the latest readings as JSON. async fetch(request, env) { await env.DB.exec(SCHEMA); const { results } = await env.DB.prepare( "SELECT device_id, metric, value, unit, recorded_at FROM readings ORDER BY id DESC LIMIT 200" ).all(); return Response.json(results); }, }; ``` --- ## Getting started 1. **Register a device** under your Cell, with the CLI (`ribo sensor add `) or the dashboard's Synapse section. Save the token it prints; it is shown only once. 2. **Configure the device's MQTT client**: host `ingest.tissue.dev`, port `8883` (TLS), username = the `device_id`, password = the token, publish topic `tissue///`. 3. **Deploy a Cell that exports `sensor(event, env)`** with `ribo deploy` (see the example above). 4. **Watch readings arrive**: the device publishes, synapse dispatches, and your `sensor` handler runs. Query your c3 table (or the Cell's `fetch` endpoint) to confirm. --- ## See also - [Sensor API reference](https://docs.tissue.systems/docs/synapse/api/): the `/v1/sensors/*` device-registry endpoints - [Managing devices](https://docs.tissue.systems/docs/synapse/devices/): the device credential model and lifecycle - [ribo CLI reference](https://docs.tissue.systems/docs/ribo/reference/): `ribo sensor` commands - [c3 Overview](https://docs.tissue.systems/docs/c3/overview/): structured storage for readings --- # Synapse: sensor ingest / Onboarding a device Source: https://docs.tissue.systems/docs/synapse/onboarding/ # Onboarding a Device Onboarding is how a physical device becomes a trusted source of data in your account: it gets an **identity**, a **credential**, and a **Cell** that receives its readings. This page explains the flow and the security model behind it: what a device can and cannot do once it's connected. There are two ways in: | Path | For | How | |---|---|---| | **Pre-provisioned device** (e.g. a tissue Sense demo/workshop device) | Devices that ship ready to go, with a QR sticker | Scan the QR, create your account, power on. The device links itself. No commands, no credentials to copy. | | **Bring your own device** | Any board or program that speaks MQTT over TLS | Register it under a Cell, put the credentials on the device, publish. See [Connect your own device](https://docs.tissue.systems/docs/synapse/byo-device/). | Both paths end in exactly the same place: a registered device with its own credential, publishing into its own topic namespace, dispatched to your Cell's `sensor()` handler. --- ## Pre-provisioned devices (QR onboarding) A pre-provisioned device, like the tissue Sense boards handed out at workshops, is registered before you ever touch it. Its identity is recorded at build time, and the QR sticker on the case ties that identity to whoever scans it: 1. **Scan the QR code.** It opens the setup page for *this specific device*. Create your free account there (or sign in). Each device's QR link belongs to its owner; accounts are never shared. 2. **Power the device and give it Wi-Fi.** The device opens a temporary Wi-Fi network with a captive portal where you pick your home network. 3. **The device links itself.** Once online, it contacts the setup endpoint, which recognizes it and hands back its reporting credentials, directly to the device, over TLS. The credentials are stored in the device's own flash; you never see or type them. From that moment the device is indistinguishable from one you provisioned by hand: same credential model, same isolation, same lifecycle controls below. The claim step is deliberately narrow: the endpoint only links devices that were pre-registered, it hands out a device's credentials only once (a second claim requires a factory reset of the device), and it is rate-limited against guessing. ## Bring your own device If you're bringing your own hardware, provisioning is explicit and takes one command: register the device under the Cell that should receive its data: ```bash ribo sensor add my-sensors # device_id dev_a1b2c3d4 ← MQTT username # token key_<64 hex> ← MQTT password, shown once, save it now # topic tissue/// ``` Then point any MQTT 3.1.1 client at `ingest.tissue.dev:8883` (TLS) with those credentials. The full walkthrough, including MicroPython examples and flashing instructions, is [Connect your own device](https://docs.tissue.systems/docs/synapse/byo-device/). --- ## The security environment The design goal: **compromising one device compromises that one device's data stream, and nothing else.** Concretely: ### One device, one key Every device gets its own credential at registration: a stable `device_id` (the MQTT username) and a random 256-bit token (the password). Register each physical board separately; don't share a token across devices. A leaked token then exposes only that board's stream, and you can revoke it without touching the rest of your fleet. ### Tokens are never stored, only their hashes The platform keeps a SHA-256 hash of each token, never the token itself, and comparisons are constant-time. A token is shown exactly once, at registration (or rotation). If it's lost, it cannot be recovered, only rotated. If the registry were ever exposed, no device credentials would leak with it. ### Every connection is authenticated and encrypted Devices connect over TLS to `ingest.tissue.dev:8883`. The broker verifies the `device_id` + token pair on every MQTT CONNECT, and a disabled device is refused at the door. ### Devices are boxed into their own topic namespace Each device may publish only inside its own prefix, `tissue///…`, and this is enforced by the broker, not by convention. A device cannot publish into another device's stream (even within the same account), cannot subscribe to other devices' topics, and cannot impersonate anyone: the topic itself carries the identity that was authenticated. ### Per-device quarantine, rotate, and revoke Each device can be managed independently, with no effect on the others: - **Disable**: instantly refuses the device's next connection; its history and identity are preserved, and it can be re-enabled just as instantly. Use this to quarantine a suspicious or misbehaving sensor. - **Rotate**: mints a new token for the same `device_id`. The old token stops working immediately; nothing else about the device changes. - **Delete**: removes the device entirely; its credentials stop working immediately. All three are available from the dashboard, the [REST API](https://docs.tissue.systems/docs/synapse/api/), and (add/list/delete) the `ribo sensor` CLI; see [Managing devices](https://docs.tissue.systems/docs/synapse/devices/). ### Flood protection and reporting cadence Two layers of rate limiting protect the platform and your account: - **Abuse caps**: at most 10 messages/second per device (burst 40) and 100 messages/second per account (burst 400), with a 64 KiB payload cap. Over-rate messages are dropped, not queued: a runaway device is shed cheaply and can't starve the rest of your account. - **Telemetry cadence**: the supported reporting rate is **one reading per minute per metric** (per device). Faster readings are dropped server-side, so design your firmware to report each metric at most once a minute. (Demo and specially provisioned accounts may run at higher cadences; if your application needs faster telemetry, get in touch.) ### Cloud-to-device commands can't loop back Downlink messages (commands your Cell sends to a device via its `cmd/…` topics) require the device's own credential, are confined to that device's namespace, and are never dispatched back into your Cell's `sensor()` handler, so a command can't masquerade as a reading or create a feedback loop. --- ## After onboarding - Readings arrive in your Cell's `sensor(event, env)` handler; see the [Synapse overview](https://docs.tissue.systems/docs/synapse/overview/) for the event shape and a full example Cell. - Manage the device's lifecycle in [Managing devices](https://docs.tissue.systems/docs/synapse/devices/). - Automate provisioning with the [Sensor API](https://docs.tissue.systems/docs/synapse/api/) or the [MCP server](https://docs.tissue.systems/docs/mcp/overview/) if an AI agent is doing the work. --- # Synapse: sensor ingest / Managing devices Source: https://docs.tissue.systems/docs/synapse/devices/ # Managing devices A **device** is an external client (a microcontroller, gateway, or script) that publishes telemetry to [synapse](https://docs.tissue.systems/docs/synapse/overview/) over MQTT. Each device is registered under one Cell, gets its own credentials, and can be quarantined or revoked independently. This page covers the device lifecycle: register, connect, disable, rotate, delete. Every registered device lives in the platform's device registry, which synapse reads to authenticate each connection. --- ## Registering a device ### With ribo ```bash ribo sensor add ``` This registers a new device under the Cell and prints its credentials. The token is shown **once**; save it immediately. ```bash ribo sensor add my-cell # ✓ Registered device for my-cell # # device_id dev_a1b2c3d4 # token key_<64 hex chars> # topic tissue/acct_9c3f21ab/dev_a1b2c3d4/ # # Save the token now — it is not shown again. # Connect over MQTT/TLS: username=dev_a1b2c3d4 password= ``` ### With the dashboard Open the dashboard, go to the **Synapse** section for your Cell, and click to register a device. The dashboard shows the `device_id`, token, and topic prefix; copy the token before you close the dialog. --- ## The credential model | Credential | Format | Role | Notes | |-------------|----------------|----------------------------------------|----------------------------------------------------| | `device_id` | `dev_<8hex>` | MQTT username; the device's stable id | Never changes; safe to log and reference | | token | `key_<64hex>` | MQTT password | Shown once at register/rotate; stored only as a SHA-256 hash | Synapse stores the token's **SHA-256 hash**, never the token itself, so a lost token cannot be recovered, only rotated. The auth type is `token` today (`auth_type: "token"`). --- ## Device lifecycle Every operation below is available through `ribo sensor` (where a subcommand exists), the [`/v1/sensors/*` REST API](https://docs.tissue.systems/docs/synapse/api/), and the MCP tools. ### List Every device registered to one Cell: ```bash ribo sensor list my-cell # DEVICE AUTH ENABLED # dev_a1b2c3d4 token true ``` REST: `GET /v1/sensors/{cell}/devices` (one Cell) or `GET /v1/sensors/devices` (every device in the account). ### Get Fetch a single device's registry record (identity, auth type, enabled state, topic prefix). The token is never returned. REST: `GET /v1/sensors/{cell}/devices/{device_id}`. ### Enable / disable Disabling a device flips its `enabled` flag to `false`; synapse then refuses the device's next MQTT CONNECT. The `device_id`, token hash, and any Cell-side reading history are all preserved. Prefer **disable over delete** when you want to quarantine a noisy or possibly-compromised sensor temporarily: a disabled device can be re-enabled instantly, whereas a deleted device must be re-registered and gets a brand-new `device_id` and topic prefix. REST: `PATCH /v1/sensors/{cell}/devices/{device_id}` with body `{"enabled": false}`. ### Rotate token Issue a new token for an existing device, keeping its `device_id` stable. The old token stops working **immediately**. Use this when a token leaks; it is strictly better than delete + re-register, because the `device_id` and topic prefix stay the same, so no other configuration changes. You only need to update the MQTT password on the device. REST: `POST /v1/sensors/{cell}/devices/{device_id}/rotate`. The new token is returned once. ### Delete Revoke a device entirely. Its credentials stop working immediately and its registry row is removed. ```bash ribo sensor delete my-cell dev_a1b2c3d4 # ✓ Deleted device dev_a1b2c3d4 ``` REST: `DELETE /v1/sensors/{cell}/devices/{device_id}`. > The `ribo sensor` command currently exposes `add`, `list`, and `delete`. Enable/disable and rotate are available through the [REST API](https://docs.tissue.systems/docs/synapse/api/) and the MCP tools. --- ## Connecting an MQTT client Any standard MQTT 3.1.1 client works. Point it at `ingest.tissue.dev:8883` over TLS, authenticate with the `device_id`/token, and publish to your device topic. Using the `mosquitto_pub` CLI: ```bash mosquitto_pub \ -h ingest.tissue.dev -p 8883 --tls-use-os-certs \ -u dev_a1b2c3d4 \ -P key_<64 hex chars> \ -t 'tissue/acct_9c3f21ab/dev_a1b2c3d4/temperature' \ -m '{"value":21.4,"unit":"C"}' ``` (`--tls-use-os-certs` validates against your system's trusted CAs, the same flag on macOS, Linux, and Windows. On mosquitto older than 2.0.11, pass `--cafile /etc/ssl/cert.pem` (macOS) or `--cafile /etc/ssl/certs/ca-certificates.crt` (Linux) instead.) The topic must be inside the device's own namespace (`tissue///`); synapse rejects any publish outside it. --- ## Rate limits and payload size Synapse applies token-bucket rate limits and a maximum payload size. These are the platform defaults (operators can tune them per edge): | Limit | Default | Notes | |--------------------------|----------------------|--------------------------------------------------| | Per-device rate | 10 messages/sec | Sustained; token-bucket refill | | Per-device burst | 40 messages | Bucket capacity | | Per-account rate | 100 messages/sec | Sustained, across all the account's devices | | Per-account burst | 400 messages | Bucket capacity | | Max payload | 65536 bytes (64 KiB) | Larger messages are rejected | Over-rate messages are **dropped, not queued**: telemetry is loss-tolerant, so a flooding device is shed cheaply before it ever touches the registry or your Cell. --- ## See also - [Synapse overview](https://docs.tissue.systems/docs/synapse/overview/): how ingest works end to end - [Sensor API reference](https://docs.tissue.systems/docs/synapse/api/): the `/v1/sensors/*` endpoints - [ribo CLI reference](https://docs.tissue.systems/docs/ribo/reference/): `ribo sensor` commands --- # Synapse: sensor ingest / Connect your own device Source: https://docs.tissue.systems/docs/synapse/byo-device/ # Connect your own device You have a board that is **already on Wi-Fi** and running its own firmware: MicroPython, CircuitPython, Tasmota, a Node-RED flow, a Python script on a Raspberry Pi. It just needs to be tied to your Tissue Cloud account so its readings land in your Cell. Provisioning is three steps, none of which touch the device's firmware choice: 1. **Deploy a Cell** with a `sensor()` handler: the code that receives readings. 2. **Register a device** under that Cell: this mints the credentials. 3. **Point the device's MQTT client** at `ingest.tissue.dev:8883` with those credentials. Anything that speaks MQTT 3.1.1 over TLS can be a Tissue sensor. No claim codes, no special firmware; the credentials *are* the provisioning. --- ## Step 1: deploy a Cell to receive readings Readings dispatch to the `sensor(event, env)` export of the Cell the device is registered under. A minimal receiving Cell: ```toml # ribo.toml [cell] name = "my-sensors" js = "./cell.js" [[bindings]] type = "c3" binding = "DB" database = "readings" ``` ```js // cell.js export default { async sensor(event, env) { const { value, unit } = await event.json(); await env.DB.exec( "CREATE TABLE IF NOT EXISTS readings (device TEXT, metric TEXT, value REAL, unit TEXT, ts TEXT DEFAULT (datetime('now')))" ); await env.DB.exec( "INSERT INTO readings (device, metric, value, unit) VALUES (?, ?, ?, ?)", event.device, event.metric, value, unit ?? null ); return new Response("ok"); }, async fetch(req, env) { const rows = await env.DB.query( "SELECT * FROM readings ORDER BY ts DESC LIMIT 20" ); return Response.json(rows); } }; ``` ```bash ribo deploy ``` See the [Synapse overview](https://docs.tissue.systems/docs/synapse/overview/) for a fuller example with rollups, pruning, and a dashboard. --- ## Step 2: register the device ```bash ribo sensor add my-sensors # ✓ Registered device for my-sensors # # device_id dev_a1b2c3d4 # token key_<64 hex chars> # topic tissue/acct_9c3f21ab/dev_a1b2c3d4/ # # Save the token now — it is not shown again. ``` Three values come out of this, and they are everything the device needs: | Value | Used as | |---|---| | `device_id` | MQTT **username** (and a fine client id) | | token (`key_…`) | MQTT **password**; shown once, store it on the device | | topic prefix | Where to publish: `tissue///` | You can also register from the **dashboard** (Synapse section → register device) or, for fleet automation, the [REST API](https://docs.tissue.systems/docs/synapse/api/): ```bash curl -X POST https://api.tissue.systems/v1/sensors/my-sensors/devices \ -H "Authorization: Bearer tok_" ``` One device = one credential. Register each physical board separately: a leaked token then compromises only that board's stream, and you can [rotate or disable](https://docs.tissue.systems/docs/synapse/devices/) it without touching the others. --- ## Step 3: connect from the device ### First: installing MicroPython on a Wemos D1 mini (if you haven't) If your board doesn't run MicroPython yet, it's a two-command flash. You need `esptool` (`pipx install esptool`) and a firmware image. For the D1 mini (ESP8266, 4 MB flash), download the latest **ESP8266_GENERIC** `.bin` from [micropython.org/download/ESP8266_GENERIC](https://micropython.org/download/ESP8266_GENERIC/). ```bash # find your serial port (macOS: /dev/cu.usbserial-*, Linux: /dev/ttyUSB0, Windows: COMx) esptool.py --port /dev/cu.usbserial-210 erase_flash esptool.py --port /dev/cu.usbserial-210 --baud 460800 \ write_flash --flash_size=detect 0 ESP8266_GENERIC-*.bin ``` Then talk to the REPL with [`mpremote`](https://docs.micropython.org/en/latest/reference/mpremote.html) (`pipx install mpremote`): ```bash mpremote repl # Ctrl-] to exit ``` Join Wi-Fi from the REPL (MicroPython remembers it across reboots): ```python import network wlan = network.WLAN(network.STA_IF) wlan.active(True) wlan.connect("home-net", "wifi-password") wlan.ifconfig() # prints the IP once connected ``` Copy your script to the board so it runs at boot: ```bash mpremote cp main.py :main.py mpremote reset ``` Troubleshooting: if the board boot-loops after flashing, re-flash with `-fm dio` added to the `write_flash` command (some D1 mini clones need it); if `write_flash` fails mid-transfer, drop `--baud` to `115200` and avoid USB hubs. Flashing MicroPython **replaces** whatever firmware was on the board, so hold-FLASH-on-boot tricks from other firmware no longer apply; to go back, just flash the other firmware image the same way. ### MicroPython client (ESP32 / ESP8266) Works with the built-in `dht` and `machine` modules and `umqtt.simple` (bundled in most builds; otherwise `import mip; mip.install("umqtt.simple")`). ```python import json, ssl, time import dht, machine from umqtt.simple import MQTTClient DEVICE_ID = "dev_a1b2c3d4" # from `ribo sensor add` TOKEN = "key_..." # shown once at registration ACCOUNT = "acct_9c3f21ab" PREFIX = "tissue/{}/{}".format(ACCOUNT, DEVICE_ID) sensor = dht.DHT22(machine.Pin(4)) # DATA on GPIO4 (D2 on a D1 mini) # TLS: encrypted but the server cert is not validated. See the note below. ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) ctx.verify_mode = ssl.CERT_NONE def connect(): c = MQTTClient(DEVICE_ID, "ingest.tissue.dev", port=8883, user=DEVICE_ID, password=TOKEN, keepalive=60, ssl=ctx) c.connect() return c client = connect() while True: try: sensor.measure() client.publish((PREFIX + "/temperature").encode(), json.dumps({"value": sensor.temperature(), "unit": "C"})) client.publish((PREFIX + "/humidity").encode(), json.dumps({"value": sensor.humidity(), "unit": "%RH"})) except OSError: # Wi-Fi blip / broker disconnect time.sleep(5) client = connect() time.sleep(30) # DHT22 minimum interval is 2 s ``` Notes for MicroPython: - **Older firmware** (pre-1.20) uses `ssl=True, ssl_params={...}` instead of an `SSLContext`. Check your build's `umqtt` signature. - **ESP8266 is tight on RAM for TLS.** It works, but connect early (before allocating big buffers) and keep payloads small. An ESP32 is the comfortable choice. - **Battery devices:** if you deep-sleep between readings, connect → publish → `machine.deepsleep()`; the TLS handshake is paid on every wake, so batch several metrics per wake. ### Arduino / C++ client (ESP8266 / ESP32) The same flow in C++ with [PubSubClient](https://github.com/knolleary/pubsubclient) and ArduinoJson. This is the pattern the tissue Sense demo firmware uses ([full source](https://github.com/tissue-systems/demo-cbc-sense/blob/main/firmware/src/main.cpp)): ```cpp #include // ESP32: #include #include #include #include const char* DEVICE_ID = "dev_a1b2c3d4"; // from `ribo sensor add` const char* TOKEN = "key_..."; // shown once at registration const char* ACCOUNT = "acct_9c3f21ab"; String prefix = String("tissue/") + ACCOUNT + "/" + DEVICE_ID + "/"; WiFiClientSecure net; PubSubClient mqtt(net); void connectMqtt() { // Encrypted but the server cert is not validated; fine for bring-up. // For production, pin the Let's Encrypt root instead (see the TLS note below). net.setInsecure(); mqtt.setServer("ingest.tissue.dev", 8883); mqtt.setBufferSize(512); while (!mqtt.connected()) { if (!mqtt.connect(DEVICE_ID, DEVICE_ID, TOKEN)) delay(5000); } } void publishMetric(const char* metric, float value, const char* unit) { JsonDocument doc; doc["value"] = value; doc["unit"] = unit; char buf[64]; size_t n = serializeJson(doc, buf, sizeof(buf)); mqtt.publish((prefix + "env/" + metric).c_str(), (const uint8_t*)buf, n, false); } unsigned long lastReport = 0; void setup() { WiFi.begin("home-net", "wifi-password"); while (WiFi.status() != WL_CONNECTED) delay(250); connectMqtt(); } void loop() { if (!mqtt.connected()) connectMqtt(); mqtt.loop(); if (millis() - lastReport >= 60000) { // report once a minute publishMetric("temperature", 21.4, "C"); lastReport = millis(); } } ``` Notes for C++: - **ESP8266 TLS needs the buffer trim**: `net.setBufferSizes(512, 512)` (BearSSL) keeps the handshake inside the heap; on ESP32 this isn't needed. - **Cert validation**: `setInsecure()` encrypts but doesn't validate. To validate, sync the clock (`configTime`) and pin ISRG Root X1. On ESP8266 use `net.setTrustAnchors(&trust)` with a `BearSSL::X509List`; on ESP32, `net.setCACert(pem)`. - PubSubClient publishes at QoS 0 with a default 256-byte packet limit. The `mqtt.setBufferSize(512)` above gives JSON payloads headroom. ### Anything else Any MQTT 3.1.1 client works the same way: host `ingest.tissue.dev`, port `8883`, TLS, username = `device_id`, password = token, publish inside your topic prefix. A Raspberry Pi / laptop smoke test with the [Mosquitto](https://mosquitto.org/) client tools (macOS: `brew install mosquitto`; Debian/Ubuntu: `sudo apt install mosquitto-clients`; Windows: `winget install EclipseFoundation.Mosquitto`): ```bash mosquitto_pub -h ingest.tissue.dev -p 8883 --tls-use-os-certs \ -u dev_a1b2c3d4 -P key_<64 hex chars> \ -t 'tissue/acct_9c3f21ab/dev_a1b2c3d4/temperature' \ -m '{"value":21.4,"unit":"C"}' ``` (`--tls-use-os-certs` validates against your system's trusted CAs and works the same on macOS, Linux, and Windows. On mosquitto older than 2.0.11, pass `--cafile /etc/ssl/cert.pem` (macOS) or `--cafile /etc/ssl/certs/ca-certificates.crt` (Linux) instead.) For Tasmota-style firmware, set the MQTT host/port/user/password in its UI and configure the telemetry topic to sit inside the device's prefix. > **TLS validation.** The MicroPython example (like most microcontroller setups) encrypts the connection but skips certificate validation, because shipping a CA bundle on-device is fiddly. That protects credentials from passive listeners but not from an active man-in-the-middle. For production devices, pin the Let's Encrypt root (ISRG Root X1) and use `ssl.CERT_REQUIRED`. On desktop-class clients (`mosquitto_pub`, Python + paho) always validate; it's one flag. --- ## Step 4: verify Publish once, then check the Cell received it: ```bash curl https://my-sensors..tissue.dev/ # → your fetch() handler's latest-readings JSON # or straight into the database: ribo db exec readings "SELECT * FROM readings ORDER BY ts DESC LIMIT 5" ``` --- ## Cloud to device: subscribing and triggering actions Everything above is uplink, device to Cell. The same MQTT connection works the other way: the device **subscribes** to a command topic inside its own namespace, and your Cell publishes to it. That's how a Cell blinks an LED, starts a motor, or moves a servo on real hardware. By convention, commands live under the device's `cmd/` prefix: `tissue///cmd/`. A device may only subscribe within its own namespace (broker-enforced, same as publishing), and `cmd/*` messages are **never dispatched into your Cell's `sensor()` handler**, so a command can't echo back and masquerade as a reading. ### Device side: subscribe (MicroPython) Extend the reporting example: set a callback, subscribe once after connect, and poll `check_msg()` in the loop. The callback decodes the action from the last topic segment: ```python import json from machine import Pin, PWM led = Pin(2, Pin.OUT) # onboard LED (active-low on ESP8266) servo = PWM(Pin(14), freq=50) # servo signal on GPIO14 (D5); external 5V supply! def on_cmd(topic, msg): action = topic.decode().rsplit("/", 1)[-1] body = json.loads(msg) if msg else {} if action == "led": led.value(0 if body.get("on") else 1) # active-low elif action == "servo": angle = min(180, max(0, int(body.get("angle", 90)))) servo.duty(40 + angle * 75 // 180) # ~0.5–2.4 ms pulse; tune per servo client.set_callback(on_cmd) client.subscribe((PREFIX + "/cmd/#").encode()) while True: client.check_msg() # non-blocking: handles at most one pending command # ... read sensor, publish, sleep ... ``` ### Device side: subscribe (Arduino / C++) Same three moves with PubSubClient: set a callback, subscribe after (every) connect, and the `mqtt.loop()` you already call delivers messages. Extending the C++ reporting client above: ```cpp #include Servo servo; // signal on D5 (GPIO14); external 5V supply! void onCmd(char* topic, byte* payload, unsigned int length) { String t(topic); String action = t.substring(t.lastIndexOf('/') + 1); JsonDocument body; if (deserializeJson(body, payload, length) != DeserializationError::Ok) return; if (action == "led") { // Onboard LED is active-low on the ESP8266 digitalWrite(LED_BUILTIN, body["on"] ? LOW : HIGH); } else if (action == "servo") { int angle = constrain((int)(body["angle"] | 90), 0, 180); servo.write(angle); } } void setup() { pinMode(LED_BUILTIN, OUTPUT); servo.attach(14); // D5 on a D1 mini // ... Wi-Fi + connectMqtt() as in the reporting client ... mqtt.setCallback(onCmd); mqtt.subscribe((prefix + "cmd/#").c_str()); } ``` One subtlety: subscriptions don't survive a reconnect, so re-issue `mqtt.subscribe(...)` inside `connectMqtt()` (right after a successful `mqtt.connect`) so a Wi-Fi blip doesn't silently stop command delivery. Two hardware notes: drive motors and servos from their **own power supply** (a servo can pull an amp; the board's 3V3 regulator can't), sharing only ground with the board; and treat commands as **best-effort** (QoS 0, no queueing): if the device is offline when the command is published, it's gone. Design commands to be safe to repeat. ### Cell side: publish a command Cells can't hold an MQTT connection, so they publish through the downlink HTTP endpoint using the **device's own credentials**. The topic is *relative* to the device's namespace, and a credential can never publish outside it: ```js // in your Cell, e.g. from fetch() on a button press, or from pulse() on a schedule await fetch("https://ingest.tissue.dev/publish", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ device_id: "dev_a1b2c3d4", token: env.DEVICE_TOKEN, // store as a vault binding, never in code topic: "cmd/led", // → tissue//dev_a1b2c3d4/cmd/led payload: { on: true }, }), }); ``` `payload` is published verbatim as JSON (a JSON string publishes its raw bytes). The response is `{"ok":true,"topic":""}`. Keep the device token in a [vault binding](https://docs.tissue.systems/docs/ribo/reference/) (`ribo vault set DEVICE_TOKEN`) so it never appears in your source. A satisfying first test needs no firmware at all: subscribe from your laptop as the device, then publish from anywhere: ```bash mosquitto_sub -h ingest.tissue.dev -p 8883 --tls-use-os-certs \ -u dev_a1b2c3d4 -P key_... \ -t 'tissue/acct_9c3f21ab/dev_a1b2c3d4/cmd/#' -v & curl -X POST https://ingest.tissue.dev/publish \ -H 'content-type: application/json' \ -d '{"device_id":"dev_a1b2c3d4","token":"key_...","topic":"cmd/led","payload":{"on":true}}' # the subscriber prints: tissue/.../cmd/led {"on":true} ``` --- ## Troubleshooting | Symptom | Likely cause | |---|---| | CONNECT refused / auth failure | Wrong `device_id`/token pair, or the device was [disabled](https://docs.tissue.systems/docs/synapse/devices/). Rotate the token if it's lost; it can't be recovered. | | TLS handshake fails on-device | RAM pressure (ESP8266), or an old firmware needing the `ssl_params` form. Try the `mosquitto_pub` smoke test from a laptop to confirm the credentials are good. | | Publishes succeed, nothing reaches the Cell | Topic outside your `tissue///` prefix (synapse silently rejects), or you're over the [rate limits](https://docs.tissue.systems/docs/synapse/devices/) (over-rate messages are dropped, not queued). | | Readings arrive but the table is empty | Your `sensor()` handler threw; check that the payload you publish matches what the handler parses. | --- ## See also - [Synapse overview](https://docs.tissue.systems/docs/synapse/overview/): transports, topics, payloads, the full example Cell - [Managing devices](https://docs.tissue.systems/docs/synapse/devices/): disable, rotate, delete; credential model; rate limits - [Sensor API reference](https://docs.tissue.systems/docs/synapse/api/): `/v1/sensors/*` REST endpoints for automation --- # Synapse: sensor ingest / API reference Source: https://docs.tissue.systems/docs/synapse/api/ # Sensor API reference The `/v1/sensors/*` endpoints are the **device registry** for [synapse](https://docs.tissue.systems/docs/synapse/overview/): register, list, inspect, disable, rotate, and revoke the devices that publish telemetry to your Cells. Synapse reads this registry to authenticate each MQTT connection. **Base URL**: `https://api.tissue.systems` **Authentication**: `Authorization: Bearer `, where `` is a CLI JWT or a `tok_` API token. Each endpoint lists the [scope](https://docs.tissue.systems/docs/api/) it requires. The same operations are available through the [`ribo sensor` CLI](https://docs.tissue.systems/docs/ribo/reference/) and the MCP tools (`sensor_list_devices`, `sensor_get_device`, `sensor_register_device`, `sensor_set_device_enabled`, `sensor_rotate_device_token`, `sensor_delete_device`). --- ## Register a device `POST /v1/sensors/{cell}/devices` (scope `cells:write`) Registers a new device under the Cell and returns its credentials. The token is returned **once** and only stored as a SHA-256 hash. ```bash curl -X POST https://api.tissue.systems/v1/sensors/my-cell/devices \ -H "Authorization: Bearer $TISSUE_TOKEN" ``` ```json { "device_id": "dev_a1b2c3d4", "token": "key_0f1e2d3c...", "account_id": "acct_9c3f21ab", "cell": "my-cell", "cell_address": "9c3f21abx7k2p", "topic_prefix": "tissue/acct_9c3f21ab/dev_a1b2c3d4/", "note": "Save the token now — it is not shown again." } ``` --- ## List devices for a Cell `GET /v1/sensors/{cell}/devices` (scope `cells:read`) Lists the devices registered to one Cell. ```bash curl https://api.tissue.systems/v1/sensors/my-cell/devices \ -H "Authorization: Bearer $TISSUE_TOKEN" ``` ```json { "cell": "my-cell", "devices": [ { "device_id": "dev_a1b2c3d4", "auth_type": "token", "enabled": 1, "created_at": 1751328000 } ] } ``` --- ## List all devices in the account `GET /v1/sensors/devices` (scope `cells:read`) Lists every device provisioned under the account, across all Cells. Each device is annotated with its owning `cell` name (`null` if the Cell no longer exists). ```bash curl https://api.tissue.systems/v1/sensors/devices \ -H "Authorization: Bearer $TISSUE_TOKEN" ``` ```json { "account_id": "acct_9c3f21ab", "count": 2, "devices": [ { "device_id": "dev_a1b2c3d4", "cell_address": "9c3f21abx7k2p", "auth_type": "token", "enabled": 1, "home_region": null, "created_at": 1751328000, "cell": "my-cell" } ] } ``` --- ## Get a device `GET /v1/sensors/{cell}/devices/{device_id}` (scope `cells:read`) Fetches a single device's registry record. The token is never returned; only its hash is stored. ```bash curl https://api.tissue.systems/v1/sensors/my-cell/devices/dev_a1b2c3d4 \ -H "Authorization: Bearer $TISSUE_TOKEN" ``` ```json { "device_id": "dev_a1b2c3d4", "cell_address": "9c3f21abx7k2p", "auth_type": "token", "enabled": 1, "home_region": null, "created_at": 1751328000, "topic_prefix": "tissue/acct_9c3f21ab/dev_a1b2c3d4/", "cell": "my-cell" } ``` --- ## Enable or disable a device `PATCH /v1/sensors/{cell}/devices/{device_id}` (scope `cells:write`) Toggles the device's `enabled` flag without deleting it. A disabled device is refused at MQTT CONNECT by synapse; its identity and history are preserved. ```bash curl -X PATCH https://api.tissue.systems/v1/sensors/my-cell/devices/dev_a1b2c3d4 \ -H "Authorization: Bearer $TISSUE_TOKEN" \ -H "Content-Type: application/json" \ -d '{"enabled": false}' ``` ```json { "device_id": "dev_a1b2c3d4", "cell": "my-cell", "enabled": false } ``` --- ## Rotate a device token `POST /v1/sensors/{cell}/devices/{device_id}/rotate` (scope `cells:write`) Issues a new token for the device, keeping its `device_id` stable. The old token is invalidated **immediately**. The new token is returned once. ```bash curl -X POST https://api.tissue.systems/v1/sensors/my-cell/devices/dev_a1b2c3d4/rotate \ -H "Authorization: Bearer $TISSUE_TOKEN" ``` ```json { "device_id": "dev_a1b2c3d4", "token": "key_aa11bb22...", "account_id": "acct_9c3f21ab", "cell": "my-cell", "topic_prefix": "tissue/acct_9c3f21ab/dev_a1b2c3d4/", "note": "Save the token now — it is not shown again. The previous token no longer works." } ``` --- ## Delete a device `DELETE /v1/sensors/{cell}/devices/{device_id}` (scope `cells:delete`) Revokes a device. Its credentials stop working immediately and its registry row is removed. Returns `204 No Content`. ```bash curl -X DELETE https://api.tissue.systems/v1/sensors/my-cell/devices/dev_a1b2c3d4 \ -H "Authorization: Bearer $TISSUE_TOKEN" ``` --- ## See also - [Synapse overview](https://docs.tissue.systems/docs/synapse/overview/): how ingest works end to end - [Managing devices](https://docs.tissue.systems/docs/synapse/devices/): the credential model and lifecycle - [REST API](https://docs.tissue.systems/docs/api/): the full `/v1` API and scope model --- # ribo CLI / CLI reference Source: https://docs.tissue.systems/docs/ribo/reference/ # ribo CLI reference `ribo` is the command-line tool for tissue.systems. The name comes from the **ribosome**, the molecular machine inside every living cell that reads genetic instructions and assembles proteins from them. In the same way, `ribo` reads your `ribo.toml` and assembles a running Cell from your code. Complete reference for every `ribo` command. --- ## ribo login Authenticate with tissue.systems. Opens a browser for the OAuth flow, then stores a token locally. ```bash ribo login ``` Token is saved at `~/.config/ribo/token.json`, the same path on every platform (macOS included; there is no `Library/Application Support` variant). **Flags** | Flag | Description | |-----------------------|------------------------------------------------------------------| | `--auth-server ` | Auth server URL (default: `https://auth.tissue.systems`) | | `--key ` | Skip the browser; save a pre-issued API key directly | ```bash # Standard browser login ribo login # Save a key directly (CI, scripts) ribo login --key eyJhbGciOiJIUzI1NiJ9... # Authenticate against a different auth server (e.g. staging) ribo login --auth-server https://auth.staging.tissue.systems ``` --- ## ribo logout Remove a stored token. ```bash ribo logout [--server ] ``` **Flags** | Flag | Description | |------------------|-------------------------------------------------------------------------| | `--server ` | Log out from this server only. Omit to remove credentials for all servers. | ```bash ribo logout # forget all stored tokens ribo logout --server https://api.tissue.systems # forget one server's token ``` --- ## RIBO_TOKEN Set the `RIBO_TOKEN` environment variable to authenticate without a stored token file. Any command that requires auth reads `RIBO_TOKEN` first and skips the disk lookup entirely. ```bash export RIBO_TOKEN=tok_a1b2c3... ribo deploy ribo list ribo db exec myapp "SELECT * FROM users" ``` `RIBO_TOKEN` is the standard way to authenticate in CI/CD pipelines, automated scripts, and containerised environments where running `ribo login` interactively is not possible. **Obtaining a token** Create a scoped API token with [`ribo token create`](#ribo-token): ```bash ribo token create "github-actions" --scope cells:write --scope cells:read # → tok_a1b2c3d4e5f6... ``` Store the token as a secret in your CI environment (`RIBO_TOKEN`). It never expires unless you revoke it with `ribo token revoke`. **Precedence** `RIBO_TOKEN` outranks every other credential source. The full order is: 1. `RIBO_TOKEN`: process-scoped 2. `--profile `: one command 3. the nearest bound ancestor directory (see [`ribo profile`](#ribo-profile)) 4. the default profile: `ribo login` Because it is an environment variable, `RIBO_TOKEN` is already isolated per process: parallel CI jobs on one runner cannot clobber each other's credentials. **Example: GitHub Actions** ```yaml - name: Deploy Cell env: RIBO_TOKEN: ${{ secrets.RIBO_TOKEN }} run: ribo deploy ``` --- ## ribo deploy Deploy a Cell from a `ribo.toml` configuration file. If a `build` command is defined, it runs first. ```bash ribo deploy [--config ] [--server ] [--yes] [--prune] [--unpublish-config] ``` **Flags** | Flag | Default | Description | |----------------------|----------------------------------|-------------------------| | `--config ` | `./ribo.toml` | Path to the config file | | `--server ` | `TISSUE_SERVER`, else `[server] url` from `ribo.toml`, else `https://api.tissue.systems` | Management API URL | | `-y`, `--yes` | off | Run the `build` command without asking. A deploy from a script needs this, because a non-interactive session cannot answer the prompt | | `--prune` | off | Delete every object in a [`files`](https://docs.tissue.systems/docs/cells/configuration/#files-static-file-tree) bucket that has no local counterpart. A deploy never deletes without it | | `--unpublish-config` | off | Delete published manifests, `.env` files and `.git` objects from the `files` bucket, and stop uploading them. Only those keys; see below | **Binding types are checked before anything is uploaded** `ribo deploy` refuses a `[[bindings]]` block whose `type` is not one of `c3`, `text`, `g7`, `files` or `vault`, and names the five in the error. The check is case-sensitive, so `type = "C3"` is refused too and says so. See [`[[bindings]]`](https://docs.tissue.systems/docs/cells/configuration/#bindings) for what each type does. **What a `files` binding publishes** A `files` binding uploads every regular file beneath its `dir`, and the bucket serves each one under its own name. There is no exclusion list and no default `dir`: a binding written `dir = "."` publishes `ribo.toml`, any `.env` file beside it and the whole `.git` directory, at URLs that are guessable from the Cell's own hostname. Deploy names those objects when it finds them, prints the URLs they answer on, and gives the steps to fix it. It's a warning, not a refusal: by the time it prints, the objects are already public, so declining to upload them would undo nothing, and a Cell that serves its manifest deliberately keeps working. The fix is a `dir` that contains only what the site serves. `--unpublish-config` handles the objects already in the bucket: it deletes exactly those keys and leaves everything else alone. Run it even after `dir` is corrected, because the bucket is named for the binding rather than for the directory: changing `dir` stops the uploads but does not remove what earlier deploys put there. ```bash ribo deploy --unpublish-config ``` **Output** account Acme Corp (acct_3f8c1a2b4d6e8f00) [pinned] server https://api.tissue.systems deployed my-cell address 33ed412f7x2kp kind js url https://my-cell.strand-9c.tissue.dev c3 DB→my-database text GREETING vault JWT_SECRET g7 STORE→raw-uploads files ASSETS→33ed412f-assets (18 files) pulse 0 * * * * - `account`: the account the deploy targets, and whether the project is `[pinned]` or `[unpinned]` to it (see [`ribo account pin`](#ribo-account-pin)) - `server`: the management API the deploy was sent to - `url`: where the Cell is reachable, always on the `server` above: its public URL, or a path-based `http://localhost:8080/
` when the deploy targeted a management server on this machine - `address`: stable ID assigned on first deploy; never changes between redeploys - `c3`: c3 bindings (binding name → database name) - `text` / `vault`: text and vault binding names (each line only shown if declared) - `g7`: g7 bindings (binding name → bucket name) - `files`: FILES bindings (binding name → bucket name, file count) - `pulse`: comma-separated cron schedules (only shown if `[[pulse]]` is declared) **Examples** ```bash ribo deploy ribo deploy --config ./prod/ribo.toml ribo deploy --server http://localhost:8082 ``` --- ## ribo local Serve this Cell on your machine: the V8 isolate runtime, c3, g7 and a management API, all on localhost, then deploy the Cell in this directory into them. ```bash ribo local [--config ] [--runtime ] [--no-deploy] [--no-watch] ``` **Flags** | Flag | Default | Description | |--------------------|----------------|-----------------------------------------------------------------| | `--config ` | `./ribo.toml` | Config file to deploy | | `--runtime ` | the ribo cache | Runtime executable, or a directory holding one | | `--no-deploy` | off | Start the services without deploying the Cell in this directory | | `--no-watch` | off | Deploy once and stop there, instead of redeploying on every save | **Output** starting c3 · g7 · api · runtime ready runtime 2026.08.014 :8080 · c3 :8081 · g7 :8083 · api :8082 account Acme Corp (acct_3f8c1a2b4d6e8f00) deployed my-cell (js) url http://localhost:8080/33ed412f7x2kp files FILES→33ed412f7x2kp-files (12 files: 12 uploaded, 0 unchanged) watching /Users/you/my-cell (3 dirs) — a save redeploys Ctrl-C to stop. From there the terminal carries what the Cell prints: `console.log` output as it arrives, and any uncaught exception with the request path and stack frames. Saving a file redeploys the Cell and prints what moved: changed cell.js reloaded my-cell (js) files FILES→33ed412f7x2kp-files (12 files: 0 uploaded, 12 unchanged) The runtime is downloaded on first use and cached by version; the other three services are `ribo` itself. Ports are fixed. Ctrl-C stops everything. This is the one command that does not need a token: with no credential the stack still runs and the deploy reads `account `. ### ribo local stop Stop a stack whose terminal was closed while it was still running. ```console $ ribo local stop stopped c3 (54130) stopped g7 (54132) stopped api (54133) stopped runtime (54134) ``` With nothing running, prints `No local stack recorded as running.` Full guide, including how to create local databases and buckets and what the local stack does not do: [Local development](https://docs.tissue.systems/docs/ribo/local/). --- ## ribo list List all your deployed Cells. ```bash ribo list [--server ] ``` ADDRESS NAME URL 33ed412f7x2kp my-cell https://my-cell.strand-9c.tissue.dev 33ed412fq81mz another-cell https://another-cell.strand-9c.tissue.dev Columns: address, name, public URL. If you have no Cells, prints `No cells deployed.` --- ## ribo delete Remove a deployed Cell permanently. The URL stops working immediately. ```bash ribo delete [--server ] ``` ```bash ribo delete my-cell ribo delete ab1cd2 ``` --- ## ribo invoke Call a named function exported by a deployed Cell and print the response. The Cell is resolved by name (or address) and the request is sent as an HTTP `POST`. ```bash ribo invoke [--args ''] [--server ] ``` **Arguments** | Argument | Description | |----------------------|--------------------------------------------------------------------| | `` | The Cell to invoke, by name or address | | `` | The exported function name to call | **Flags** | Flag | Default | Description | |------------------|---------------------------|--------------------------------------------------------| | `--args ` | none | A JSON array of arguments to pass to the function | | `--server ` | `http://localhost:8080` | Runtime URL to send the invocation to | The response body is pretty-printed when it is valid JSON, otherwise printed as-is. A non-2xx status causes `ribo` to exit non-zero. ```bash # Call with no arguments ribo invoke my-cell ping # Pass a JSON array of arguments ribo invoke my-cell add --args '[2, 3]' # → 5 # JSON responses come back pretty-printed, one element per line ribo invoke spellcheck suggest --args '["wrold"]' # → [ # "world" # ] ``` --- ## ribo addr Look up the address of a deployed Cell by name. ```bash ribo addr ``` ```bash ribo addr my-cell # → dd0d1cd5kq5bs ``` Returns the address only if the Cell has already been deployed. Useful for scripting or verifying which address a name maps to. --- ## ribo db Manage c3 SQLite databases. See [c3 Overview](https://docs.tissue.systems/docs/c3/overview/) for usage in Cells. For `ribo db` (and the other grouped commands: `bucket`, `vault`, `token`, `sensor`, `domain`, `account`), `--server` is a global flag on the group and works in **either position**: `ribo db --server list` and `ribo db list --server ` both parse. The synopses below show it before the subcommand, but placing it after works just as well. ### ribo db create ```bash ribo db [--server ] create ``` Create a new database. Names must be lowercase alphanumeric with hyphens. ```bash ribo db create myapp ribo db create analytics ``` ### ribo db list ```bash ribo db [--server ] list ``` List all your databases. myapp analytics ### ribo db drop ```bash ribo db [--server ] drop ``` Delete a database and all its data. **Irreversible.** ### ribo db exec ```bash ribo db [--server ] exec [""] [--file ] ``` Run a SQL statement or load a `.sql` file. Output is pretty-printed JSON for inline queries. Use `--file` for multi-statement migrations; it uses `execute_batch` internally, so it handles any number of statements efficiently in a single request. **Flags** | Flag | Description | |----|----| | `--file `, `-f ` | Path to a `.sql` file. Executes all statements in the file. Use this for schema migrations and bulk data loads. | ```bash ribo db exec myapp "CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, email TEXT UNIQUE)" ribo db exec myapp "INSERT INTO users (email) VALUES ('hello@example.com')" ribo db exec myapp "SELECT * FROM users" # → [ # { # "id": 1, # "email": "hello@example.com" # } # ] ribo db exec myapp "SELECT COUNT(*) as total FROM users" ribo db exec myapp "PRAGMA table_info(users)" # Load a schema or seed file (any number of statements) ribo db exec myapp --file schema.sql ribo db exec myapp --file ./migrations/001_init.sql ``` --- ## ribo bucket Manage g7 object storage buckets. See [g7 Overview](https://docs.tissue.systems/docs/g7/overview/) and [Managing buckets](https://docs.tissue.systems/docs/g7/buckets/) for details. ### ribo bucket create ```bash ribo bucket [--server ] create [--public] ``` Create a new bucket. Names must be lowercase alphanumeric with hyphens. Creating a bucket that already exists is an error. The name `g7-token` is reserved and cannot be used. **Flags** | Flag | Description | |------------|------------------------------------------------------------------------------------------------------| | `--public` | Allow anonymous (unauthenticated) `GET`/`HEAD` on objects in this bucket. Off by default; buckets are private. | ```bash ribo bucket create avatars ribo bucket create raw-uploads ribo bucket create public-assets --public # objects are world-readable ``` ### ribo bucket list ```bash ribo bucket [--server ] list ``` List all your buckets. avatars raw-uploads processed-images ### ribo bucket ls ```bash ribo bucket [--server ] ls ``` List the objects (files) stored in a bucket. ```bash ribo bucket ls my-files ``` 42318 images/avatar.png 198432 images/banner.jpg 81920 reports/2026-05.pdf Columns: size in bytes (right-aligned), key. An empty bucket prints `(empty)`. ### ribo bucket cp ```bash ribo bucket [--server ] cp [-r|--recursive] ``` Copy files between your machine and a bucket, with no S3 client or credentials needed. One of ``/`` is a local path; the other is a `bucket:key` reference. The direction (upload vs download) is inferred from which side carries the `bucket:` prefix. When the destination key is empty or ends with `/`, the source file name is appended. Pass `-r` to copy a whole directory tree (uploads) or every object under a key prefix (downloads). ```bash # upload a single file ribo bucket cp ./photo.jpg my-files:photos/photo.jpg ribo bucket cp ./photo.jpg my-files:photos/ # key becomes photos/photo.jpg # download a single object ribo bucket cp my-files:photos/photo.jpg ./photo.jpg ribo bucket cp my-files:photos/photo.jpg ./out/ # writes ./out/photo.jpg # recursive (directory ⇄ key prefix) ribo bucket cp -r ./dist my-files:site/ # upload a tree ribo bucket cp -r my-files:site/ ./restore # download a tree ``` Each object must fit in a single request; the per-object ceiling is 100 MiB (see [Limitations](https://docs.tissue.systems/docs/g7/limitations/)). ### ribo bucket sync ```bash ribo bucket [--server ] sync [--delete] [--dry-run] ``` One-way sync between a local directory and a bucket prefix. As with `cp`, the direction is inferred from which side is the `bucket:` reference. A file is transferred only when it is **missing** at the destination, when **sizes differ**, or when sizes match but the **content differs** (local MD5 compared against the object's etag). Unchanged files are skipped. | Flag | Effect | | --- | --- | | `--delete` | Remove destination files/objects that no longer exist at the source | | `--dry-run` | Print the planned uploads, downloads, and deletions without making any changes | ```bash ribo bucket sync ./dist my-files:site/ # push a build, skip unchanged files ribo bucket sync ./dist my-files:site/ --delete # mirror exactly (prune removed files) ribo bucket sync my-files:backups/ ./restore # pull a tree down ribo bucket sync ./dist my-files:site/ --dry-run # preview only ``` ### ribo bucket rm ```bash ribo bucket [--server ] rm : [-r|--recursive] ``` Delete a single object. With `-r`, delete **every** object under the given key prefix. `ribo bucket rm -r my-files:` empties the bucket, which is what [`ribo bucket drop`](#ribo-bucket-drop) requires before it will delete the bucket itself. ```bash ribo bucket rm my-files:photos/photo.jpg # one object ribo bucket rm -r my-files:photos/ # everything under photos/ ``` ### ribo bucket drop ```bash ribo bucket [--server ] drop ``` Delete an empty bucket. **Irreversible.** A bucket that still holds objects is refused with `409`; empty it first. ```bash ribo bucket rm -r old-uploads: # empty it ribo bucket drop old-uploads # then drop it ``` ### ribo bucket set ```bash ribo bucket [--server ] set (--public | --private) ``` Change an existing bucket's public-read setting. Exactly one of `--public` or `--private` is required. | Flag | Description | |-------------|--------------------------------------------------------| | `--public` | Allow anonymous `GET`/`HEAD` on objects in the bucket | | `--private` | Disallow anonymous access (the default for new buckets) | ```bash ribo bucket set avatars --public # make existing objects world-readable ribo bucket set avatars --private # lock it back down ``` ### ribo bucket token Manage the g7 API bearer token for your account. This token authenticates direct calls to the g7 object storage HTTP API (Cells using a `g7` binding don't need it; they go through a service binding). The token is shown in full only once, at creation or rotation. ```bash ribo bucket token create # mint a token (if none exists) ribo bucket token rotate # replace the token, invalidating the old one ribo bucket token show # show token metadata (prefix, created/rotated dates); never the token itself ribo bucket token revoke # delete the token ``` ```bash ribo bucket token create # ✓ Created token: g7_live_a1b2c3... # This is the only time the full token is shown — store it securely. # Prefix for future reference: g7_live_a1b2 ribo bucket token show # Prefix: g7_live_a1b2 # Created: 2026-05-25T12:00:00Z ``` --- ## ribo vault Manage a Cell's **vault**: encrypted secrets stored server-side and injected into the Cell at dispatch time. Use the vault for API keys, signing secrets, database credentials, and any value too sensitive to put in `ribo.toml` (where it would be committed to source control). A vault entry is consumed by a `type = "vault"` binding in `ribo.toml`. The binding declares only the **key name**; the value is set separately with `ribo vault set` and never appears in your config or in command output once stored: ```toml [[bindings]] type = "vault" binding = "JWT_SECRET" # env.JWT_SECRET at runtime ``` See [ribo.toml Reference → vault](https://docs.tissue.systems/docs/cells/configuration/#vault-encrypted-secret) for the binding side, and the [Vault security model](https://docs.tissue.systems/docs/cells/vault-security/) for how stored values are protected (encryption at rest, dispatch-time injection, auditing, rotation). > **Set vault values before deploying.** A `vault` binding must have its value set with `ribo vault set` **before** you run `ribo deploy`. If the value is missing at deploy time, the binding is stored as a placeholder and the Cell receives that placeholder string instead of the real secret, a silent failure (e.g. JWT verification that never succeeds). The `` argument is the cell name as written in `[cell] name` in `ribo.toml`. ### ribo vault set ```bash ribo vault [--server ] set [--env ] ``` Set (or overwrite) a vault value. By default `ribo` prompts for the value with hidden input, so the secret never appears on screen or in your shell history. Alternatively, read it from an environment variable with `--env`, or pipe it on stdin. **Flags** | Flag | Description | |----------------|----------------------------------------------------------------------------| | `--env ` | Read the value from environment variable `VAR` instead of prompting | ```bash # Interactive: prompts for hidden input ribo vault set my-cell JWT_SECRET # Value for JWT_SECRET: ******** # ✓ Set vault value JWT_SECRET for my-cell # Non-interactive: read from an env var (CI / scripts) export JWT_SECRET="s3cr3t-signing-key" ribo vault set my-cell JWT_SECRET --env JWT_SECRET # Pipe a value on stdin echo -n "s3cr3t-signing-key" | ribo vault set my-cell JWT_SECRET ``` ### ribo vault list ```bash ribo vault [--server ] list ``` List the vault **key names** set for a Cell. Values are never shown; there is no command that reveals a stored secret. ```bash ribo vault list my-cell # JWT_SECRET # STRIPE_API_KEY # DATABASE_URL ``` If no entries exist, prints `No vault entries.` ### ribo vault delete ```bash ribo vault [--server ] delete ``` Remove a single vault entry. The next deploy of the Cell will no longer inject that binding. ```bash ribo vault delete my-cell STRIPE_API_KEY # ✓ Deleted vault value STRIPE_API_KEY for my-cell ``` --- ## ribo token Manage **API tokens** (`tok_` credentials) for the `/v1` management API. API tokens are the recommended way to authenticate scripts, CI/CD pipelines, and MCP integrations: they carry an explicit list of scopes and can be revoked individually without affecting your interactive `ribo login` session. Set a token as [`RIBO_TOKEN`](#ribo-token) to use it. ### ribo token create ```bash ribo token [--server ] create [--scope ]... ``` Create a new API token. The full token value is printed **once** at creation; store it securely, as it cannot be retrieved again. **Arguments** | Argument | Description | |----------|--------------------------------------------------------| | `` | A descriptive name for the token (e.g. `"CI pipeline"`) | **Flags** | Flag | Description | |-------------------|------------------------------------------------------------------------------------------------| | `--scope ` | A scope to grant. Repeat the flag to grant multiple scopes. A token with no scopes can do nothing. | **Scopes** follow a `resource:action` form. The available scopes are: | Resource | Actions | |-------------|--------------------------| | `cells` | `read`, `write`, `delete` | | `databases` | `read`, `write`, `delete` | | `buckets` | `read`, `write`, `delete` | | `vault` | `read`, `write` | | `domains` | `read`, `write`, `delete` | | `vesicle` | `read`, `write`, `delete` | | `mast` | `read`, `write` | | `account` | `read`, `write` | ```bash ribo token create "github-actions" --scope cells:write --scope cells:read # ✓ Created token: github-actions # id: tok_a1b2c3 # scopes: cells:write, cells:read # token: tok_a1b2c3d4e5f6... # This is the only time the full token is shown — store it securely. ``` ### ribo token list ```bash ribo token [--server ] list ``` List your API tokens with their ID, name, scopes, creation time, and last-used time. The token values themselves are never shown. ```bash ribo token list # tok_a1b2c3 # name: github-actions # scopes: cells:write, cells:read # created: 2026-05-25T12:00:00Z # used: 2026-05-26T08:14:00Z ``` ### ribo token revoke ```bash ribo token [--server ] revoke ``` Revoke a token by its ID (the `tok_...` value shown in `ribo token list`). The token stops working immediately. ```bash ribo token revoke tok_a1b2c3 # ✓ Revoked token tok_a1b2c3 ``` **Who may revoke what.** A token can always revoke *itself*, whatever its scopes, so a script that thinks it has been compromised can retire its own credential with nothing granted in advance. Revoking a **different** token is account management and requires `account:write`; without it the request is refused with **403**. This means a narrowly-scoped token that leaks (a `cells:read` CI token, say) cannot lock you out of your own account by revoking everything else. Your interactive `ribo login` session holds every scope, so `ribo token revoke ` works normally from your own terminal. --- ## ribo sensor Manage IoT/sensor **devices** registered under a Cell. A device is an external client (a microcontroller, gateway, or script) that publishes telemetry over MQTT, which the platform ingests and routes to your Cell. Each device gets its own credentials and can be revoked independently. See [Managing devices](https://docs.tissue.systems/docs/synapse/devices/) for the full device lifecycle, including enable/disable and token rotation (available via the REST API). ### ribo sensor add ```bash ribo sensor [--server ] add ``` Register a new device under a Cell. Prints the `device_id`, the MQTT password token, and the topic prefix. The token is shown **once**; save it immediately. ```bash ribo sensor add my-cell # ✓ Registered device for my-cell # # device_id dev_a1b2c3 # token # topic tissue//dev_a1b2c3/ # # Save the token now — it is not shown again. # Connect over MQTT/TLS: username=dev_a1b2c3 password= ``` ### ribo sensor list ```bash ribo sensor [--server ] list ``` List the devices registered to a Cell, with their auth type and enabled status. ```bash ribo sensor list my-cell # DEVICE AUTH ENABLED # dev_a1b2c3 token true ``` ### ribo sensor delete ```bash ribo sensor [--server ] delete ``` Revoke a device. Its credentials stop working immediately. ```bash ribo sensor delete my-cell dev_a1b2c3 # ✓ Deleted device dev_a1b2c3 ``` --- ## ribo vesicle Manage **webhook endpoints** and the deliveries they capture. An endpoint is a URL under `https://api.tissue.systems/hook/` that stores every request sent to it under your account, whether or not a Cell is bound to it yet. See [Vesicle](https://docs.tissue.systems/docs/vesicle/overview/) for the full model, including capture states, retries, and signature verification. `` is an endpoint name in the `endpoint` subcommands and in `tail`, `list` and range replays; `` is a `cap_…` id from `ribo vesicle list`. ### ribo vesicle endpoint create ```bash ribo vesicle [--server ] endpoint create [--cell ] [--route

] [--verify ] [--ack immediate|on-success] ``` Issue an ingest URL. With no `--cell`/`--route` the endpoint is capture-only: it answers `202` and stores what arrives. ```bash ribo vesicle endpoint create github # https://api.tissue.systems/hook/hk_9f3c8a1b... (capture only — no route bound) ``` **Flags** | Flag | Description | |------|-------------| | `--cell ` | Cell that deliveries are dispatched to | | `--route

` | Path they land on, e.g. `/github` | | `--verify ` | `none` (default), `hmac:KEY`, `stripe:KEY`, `github:KEY`, where `KEY` is a vault binding on the bound Cell | | `--ack ` | `immediate` (202 on receipt) or `on-success` (the Cell's response verbatim) | ### ribo vesicle endpoint list ```bash ribo vesicle [--server ] endpoint list ``` List the account's endpoints with their binding state and capture counts. ### ribo vesicle endpoint show ```bash ribo vesicle [--server ] endpoint show ``` One endpoint, including the full ingest URL, `verify` and `ack` settings, and counts by capture state. ### ribo vesicle endpoint bind ```bash ribo vesicle [--server ] endpoint bind --cell --route

ribo vesicle [--server ] endpoint unbind ``` Point an endpoint at a Cell and path, or clear it back to capture-only. The Cell doesn't have to exist yet; the binding resolves at dispatch. Binding delivers **new** arrivals only. Deliveries captured while the endpoint was unbound stay in state `captured` until you replay them. ```bash ribo vesicle endpoint bind github --cell deploy-bot --route /github ``` ### ribo vesicle endpoint set ```bash ribo vesicle [--server ] endpoint set [--verify ] [--ack immediate|on-success] [--retries ] ``` Change an existing endpoint's settings. Only the flags you pass change; the rest stay as they are, and the URL stays the same. Pass at least one. ```bash ribo vesicle endpoint set stripe --verify stripe:STRIPE_WEBHOOK_SECRET ribo vesicle endpoint set stripe --verify none # turn signature checks off ``` **Flags** | Flag | Description | |------|-------------| | `--verify ` | `none`, `hmac:KEY`, `stripe:KEY`, `github:KEY`, same as on `create` | | `--ack ` | `immediate` or `on-success` | | `--retries ` | redeliveries before a failed delivery goes `dead`, `0` to `8` (default `8`); `0` turns redelivery off | ### ribo vesicle endpoint rotate ```bash ribo vesicle [--server ] endpoint rotate ``` Issue a new `hk_` id for the same endpoint. The old id keeps capturing for 7 days and then returns `404`, so deliveries are not dropped while the vendor's settings are updated. ### ribo vesicle endpoint revoke ```bash ribo vesicle [--server ] endpoint revoke ``` Stop the URL answering. Captures already stored survive to their 30-day retention. ### ribo vesicle tail ```bash ribo vesicle [--server ] tail ``` Follow an endpoint and print deliveries as they arrive. Secret-looking headers are named but shown as `«redacted»`. ```bash ribo vesicle tail github # POST · 8437 bytes · content-type: application/json # { "action": "opened", "issue": { "number": 412, "title": "..." }, "repository": {...} } ``` ### ribo vesicle list ```bash ribo vesicle [--server ] list [--state ] [--since ] ``` List stored captures for an endpoint, newest first. `--state` is one of `captured`, `delivered`, `retrying`, `rejected`, `dead`. ### ribo vesicle show ```bash ribo vesicle [--server ] show [--reveal] ``` Print one capture as JSON: headers, body, source address, verification result, and delivery attempts. Secret-looking header names and body keys are `«redacted»` unless `--reveal` is passed, which writes an audit event. Output goes to stdout, so a real delivery becomes a test fixture directly: ```bash ribo vesicle show cap_7b21 > test/fixtures/issue-opened.json ``` ### ribo vesicle replay ```bash ribo vesicle [--server ] replay ribo vesicle [--server ] replay --to ribo vesicle [--server ] replay --all [--since ] [--until ] [--state ] [--dry-run] ``` Redeliver a stored request. A single replay prints the Cell's status, headers and body. `--to` performs the POST **from your own machine**: ribo fetches the capture over the API and sends it itself, so the target can be a local dev runtime with no tunnel involved. The platform never posts to a URL you supply. `--to` implies `--reveal` and inherits its audit event. ```bash ribo vesicle replay cap_7b21 ribo vesicle replay cap_7b21 --to http://localhost:8080/26e9871aq7x2k/github ribo vesicle replay github --all --since 2026-08-11 --dry-run ``` `--dry-run` reports what a range would send and dispatches nothing. ### ribo vesicle drop ```bash ribo vesicle [--server ] drop ``` Delete one capture and its stored body ahead of the 30-day retention. --- ## ribo domain Manage **custom domains** for a Cell: serve a Cell from your own hostname (`app.example.com` or a bare apex like `example.com`) in addition to its `*.tissue.dev` address. See [Custom domains](https://docs.tissue.systems/docs/cells/custom-domains/) for the full walkthrough, including the DNS records each step needs. A domain is **globally unique**: it can be attached to only one account at a time. Connecting one is a three-step flow: register, prove ownership with a TXT record, then point DNS at the Cell. TLS is provisioned automatically once DNS resolves. ### ribo domain add ```bash ribo domain [--server ] add [--cell ] [--config ] ``` Register a domain on a Cell. The Cell is taken from `[cell] name` in `ribo.toml` (`--config` points at a different config file, default `ribo.toml`), or pass `--cell` to target another Cell. Prints the TXT ownership challenge and the CNAME target to point at. ```bash ribo domain add app.example.com # ✓ Registered app.example.com for cell my-api # status: pending # # Add these DNS records at your provider: # # 1. Ownership (TXT) # name _tissue-challenge.app.example.com # value 3f8c1a...e2d9 # # 2. Routing (CNAME — or ALIAS/ANAME for an apex) # name app.example.com # target my-api.strand-9c.tissue.dev # # Then run: ribo domain verify app.example.com ``` ### ribo domain list ```bash ribo domain [--server ] list ``` List the custom domains registered to your account, with their status and the Cell each is attached to. The `CELL` column shows the Cell's **address**, not its name. ```bash ribo domain list # DOMAIN STATUS CELL # app.example.com active 33ed412f7x2kp # example.com verified 33ed412f7x2kp ``` Status is one of `pending` → `verified` → `active`, or `failed` if ownership is lost. ### ribo domain verify ```bash ribo domain [--server ] verify ``` Re-check a domain's DNS and advance its status, from `pending` to `verified` once the TXT challenge is seen, and to `active` once DNS points at the Cell and TLS is provisioned. Run it after adding each DNS record; DNS changes can take a few minutes to propagate. ```bash ribo domain verify app.example.com # ✓ app.example.com — active ``` ### ribo domain rm ```bash ribo domain [--server ] rm ``` Remove a custom domain. It stops serving immediately, and the name is freed for reuse. ```bash ribo domain rm app.example.com # ✓ Removed app.example.com ``` --- ## ribo gate Control who can reach a Cell's public URL. The policy itself lives in the `[gate]` block of `ribo.toml` and deploys with the Cell; `ribo gate` inspects it and manages the moving parts: capability links, viewer sessions, and the email allow list. See [Access control (Gate)](https://docs.tissue.systems/docs/cells/gate/) for the full model. `` is a cell name or address in every subcommand. ### ribo gate status ```bash ribo gate [--server ] status ``` Show the Cell's gate policy, version, source, and active session/link counts. ```bash ribo gate status internal-dash # cell a1b2c3d4e5f6g # audience domain # domains yourco.com # links enabled — 2 active # sessions 5 active # version 3 # source deploy (ribo.toml is authoritative) ``` For an `sso` policy, `status` also lists each configured identity source (name, type, and issuer) and the vault key its client secret is read from (`GATE_OIDC_`). ### ribo gate link ```bash ribo gate [--server ] link [--ttl ] [--path ] [--read-only] ribo gate link --list ribo gate link --revoke ``` Mint a capability link (the default), or list/revoke existing ones. The minted token and URL are shown **once** and can't be recovered, only revoked. **Flags** | Flag | Description | |------------------|--------------------------------------------------------------------| | `--ttl ` | Link lifetime, e.g. `30d` or `12h`; `0` = never expires (default `30d`) | | `--path `| Restrict the link to paths under this prefix, e.g. `/reports` | | `--read-only` | Only allow GET/HEAD requests through this link | | `--list` | List existing links instead of minting one | | `--revoke ` | Revoke a link by id instead of minting one | `ribo gate links ` is a shorthand for `ribo gate link --list`. ### ribo gate sessions ```bash ribo gate [--server ] sessions [--revoke ] [--revoke-all] ``` List active viewer sessions, revoke one by sid, or revoke every session at once (`--revoke-all`: all viewers must sign in again, enforced at the edge immediately). ### ribo gate allow ```bash ribo gate [--server ] allow [--remove] ``` Add an email address to the stored gate's allow list (or remove one with `--remove`) without redeploying. If the policy comes from `ribo.toml`, the next `ribo deploy` restores the file's `allow` list, so make durable changes in the file. --- ## ribo account Manage which **account** your CLI acts on, for logins that belong to more than one. The active account is carried inside your auth token and determines where `ribo deploy` sends Cells and which databases, buckets, and vault secrets you see. Switching re-mints the token. ### ribo account list ```bash ribo account [--server ] list ``` List every account your login can act on. The active one is marked with `*`. ```bash ribo account list # ACCOUNT ID ROLE # * Acme Corp acct_3f8c1a2b4d6e8f00 owner # Personal acct_9zp5k1m3n5p7r9t1 owner ``` ### ribo account whoami ```bash ribo account [--server ] whoami ``` Show the currently active account (name, id, and your role). Run this before a production deploy or delete to confirm you're acting on the right account. ```bash ribo account whoami # Acme Corp (acct_3f8c1a2b4d6e8f00) — owner ``` ### ribo account switch ```bash ribo account [--server ] switch ``` Switch the active account, re-minting your stored token. Accepts an account name (case-insensitive) or an `acct_...` id. Subsequent commands act on the new account until you switch again. ```bash ribo account switch "Acme Corp" # Switched to "Acme Corp" (acct_3f8c1a2b4d6e8f00). ``` ### ribo account pin ```bash ribo account pin [--show] [--config ] ``` Write the active account into the local `ribo.toml` as an [`account_id` pin](https://docs.tissue.systems/docs/cells/configuration/#account-pin), so the project can only be deployed to that account. `--show` prints what would be written without modifying the file. ```bash ribo account pin # Pinned Acme Corp (acct_3f8c1a2b4d6e8f00) in ribo.toml. ``` The pin is an **assertion, not a selector**: it never changes which account is used, it only aborts a deploy that would land in the wrong one. On a mismatch, `ribo deploy` stops *before* uploading anything: ```bash ribo deploy # Error: Refusing to deploy: account mismatch. # # ribo.toml pins Acme Corp (acct_3f8c1a2b4d6e8f00) # active account Personal (acct_9zp5k1m3n5p7r9t1) # ... ``` --- ## ribo mast Tissue Mast from the terminal: `status` (who's on call and the open incidents), `pages`, `send`, `ack` and `resolve`, then `alert-source`, `heartbeats`, `rotations`, `overrides` and `policies`, each with list, show, create, update and delete. `export` prints the account's setup as a `mast.toml` and `apply` makes Mast match one. `import opsgenie` plans and runs an import from Opsgenie. It needs ribo 2026.10.0 or later. ```bash ribo mast status ribo mast send alerts "Disk 95% full on db1" --priority page --dedupe disk-db1 ribo mast export > mast.toml ribo mast apply --dry-run ``` Every command, flag and the file format are on [ribo mast](https://docs.tissue.systems/docs/ribo/mast/). --- ## ribo profile Manage **directory-bound credentials**. A profile is a named login bound to a directory; commands run in that directory, or any subdirectory, authenticate as that profile. This is how two shells, or two agents, work on two different accounts at the same time without either one clobbering the other's login. For the full explanation and recipes, see [Accounts & profiles](https://docs.tissue.systems/docs/ribo/profiles/). ```bash ribo profile ``` `--profile ` is also a **global flag** on every other command: `ribo --profile acme deploy` runs that one command as `acme`, ignoring any directory binding. ### ribo profile create ```bash ribo profile create [--from-current] [--key ] [--auth-server ] ``` Log in and store the credential under ``. **Flags** | Flag | Description | |-----------------------|--------------------------------------------------------------------------------| | `--from-current` | Adopt the credential already in the default login instead of authenticating again | | `--key ` | Skip the browser; store a pre-issued API key under this profile | | `--auth-server ` | Auth server URL (default: `https://auth.tissue.systems`) | ```bash ribo profile create acme # browser login, stored as "acme" ribo profile create acme --from-current # capture the login you already have ribo profile create ci --key tok_a1b2c3... # store an API token as a profile ``` `--from-current` copies the default login's credentials for **every** server it holds, while `ribo account switch` only re-mints the one it targeted. If more than one server is copied, ribo prints a note telling you to verify the others with `ribo --profile account whoami --server `. ### ribo profile activate ```bash ribo profile activate [dir] ``` Bind a directory, and every subdirectory beneath it, to a profile. Defaults to the current directory. ```bash cd ~/work/acme-site && ribo profile activate acme . # ✓ /Users/you/work/acme-site → "acme". # Applies to this directory and every subdirectory. ``` The most specific binding wins: with `~/work` bound to `outer` and `~/work/acme` bound to `acme`, a command in `~/work/acme/site` uses `acme`. ### ribo profile deactivate ```bash ribo profile deactivate [dir] ``` Remove that directory's own binding. If a parent directory still binds it, ribo says what the directory now resolves to rather than letting you assume it fell back to the default login. ### ribo profile list ```bash ribo profile list ``` Every profile with its account, its servers, and its bound directories. The profile in effect for the current directory is marked with `*`. Bindings whose profile no longer exists are listed separately as **dangling**; commands in those directories fail rather than silently using your default login. ### ribo profile delete ```bash ribo profile delete ``` Remove the profile and unbind every directory that pointed at it. The orphaned directories are listed. ### ribo profile which ```bash ribo profile which [--server ] ``` Show what *this* directory will authenticate as, and why. No side effects, so it is safe to run anywhere, and the right thing to put at the top of a deploy script or an agent's checklist. ```bash ribo profile which # directory /Users/you/work/acme-site # credential profile "acme" (bound at /Users/you/work/acme-site) # server https://api.tissue.systems # account Acme Corp (acct_3f8c1a2b4d6e8f00) ``` The `credential` line always names the origin: `RIBO_TOKEN`, `profile "x" (--profile)`, `profile "x" (bound at /dir)`, or `the default profile`. When `RIBO_TOKEN` is set, ribo adds an explicit note that it overrides all profiles. --- ## Global behaviour **Default server**: Commands that talk to the management API default to `https://api.tissue.systems`. Override per-command with `--server`, or for a whole session with the `TISSUE_SERVER` environment variable; it is honoured by **every** command: `ribo deploy`, `ribo list`, `ribo delete`, `ribo addr`, `ribo invoke` (for its address lookup), and all the grouped commands. Precedence is `--server` → `TISSUE_SERVER` → `[server] url` in `ribo.toml` (read by `ribo deploy` and `ribo domain add`) → the built-in default: ```bash export TISSUE_SERVER=http://localhost:8082 # applies to every command ``` One nuance: `ribo invoke` sends the invocation itself to the runtime, which defaults to `http://localhost:8080` unless `--server` is passed; only its management-API lookup of the Cell's address reads `TISSUE_SERVER`. **Authentication**: every command requires a valid token, apart from [`ribo local`](#ribo-local), whose stack runs on your machine and enforces nothing. This includes `ribo deploy`, `ribo list`, `ribo delete`, `ribo invoke`, `ribo addr` (which resolves the name via `GET /v1/cells` on the management API, not an offline lookup), and all `ribo db`, `ribo bucket`, `ribo vault`, `ribo token`, `ribo domain`, `ribo sensor`, `ribo vesicle` and `ribo mast` subcommands, except `ribo mast send` given a channel key or URL, which needs no login. Run `ribo login` or set [`RIBO_TOKEN`](#ribo-token). **Which credential**: resolved in the order [`RIBO_TOKEN`](#ribo-token) → `--profile ` → nearest bound ancestor directory → the default login. `--profile` is a global flag accepted by every command, and it redirects writes as well as reads: `ribo --profile acme account switch "…"` re-mints the credential *inside* that profile. Run [`ribo profile which`](#ribo-profile-which) to see what the current directory resolves to. Credentials live in `~/.config/ribo/token.json` (default login) and `~/.config/ribo/profiles.json` (profiles and bindings), both written `0600` inside a `0700` directory. **Cell addresses**: Each Cell gets a stable address on first deploy (e.g. `dd0d1cd5kq5bs`). The address never changes across redeploys and is used in internal routing and the management API. **Cell URLs**: Cells are accessible at `https://..tissue.dev` (e.g. `my-cell.strand-9c.tissue.dev`). The URL is shown after every `ribo deploy`. --- ## See also - [ribo.toml reference](https://docs.tissue.systems/docs/cells/configuration/) - [ribo mast](https://docs.tissue.systems/docs/ribo/mast/) - [c3 Overview](https://docs.tissue.systems/docs/c3/overview/) - [g7 Overview](https://docs.tissue.systems/docs/g7/overview/) --- # ribo CLI / Local development Source: https://docs.tissue.systems/docs/ribo/local/ # Local development `ribo local` runs your Cell on your own machine: the same V8 isolate runtime that serves it in production, plus c3 for SQL, g7 for objects, and a management API: four services on localhost, started and stopped by one command. ```bash cd my-cell ribo local ``` Nothing is deployed to the platform, nothing is billed, and after the first run it works with no network at all. --- ## Why it starts a whole stack A Cell is dispatchable only from the management server that holds it. The router resolves an address against that server's registry, so a Cell deployed to `api.tissue.systems` is invisible to a runtime on your laptop, and a Cell deployed on your laptop is invisible to the edges. `ribo local` brings up a management server here and deploys into *it*. That is the arrangement in which `http://localhost:8080/

` can answer. --- ## Quick start Run it in a directory that has a `ribo.toml`: ```console $ ribo local starting c3 · g7 · api · runtime ready runtime 2026.08.014 :8080 · c3 :8081 · g7 :8083 · api :8082 account Acme Corp (acct_3f8c1a2b4d6e8f00) deployed my-cell (js) url http://localhost:8080/33ed412f7x2kp watching /Users/you/my-cell (3 dirs) — a save redeploys Ctrl-C to stop. ``` The Cell is live at that URL: ```bash curl http://localhost:8080/33ed412f7x2kp/ ``` Ctrl-C stops all four services and prints what it stopped. You do not have to be logged in. With no credential the stack still runs and the deploy line reads `account `, which is what CI and offline work get. --- ## What is running | Service | Port | What it does | |-----------|--------|------------------------------------------------------------------| | `runtime` | `8080` | Runs your Cell in its own V8 isolate and dispatches requests to it | | `c3` | `8081` | SQL databases behind `type = "c3"` bindings | | `api` | `8082` | Management API: registry, deploys, buckets, vault | | `g7` | `8083` | Object storage behind `type = "g7"` and `type = "files"` bindings | Three of the four are `ribo` itself. The runtime is the only separate executable, and `ribo` fetches it for you. The ports are fixed: the runtime's service bindings name them literally, so there is no port flag. A busy port is reported rather than worked around. ``` Error: Port 8081 is already in use, which c3 needs. A previous stack may still be running — try `ribo local stop`. ``` --- ## The first run downloads the runtime ``` Fetching the Cell runtime 2026.08.014 for macos-arm64 (28 MB, signed by release@tissue.systems) ``` The download is checked against a signed manifest before it is unpacked: a signature from outside ribo's release trust list, or a checksum that does not match, refuses to install rather than warning. It is then cached by version and reused: | Platform | Cache | |----------|-------| | macOS | `~/Library/Caches/ribo/runtime//` | | Linux | `~/.cache/ribo/runtime//` | Runtime builds are published for **macOS arm64** (Apple silicon) and **Linux x86_64**. On Windows, run `ribo` under WSL. Two escape hatches: ```bash RIBO_NO_DOWNLOAD=1 ribo local # fail instead of fetching anything ribo local --runtime /path/to/runtime # use a runtime you already have ``` `RIBO_RUNTIME_DIR` does the same as `--runtime` for a whole shell. --- ## Create databases and buckets first The local stack starts empty, and `ribo deploy` doesn't create resources, locally or in production. Point the resource commands at the local management API before the first request: ```bash export TISSUE_SERVER=http://localhost:8082 # every ribo command in this shell ribo db create notes ribo bucket create uploads ribo vault set my-cell SECRET ``` Or per command, without the export: ```bash ribo db create notes --server http://localhost:8082 ``` A `type = "files"` binding is the exception: its bucket is derived from the address and created during the deploy. Skip this and the Cell throws on the first request that touches the binding: `C3 database "notes" not found`, or `bucket "uploads" not found`. Both print in your terminal. --- ## What your Cell prints `console.log` goes straight to the terminal, unprefixed: ``` cell saw GET /notes ``` An uncaught exception is answered to the client as a bare `Internal Server Error`, which says nothing. The terminal gets what actually happened, with the request path and the frames: ``` error bucket "uploads" not found (/upload) at async Object.fetch (cell.js:12:11) ``` Errors are written to stderr and your Cell's own output to stdout, so a redirect separates them. --- ## Saving a file redeploys the Cell `ribo local` watches the Cell directory while it runs. Save `cell.js` and the next request runs the new code: ```console changed cell.js reloaded my-cell (js) ``` The address does not change and the services keep running. Only the Cell's code is replaced, because the runtime keys each isolate on the address and the deploy timestamp. Static files under a `type = "files"` binding are re-uploaded the same way, and the line says how many moved: ```console changed public/index.html reloaded my-cell (js) files FILES→33ed412f7x2kp-files (12 files: 1 uploaded, 11 unchanged) ``` A `build` command in `ribo.toml` runs on every save, before the upload. Writes it makes into the directory do not trigger a further reload. A failed reload (a build that exits non-zero, a bucket that does not exist) prints the error and leaves the previous deploy serving: ```console changed cell.js reload failed — build failed: npm run build (exit 1) ``` Four things are left out of the watch: `.git`, `node_modules`, `target`, and the scratch files editors write beside the one you saved (`.swp`, `file~`, `.#file`, `.DS_Store`). Directories a files binding names in `allow_symlinks_to` **are** watched, because a shared asset lives outside the Cell directory by design and a watch on a symlink is a watch on the link, not on what it points at. To turn it off and deploy once: ```bash ribo local --no-watch ``` You can also deploy from another terminal, whether or not the watch is on: ```bash ribo deploy --server http://localhost:8082 ``` To bring the stack up without deploying anything, say when the Cell you're working on lives somewhere else, there is nothing to watch, so the watch does not start: ```bash ribo local --no-deploy ``` --- ## Where local data lives Under `~/Library/Caches/ribo/local/` on macOS, `~/.cache/ribo/local/` on Linux: | Path | Holds | |-------------|-----------------------------------------------------| | `c3-data/` | one SQLite file per database | | `g7/` | one directory per bucket | | `cells/` | deployed code, the local registry, vault values | | `run.json` | the process IDs of the running stack | It survives restarts, so the rows you wrote yesterday are there today. Delete the directory to start from nothing. The databases are ordinary SQLite files. `ribo db exec notes "select * from notes" --server http://localhost:8082` reads them, and so does any SQLite client. --- ## Stopping a stack you lost If a terminal was closed on a running stack, its services are still holding the ports: ```console $ ribo local stop stopped c3 (54130) stopped g7 (54132) stopped api (54133) stopped runtime (54134) ``` With nothing running it prints `No local stack recorded as running.` --- ## What is different from production | | Local | Production | |---|---|---| | Routing | path-based: `localhost:8080/
/…` | subdomain: `..tissue.dev` | | Authentication | none; every request reaches the Cell | account credentials on the API, Gate on the Cell | | [Gate](https://docs.tissue.systems/docs/cells/gate/) | a `[gate]` block fails the deploy: the policy needs storage the local stack does not run | policies, capability links, sessions | | [Pulse](https://docs.tissue.systems/docs/pulse/overview/) | no scheduler runs; `[[pulse]]` schedules are stored but nothing fires them | dispatched on schedule, UTC | | [g7](https://docs.tissue.systems/docs/g7/api/) | the binding API; the S3 API, presigned URLs and per-bucket credentials answer `501` | all of it | | [Custom domains](https://docs.tissue.systems/docs/cells/custom-domains/), [Synapse](https://docs.tissue.systems/docs/synapse/overview/) | not part of the local stack | — | Because routing is path-based, a Cell that reads its own hostname sees `localhost:8080` locally. Route on the path, or read the address prefix off it. To exercise a `pulse(event, env)` handler, send the invocation the scheduler would send: ```bash curl -X POST http://localhost:8080/33ed412f7x2kp/ \ -H 'x-tissue-event: pulse' \ -H 'x-tissue-cron: */5 * * * *' \ -H 'x-tissue-scheduled-time: 2026-08-13T08:00:00Z' ``` --- ## Flags | Flag | Default | Description | |---------------------|---------------|----------------------------------------------------------------------| | `--config ` | `./ribo.toml` | Config file to deploy | | `--runtime ` | the ribo cache | Runtime executable, or a directory holding one | | `--no-deploy` | off | Start the services without deploying the Cell in this directory | | `--no-watch` | off | Deploy once and stop there, instead of redeploying on every save | | `--profile ` | — | Credential profile for the deploy (see [Accounts & profiles](https://docs.tissue.systems/docs/ribo/profiles/)) | --- ## Going to production When it works locally, deploy it for real from the same directory: ```bash ribo deploy ``` Without `--server` the deploy goes to `https://api.tissue.systems`, and the databases, buckets and vault values you created locally aren't there. Create them again against the platform. --- ## See also - [ribo CLI reference](https://docs.tissue.systems/docs/ribo/reference/) - [ribo.toml reference](https://docs.tissue.systems/docs/cells/configuration/) - [Writing Cells](https://docs.tissue.systems/docs/cells/writing/) --- # ribo CLI / ribo mast Source: https://docs.tissue.systems/docs/ribo/mast/ # ribo mast `ribo mast` is [Tissue Mast](https://tissue.systems/mast/docs/) from your terminal: who's on call, the open incidents, sending alerts and closing incidents, and the whole on-call setup as a `mast.toml` you can keep in git. It needs ribo 2026.10.0 or later; `ribo upgrade` gets it. It uses the same login as every other ribo command. A session from `ribo login` can do everything here. An API token needs `mast:read` for the commands that only look, and `mast:write` for the ones that change something: ```bash ribo token create on-call --scope mast:read --scope mast:write ``` When a token is short of a scope, the error says which one the command needed. The commands work before anybody has linked a phone, but nothing rings until [one is linked](https://tissue.systems/mast/docs/start/#linking-your-phone). ribo 2026.11.1 and earlier spell some of this differently: alert sources are `channels` and `[[channel]]`, heartbeats are `vitals` and `[[vital]]`, and there are no probes in `mast.toml` and no `--invite` on the imports. `ribo upgrade` gets you the names on this page. --- ## Who's on call ```bash ribo mast status ``` ``` On call primary ann@example.com until 2026-10-27 14:00 UTC database bo@example.com until 2026-10-26 09:00 UTC Open pages #41 open API answering 502 (api-health) 2026-10-25 14:02 UTC (12 minutes ago) ``` `ribo mast pages` lists recent incidents, newest first. `--open` keeps only the ones nobody has resolved, and `--days` goes back further than the default 7, up to 90. Every command that lists or shows something takes `--json` and prints what the API returned, for scripts. --- ## Sending, acknowledging and resolving ```bash ribo mast send deploys "Deploy of api finished" --body "v2026.10.4, 41 seconds" ribo mast send alerts "Disk 95% full on db1" --priority page --dedupe disk-db1 ribo mast send alerts "Disk back to 60%" --dedupe disk-db1 --resolve ``` The first argument is an alert source's name, and ribo sends through your login. It can also be the alert source's key (`mk_…`) or its send URL, which sends straight to the alert source the way `curl` would and needs no login at all. ribo never prints a key it was given. | Flag | What it does | |---|---| | `--body` | The text under the title | | `--priority` | `quiet`, `normal`, `loud` or `page`. The alert source's highest level still caps it | | `--dedupe` (or `--alias`) | Sends with the same value are grouped into one incident while it's open | | `--resolve` | Closes the open incident with that `--dedupe` value instead of opening one | | `--url` | A link to open from the alert | To acknowledge or resolve an incident by hand, give its number or its id: ```bash ribo mast ack 41 ribo mast resolve '#41' ``` A number is looked up among the last 90 days of incidents. --- ## Alert sources, heartbeats, rotations and policies one at a time An alert source is `ribo mast alert-source` on the command line and `[[alert_source]]` in `mast.toml`; a heartbeat is `ribo mast heartbeats` and `[[heartbeat]]`. The older spellings are still accepted: `ribo mast channels`, `[[channel]]`, `channel = "name"`, `ribo mast vitals`, `[[vital]]` and `--vital-priority`. Each of these has `list`, `show`, `create`, `update` and `delete`. `list` is what runs when you give no subcommand, so `ribo mast alert-source` lists the alert sources. ```bash ribo mast alert-source create deploys --default-priority normal --quiet-start 22:00 --quiet-end 07:00 --quiet-tz America/Chicago ribo mast alert-source update deploys --policy default ribo mast alert-source show deploys ribo mast alert-source delete old-alerts ``` `show` prints the send URL, since that's what you came for. `list` and `--json` on the list leave the keys out. A heartbeat is an alert source that expects a check-in, so it takes the alert source flags plus its own: ```bash ribo mast heartbeats create nightly-backup --period-secs 86400 --grace-secs 5400 --heartbeat-priority loud ``` Rotations take a handoff (`daily`, `weekly`, `biweekly` or `custom`), a day and time, a time zone, and the people in order, by email: ```bash ribo mast rotations create primary --handoff weekly --handoff-day monday --handoff-time 09:00 \ --tz America/Chicago --order ann@example.com,bo@example.com ribo mast rotations update night --handoff custom --length-hours 12 ``` An override puts someone on call in a rotation's place for a while. A date on its own covers that whole day; a time narrows it: ```bash ribo mast overrides add primary bo@example.com 2026-11-02 2026-11-04 ribo mast overrides add primary cy@example.com 2026-11-05T18:00 2026-11-06T09:00 --covers ann@example.com ribo mast overrides list primary ribo mast overrides rm primary ov_… ``` A policy is a list of steps, each `AFTER,TARGET[,PRIORITY]`. AFTER is seconds, or a number with `m`, `h` or `d`. TARGET is `everyone`, `oncall:`, `next:`, `user:` or `alert-source:`: ```bash ribo mast policies create default \ --step 0,oncall:primary \ --step 10m,next:primary,loud \ --step 30m,everyone \ --repeat-every-secs 1800 --repeat-count 2 ``` `next:primary` pages whoever takes over at the next handoff. An `oncall` or `next` step with no rotation pages everyone. Giving any `--step` to `update` replaces all of them. `update` changes only the flags you pass, and `--rename` gives the thing a new name. A renamed alert source keeps its send URL. `delete` asks first; `--yes` skips the question, and a session with no terminal refuses without it. An alert source's highest level, `max_priority`, is set to `loud` at most from ribo. Raising it to `page` is something only the owner's phone can do, in the app. --- ## The whole setup as a file `ribo mast export` prints everything as a `mast.toml`: ```bash ribo mast export > mast.toml ``` ```toml [[rotation]] name = "primary" handoff = "weekly" handoff_day = "monday" handoff_time = "09:00" tz = "America/Chicago" order = ["ann@example.com", "bo@example.com"] [[policy]] name = "default" repeat_every_secs = 1800 repeat_count = 2 [[policy.step]] after_secs = 0 target = "user" user = "ann@example.com" priority = "page" [[policy.step]] after_secs = 600 target = "everyone" priority = "loud" [[alert_source]] name = "alerts" policy = "default" default_priority = "loud" quiet_start = "22:00" quiet_end = "07:00" quiet_tz = "America/Chicago" [[heartbeat]] name = "nightly-backup" period_secs = 86400 grace_secs = 5400 ``` The field names are the API's. People are emails, and policies and rotations are referred to by name. Fields left at Mast's defaults are left out of the export, and a field you leave out of the file is left alone on every apply, so the phone's own changes to it stick. **Send keys are never in the file.** The file can go in git. An alert source created from it gets a new key, and an existing one keeps the key it has; `ribo mast alert-source show ` prints the URL when a sender needs it. `ribo mast apply` makes Mast match the file. It reads `./mast.toml` unless you give it a path, checks the whole file, prints a plan and asks before writing anything: ```bash ribo mast apply ``` ``` unchanged rotation "primary" update policy "default" repeat_count: 2 → 3 create alert source "deploys" unchanged alert source "alerts" kept heartbeat "old-cron" (not in the file) 1 create, 1 update, 2 unchanged, 1 kept Apply these changes? [y/N] ``` Things are matched by name. Anything in Mast that the file doesn't mention is left alone and listed as kept; `--prune` deletes those instead, and the plan says so before it asks. `--dry-run` prints the plan and stops, and `--yes` applies without asking, for CI. The check runs before the first write. A key ribo doesn't know is refused with its line number, and so is a policy or rotation the file refers to that's in neither the file nor the account, an email nobody on the account has, or a handoff that isn't one of the four. Writes go in the order rotations, policies, alert sources, heartbeats, probes, so an alert source can name a policy the same file creates. A policy step can only page an alert source that's already in Mast, so a new alert source and a step that pages it take two applies. Run `ribo mast export` straight after an apply and you get the same file back, and applying an unedited export changes nothing. If your team already uses Terraform or OpenTofu, there's a [Terraform provider](https://tissue.systems/mast/docs/alert-sources-as-code/#terraform) that manages the same things. Use one or the other for an account, not both: each sets the fields it's given, so they'd keep reverting each other's changes. --- ## Importing from Opsgenie `ribo mast import opsgenie` reads your Opsgenie account and plans the import into Mast. It's the same import as the one in the web app, it needs the account's owner or an admin, and it never writes anything without `--apply`. See [Moving from Opsgenie](https://tissue.systems/mast/docs/opsgenie/) for what comes across and what doesn't. ```bash export OPSGENIE_API_KEY=… # or leave it unset and ribo asks for it ribo mast import opsgenie # print the plan ribo mast import opsgenie --apply # write it ribo mast import opsgenie --invite # print the plan and invite the people not on the account ``` The key is read from `OPSGENIE_API_KEY` or typed at a prompt that doesn't echo. There's no flag for it, so it stays out of your shell history. ribo reads Opsgenie from your machine, sends Mast what it read, and forgets the key; it's never printed or put in an error. Use `--region eu` if your Opsgenie account is on the EU instance. After `--apply`, ribo lists every alert source the import made with its Mast URL and the Opsgenie-shaped address (`https://mast.tissue.dev/opsgenie`) and key to give the tools that used to send to Opsgenie. `--json` prints the server's plan or result as it came. The plan starts with a summary: how many Opsgenie users there are and how many are already members, already invited or left to invite, the account's headcount with all of them invited, the schedules and escalation policies in each Opsgenie team, how many people get texts or calls from Opsgenie, and the smallest Mast plan that holds it all (people, schedules, policies, the steps in the longest policy and the overrides on the busiest schedule), with its monthly price. `--invite` sends a member invite to every Opsgenie user who isn't on the account and has no open invite, as a developer, or as an admin with `--role admin`. It works with or without `--apply`, stops at the plan's headcount, and skips anyone already invited, so running it again only sends what's left. Without `--apply`, the invites are the only thing it writes. With an API token it needs `account:write`, which only the owner can grant; signed in with `ribo login`, an owner or an admin can use it as they are. After `--apply`, ribo prints a Terraform `import` block for each alert source, heartbeat, rotation, override and policy the import made or changed, ready for `terraform plan -generate-config-out=mast.tf`. `--terraform-file ` writes them to a file too. From ribo, `--apply` imports everything the plan lists. To leave items out, use the importer in the web app; running either one again later is safe, since it matches by name. --- # ribo CLI / Accounts & profiles Source: https://docs.tissue.systems/docs/ribo/profiles/ # Accounts & profiles If you only ever work with one Tissue Cloud account, `ribo login` is all you need and you can skip this page. If you work with **more than one account** (your own account and a client's, a company account and a demo account), or if you run **AI agents that deploy on your behalf**, read on. A single global login is a shared mutable variable, and this page is about not tripping over it. --- ## The problem `ribo login` stores one token in `~/.config/ribo/token.json`, and the account you are acting as lives *inside* that token. `ribo account switch` re-mints it in place. That means account selection is **global**: ```bash # terminal 1 # terminal 2 ribo account switch "Acme" ribo account switch "Personal" ribo deploy # ← deploys as Personal, not Acme ``` Nothing errors. The deploy succeeds. Into the wrong account. And because `ribo deploy` looks a Cell up **by name within the token's account**, deploying to the wrong account doesn't update your existing Cell: it creates a **brand-new one** there, with a live URL under the wrong subdomain and bindings pointing at the wrong account's databases and buckets. Two shells is the mild version. Two coding agents on the same machine, working in different projects, is the version that bites. Tissue gives you two independent defences. Use both: - **Profiles** bind a credential to a directory tree, so concurrent work stops fighting over one file. - **The account pin** records the account a project belongs to and **aborts** any deploy that would land elsewhere. --- ## Profiles: one credential per project tree A **profile** is a named login bound to a directory. Any command run in that directory, or any subdirectory, authenticates as that profile. ### Create profiles If you're already logged in, capture the current login under a name: ```bash ribo account switch "Acme Corp" ribo profile create acme --from-current ribo account switch "Personal" ribo profile create personal --from-current ``` Or log in fresh, straight into a profile: ```bash ribo profile create acme # opens the browser, stores under "acme" ribo profile create ci --key tok_a1b2c3... # or store an API token ``` ### Bind them to directories ```bash cd ~/work/acme-site && ribo profile activate acme . cd ~/personal/my-blog && ribo profile activate personal . ``` That's it. From now on, anything you run under `~/work/acme-site` is Acme, and anything under `~/personal/my-blog` is you, **at the same time**, in as many terminals or agents as you like. Neither can clobber the other, because they no longer share a credential. ### Check before you act ```bash $ cd ~/work/acme-site $ ribo profile which directory /Users/you/work/acme-site credential profile "acme" (bound at /Users/you/work/acme-site) server https://api.tissue.systems account Acme Corp (acct_3f8c1a2b4d6e8f00) ``` `ribo profile which` has no side effects and answers the one question that is otherwise invisible: *who am I about to be?* It's the right thing to put at the top of a deploy script, and the right thing to teach an agent to run before it touches production. `ribo deploy` reports the same thing on every deploy, as a `via` line: ``` account Acme Corp (acct_3f8c1a2b4d6e8f00) [pinned] via profile "acme" (bound at /Users/you/work/acme-site) server https://api.tissue.systems deployed acme-site ``` ### See everything at once ```bash $ ribo profile list * acme account Acme Corp (acct_3f8c1a2b4d6e8f00) servers https://auth.tissue.systems bound /Users/you/work/acme-site personal account Personal (acct_9zp5k1m3n5p7r9t1) servers https://auth.tissue.systems bound /Users/you/personal/my-blog Here (/Users/you/work/acme-site): profile "acme" (bound at /Users/you/work/acme-site) ``` --- ## Which credential wins `ribo` picks a credential in this order, taking the first one that applies: | # | Source | Scope | |---|---|---| | 1 | `RIBO_TOKEN` environment variable | the process | | 2 | `--profile ` | one command | | 3 | the nearest bound ancestor directory | that directory tree | | 4 | the default profile (`ribo login`) | everywhere else | **Nearest wins.** If `~/work` is bound to `outer` and `~/work/acme` is bound to `acme`, then `~/work/acme/site` uses `acme`: the most specific binding, not the first one found. **`--profile` works on any command**, and it redirects *writes* as well as reads. `ribo --profile acme account switch "Acme Staging"` re-mints the credential inside the `acme` profile and leaves everything else alone. **A stale binding is an error, not a fallback.** If a directory is bound to a profile you deleted: ``` Error: /Users/you/work/acme-site is bound to profile "acme", which no longer exists. Re-create it: ribo profile create acme Or unbind it: ribo profile deactivate /Users/you/work/acme-site ``` ribo will not quietly fall back to your default login, because quietly retargeting a deploy at a different account is precisely the failure profiles exist to prevent. --- ## Pin the account in ribo.toml Profiles make the right credential *ambient*. The pin makes a wrong one *fatal*. ```bash cd ~/work/acme-site ribo account pin # Pinned Acme Corp (acct_3f8c1a2b4d6e8f00) in ribo.toml. ``` That writes an `account_id` into the `[cell]` block: ```toml [cell] name = "acme-site" account_id = "acct_3f8c1a2b4d6e8f00" ``` The pin is an **assertion, not a selector**. It never picks an account for you; it only stops a deploy that would land in the wrong one, *before* anything is uploaded: ``` Error: Refusing to deploy: account mismatch. ribo.toml pins Acme Corp (acct_3f8c1a2b4d6e8f00) active account Personal (acct_9zp5k1m3n5p7r9t1) Switch accounts: ribo account switch "Acme Corp" Or use a profile for this tree: ribo profile activate . ``` The check runs on both sides: `ribo` refuses locally, and the deploy request carries the expected account id so the server refuses too. An out-of-date CLI can't get around it. Commit the pin. It contains no secret (an account id is not a credential), and it means anyone who clones the project, including an agent, gets the guardrail for free. **Don't pin public templates.** If you publish a project for other people to clone and deploy into *their* accounts, leave it unpinned; a pin would fail every one of their deploys with an account id that means nothing to them. --- ## Recipes ### Two agents, two accounts, one machine ```bash # one-time ribo profile create acme --from-current # after: ribo account switch "Acme Corp" ribo profile create personal --from-current # after: ribo account switch "Personal" ribo profile activate acme ~/work/acme-site ribo profile activate personal ~/personal/my-blog (cd ~/work/acme-site && ribo account pin) (cd ~/personal/my-blog && ribo account pin) ``` Then both agents can run `ribo profile which` and `ribo deploy` concurrently, in any order, with no coordination. ### CI Nothing to change. Set `RIBO_TOKEN` to a scoped [API token](https://docs.tissue.systems/docs/ribo/reference/#ribo-token) and profiles never come into play; an environment variable is already per-process, so parallel jobs on one runner are isolated by construction: ```yaml - name: Deploy Cell env: RIBO_TOKEN: ${{ secrets.RIBO_TOKEN }} run: ribo deploy ``` `ribo profile which` tells you when `RIBO_TOKEN` is in play, so an environment credential shadowing a profile is never a silent surprise. ### Retiring a profile ```bash ribo profile deactivate ~/work/acme-site # unbind one directory ribo profile delete acme # remove the profile and unbind everything ``` --- ## Where credentials live ``` ~/.config/ribo/ ├── token.json ← your default login (ribo login) └── profiles.json ← named profiles and their directory bindings ``` Same path on every platform, macOS included. Both files hold bearer tokens, so ribo writes the directory as `0700` and the files as `0600`, and re-applies those permissions on every write, including to files created by older versions of ribo. Treat them like an SSH private key: don't commit them, don't sync them into a shared volume. Deleting `profiles.json` removes every profile and binding but leaves your default login intact. --- ## A note on `--from-current` `ribo profile create --from-current` copies the credentials in your default login for **every server** it holds: production, staging, a local dev server. `ribo account switch` only re-mints the credential for the server it targeted, so the others are whatever they already were, and are not guaranteed to belong to the account you just captured. When more than one server is copied, ribo says so and tells you how to check: ```bash ribo --profile acme account whoami --server https://api.staging.tissue.systems ribo --profile acme account switch "Acme Corp" --server https://api.staging.tissue.systems ``` If you only use production, there is nothing to do. --- ## See also - [ribo CLI reference](https://docs.tissue.systems/docs/ribo/reference/): every command and flag - [ribo.toml reference](https://docs.tissue.systems/docs/cells/configuration/#account-pin): the `account_id` field - [REST API](https://docs.tissue.systems/docs/api/): scoped API tokens for CI and agents --- # MCP: AI agents / MCP server Source: https://docs.tissue.systems/docs/mcp/overview/ # MCP server The Tissue Cloud **MCP server** lets AI tools (Claude Code, Claude Desktop, Claude.ai, Cursor, Windsurf, Devin, and any other [Model Context Protocol](https://modelcontextprotocol.io) client) manage your Tissue Cloud account directly: deploy Cells, query c3 databases, read and write g7 objects, manage vault secrets, and more. **MCP endpoint:** `https://tissue.systems/mcp` The server holds no credentials of its own. Every request is performed against the [REST API](https://docs.tissue.systems/docs/api/) using the token *you* supply, so the tools an agent can see and call are always limited to what your token allows. --- ## Two ways to authenticate | Method | Best for | What you do | |---|---|---| | **Browser login (OAuth)** | Interactive use: Claude Code, Claude Desktop, Claude.ai | Give the tool the URL; sign in once in your browser | | **API token** | CI, scripts, headless agents, any tool that takes static headers | Create a `tok_…` token, paste it into the config | Both use the same endpoint. Browser login is the zero-friction path; the token method works everywhere, including clients that don't support OAuth. --- ## Option A: Browser login (OAuth) You only ever give your tool the server URL `https://tissue.systems/mcp`. Everything else is automatic: 1. The tool connects and receives a `401` whose `WWW-Authenticate` header points at the server's protected-resource metadata. 2. That metadata names the authorization server (`auth.tissue.systems`); the tool reads its metadata and **registers itself automatically** (Dynamic Client Registration). 3. The tool opens your browser to sign in. You authenticate once; the tool stores the token and reconnects. No token strings to copy. A browser-login session grants the agent full access to your account (the same as a logged-in dashboard session). For least-privilege access, use a scoped API token (Option B). ### Claude Code ```bash claude mcp add --transport http tissue https://tissue.systems/mcp ``` On first use Claude Code opens your browser to sign in, then stores the token. Confirm with `claude mcp list`; `tissue` should show as connected. ### Claude Desktop Open **Settings → Developer → Edit Config** (or `~/Library/Application Support/Claude/claude_desktop_config.json` on macOS / `%APPDATA%\Claude\claude_desktop_config.json` on Windows) and add: ```json { "mcpServers": { "tissue": { "url": "https://tissue.systems/mcp" } } } ``` Save and restart Claude Desktop. On the next launch it detects that the server needs authentication and opens your browser to sign in. A hammer icon (🔨) in the chat input confirms the tools are active. ### Claude.ai (web) Go to **Settings → Connectors → Add custom connector**, enter `https://tissue.systems/mcp` as the URL, and complete the sign-in when redirected. ### Cursor / Windsurf / other OAuth clients Add a remote (HTTP/streamable) MCP server with the URL `https://tissue.systems/mcp` and no headers. The client runs the same browser-login flow on first connect. --- ## Option B: API token Use this for CI, headless agents, or any client without OAuth support. ### 1. Create a token **Dashboard:** API Tokens → New Token → pick scopes → copy the value. A token carries an explicit allow-list of scopes, one per resource + action. Grant only what the client needs; there is no implicit inheritance (`cells:write` does not imply `cells:read`). | Resource | `read` | `write` | `delete` | |---|---|---|---| | **Cells**: deploy, invoke, logs, pulse schedules | `cells:read` | `cells:write` | `cells:delete` | | **Databases**: c3 SQL databases and queries | `databases:read` | `databases:write` | `databases:delete` | | **Buckets**: g7 object storage buckets and objects | `buckets:read` | `buckets:write` | `buckets:delete` | | **Vault**: encrypted per-Cell secrets (values are never returned, only key names) | `vault:read` | `vault:write` | n/a | | **Domains**: custom domains attached to a Cell | `domains:read` | `domains:write` | `domains:delete` | | **Account**: account profile and settings | `account:read` | `account:write` | n/a | | **Vesicle**: webhook endpoints and captures | `vesicle:read` | `vesicle:write` | `vesicle:delete` | | **Events**: the account activity feed | `events:read` | n/a | n/a | | **Billing**: entitlements and subscription state | `billing:read` | `billing:write` | n/a | | **Mast**: [Mast](https://tissue.systems/mast/docs/api/) probes, alert sources, incidents and heartbeats | `mast:read` | `mast:write` | n/a | | **Explant**: a verifiable [export of one Cell](https://docs.tissue.systems/docs/cells/explant/) | n/a | `explant:export` | n/a | 25 scopes in total. The Dashboard's New Token picker grants 14 of them: every scope above except `domains:*`, `vesicle:*`, `billing:*`, `mast:*` and `explant:export`, which are granted from the CLI or the REST API. `mast:*` can also be granted under **API tokens** in the Mast web app. A browser session holds every scope its role allows: all 25 for an owner, and a capped set for an admin or a developer ([roles and ceilings](https://docs.tissue.systems/docs/account/members/#roles)). Scopes on a `tok_` API token are capped the same way. **ribo CLI:** ```bash # Full access (personal use) ribo token create "Claude" \ --scope cells:read --scope cells:write --scope cells:delete \ --scope databases:read --scope databases:write --scope databases:delete \ --scope buckets:read --scope buckets:write --scope buckets:delete \ --scope vault:read --scope vault:write # Read-only data analyst ribo token create "Analyst" --scope databases:read --scope buckets:read --scope cells:read ``` The token is shown **once**, and looks like `tok_<64 hex>`. See [Tools & Scopes](https://docs.tissue.systems/docs/mcp/tools/) for the full scope list and presets. ### 2. Verify it ```bash curl -s -H "Authorization: Bearer tok_YOUR_TOKEN" https://api.tissue.systems/v1/me ``` A `200` with your account and scopes confirms it works. ### 3. Configure your tool ```json { "mcpServers": { "tissue": { "url": "https://tissue.systems/mcp", "headers": { "Authorization": "Bearer tok_YOUR_TOKEN" } } } } ``` The same `url` + `headers` shape works for Cursor (`.cursor/mcp.json`), Windsurf, and VS Code. For Claude Code: ```bash claude mcp add --transport http tissue https://tissue.systems/mcp \ --header "Authorization: Bearer tok_YOUR_TOKEN" ``` --- ## Troubleshooting **Could not connect.** Run `curl -si -X POST https://tissue.systems/mcp`. A reachable endpoint returns `401` (missing Authorization). A `404` means the URL is wrong; it must be exactly `https://tissue.systems/mcp`. **A tool is missing (e.g. `cell_deploy`).** Your token lacks the required scope. Run the `whoami` tool to see the token's effective scopes, then create a new token with the missing scope. Tools you don't have scope for are hidden, not just disabled. **"Invalid or expired token" / 401 with a token set.** Verify the token: `curl -H "Authorization: Bearer tok_…" https://api.tissue.systems/v1/me`. If that returns 401, the token was revoked or truncated when copied. **Browser login opened but nothing happened.** Make sure `auth.tissue.systems` is reachable, then retry. Tokens are revocable any time via `ribo token revoke ` or the dashboard. --- ## See also - [MCP tools & scopes](https://docs.tissue.systems/docs/mcp/tools/): every tool and the scope that gates it - [REST API](https://docs.tissue.systems/docs/api/): the `/v1` API the MCP server proxies to - [ribo CLI reference](https://docs.tissue.systems/docs/ribo/reference/): `ribo token` commands --- # MCP: AI agents / Tools & scopes Source: https://docs.tissue.systems/docs/mcp/tools/ # MCP tools & scopes The MCP server exposes one tool per Tissue Cloud operation, named `_`. **Tools are filtered at runtime by your token's scopes**: a read-only token never sees write or delete tools at all; they don't appear in the tool list. Every tool carries MCP annotations (`readOnlyHint`/`destructiveHint`/`idempotentHint`) so hosts can prompt for confirmation on destructive actions, and returns machine-readable `structuredContent` alongside human-readable text. --- ## Available tools | Tool | Scope | What it does | |---|---|---| | `whoami` | *(none)* | Show account, user, and effective token scopes | | `search_tissue_docs` | *(none)* | Keyword-search these docs (returns relevant sections) | | `cell_list` | `cells:read` | List all deployed Cells | | `cell_get` | `cells:read` | Get metadata and bindings for a Cell | | `cell_logs` | `cells:read` | Recent `console.log` output from a Cell | | `cell_errors` | `cells:read` | Recent uncaught errors from a Cell | | `cell_deploy` | `cells:write` | Deploy a JS Cell from source code | | `cell_invoke` | `cells:read` | Make an HTTP request to a Cell and return the response | | `cell_delete` | `cells:delete` | Delete a Cell | | `gate_status` | `cells:read` | Show a Cell's [gate](https://docs.tissue.systems/docs/cells/gate/) policy and active session/link counts | | `gate_set` | `cells:write` | Set or replace a Cell's gate policy (audience, allow list, domains, [SSO identity providers](https://docs.tissue.systems/docs/cells/gate-sso/)) | | `gate_remove` | `cells:write` | Remove the gate; the Cell becomes public again | | `gate_link_create` | `cells:write` | Mint a shareable capability link (token shown once) | | `gate_link_list` | `cells:read` | List a gated Cell's capability links | | `gate_link_revoke` | `cells:write` | Revoke a capability link by id | | `gate_session_list` | `cells:read` | List a gated Cell's viewer sessions | | `gate_session_revoke` | `cells:write` | Revoke one viewer session by sid | | `gate_revoke_all` | `cells:write` | Revoke every session; all viewers sign in again | | `pulse_list` | `cells:read` | List a Cell's pulse (cron) schedules | | `pulse_trigger` | `cells:write` | Fire a Cell's pulse handler now ("run now") | | `c3_database_list` | `databases:read` | List all c3 SQL databases | | `c3_database_create` | `databases:write` | Create a new c3 database | | `c3_database_drop` | `databases:delete` | Delete a database | | `c3_query` | `databases:read` | Run a read-only query and get rows back | | `c3_execute` | `databases:write` | Run INSERT / UPDATE / DELETE / DDL | | `c3_batch` | `databases:write` | Run multiple statements atomically | | `g7_bucket_list` | `buckets:read` | List all g7 buckets | | `g7_bucket_create` | `buckets:write` | Create a new bucket | | `g7_bucket_delete` | `buckets:delete` | Delete a bucket | | `g7_object_list` | `buckets:read` | List objects in a bucket | | `g7_object_get` | `buckets:read` | Download a small object (text or base64) | | `g7_object_put` | `buckets:write` | Upload a small object (text or base64) | | `g7_object_delete` | `buckets:delete` | Delete an object | | `g7_presign_upload` | `buckets:write` | Get a short-lived presigned PUT URL (binary/bulk upload) | | `g7_presign_download` | `buckets:read` | Get a short-lived presigned GET URL (binary/large download) | | `vault_key_list` | `vault:read` | List secret key names for a Cell | | `vault_set` | `vault:write` | Set an encrypted secret for a Cell | | `vault_delete` | `vault:write` | Delete a secret | | `domain_list` | `domains:read` | List custom domains and their status | | `domain_add` | `domains:write` | Register a custom domain on a Cell (returns the ownership challenge) | | `domain_verify` | `domains:write` | Re-check a domain's DNS and advance its status | | `domain_remove` | `domains:delete` | Remove a custom domain | | `token_list` | `account:read` | List the account's API tokens | | `token_create` | `account:write` | Create a new scoped API token | | `token_revoke` | `account:write` | Revoke an API token | | `sensor_list_devices` | `cells:read` | List sensor devices registered under a Cell | | `sensor_get_device` | `cells:read` | Fetch one device's registry record | | `sensor_register_device` | `cells:write` | Register a device (returns its one-time token) | | `sensor_set_device_enabled` | `cells:write` | Enable or disable (quarantine) a device | | `sensor_rotate_device_token` | `cells:write` | Issue a new token for a device | | `sensor_delete_device` | `cells:delete` | Revoke a device entirely | | `vesicle_endpoint_create` | `vesicle:write` | Issue a webhook ingest URL (it accepts deliveries before any Cell exists) | | `vesicle_endpoint_list` | `vesicle:read` | List endpoints with their bindings and capture counts by state | | `vesicle_endpoint_get` | `vesicle:read` | Get one endpoint, including its full ingest URL | | `vesicle_endpoint_bind` | `vesicle:write` | Point an endpoint at a Cell and path | | `vesicle_endpoint_rotate` | `vesicle:write` | Issue a new ingest URL; the old one keeps working for a grace window | | `vesicle_endpoint_revoke` | `vesicle:delete` | Revoke an endpoint; stored captures survive | | `vesicle_capture_list` | `vesicle:read` | List an endpoint's stored deliveries (metadata, never bodies) | | `vesicle_capture_get` | `vesicle:read` | Read one delivery verbatim, redacted unless `include_secrets` | | `vesicle_replay` | `vesicle:write` | Re-send one delivery, or a range, into the bound Cell | | `mast_probe_list` | `mast:read` | List [Tissue Mast](https://tissue.systems/mast/docs/) probes with their state and alert source | | `mast_probe_create` | `mast:write` | Create a probe | | `mast_probe_check` | `mast:write` | Check a URL or other target once, from every checking place, without saving a probe | | `mast_alert_source_list` | `mast:read` | List alert sources | | `mast_alert_source_create` | `mast:write` | Create an alert source (returns its id and send URL) | | `mast_alert_source_test` | `mast:write` | Send a test page through an alert source to the linked phones | | `mast_incident_list` | `mast:read` | List incidents, newest first | `c3_query` is read-only and works with a `databases:read` token; the query runs under an engine-enforced read-only connection, so any write is rejected; use `c3_execute` (`databases:write`) to modify data. `g7_object_get`/`g7_object_put` are size-limited (256 KB) to keep bytes out of the model's context; small binary is supported via base64 (`encoding: "base64"`). For large or many files, use `g7_presign_upload` / `g7_presign_download`; they return a short-lived URL you upload/download bytes to directly (e.g. `curl -T file ""`), so the data never passes through the model. Object keys may not contain `@`. The `mast_*` tools cover setting up monitoring: check a URL, make an alert source, create the probes, send a test page. An alert source's id starts `mc_`, and a probe names it as `alert_source_id` (`channel_id` is still accepted). An alert source made with a token can't page until its highest level is raised in the Mast Pager app on a linked phone. The [Mast manual](https://tissue.systems/mast/docs/) has a prompt to paste and the rest of the API. A captured webhook delivery is a third party's raw HTTP request, so it routinely carries live credentials. `vesicle_capture_get` masks them by default: header and JSON body values whose names match `authorization`, `x-api-key`, `cookie`, or anything ending `-signature` or `-token` come back as `«redacted»`. `include_secrets: true` returns them intact, records an audit event on the account, and puts those credentials into the model's context and any transcript it reaches; use it only when a masked capture won't do. --- ## Scope reference | Scope | Grants | |---|---| | `cells:read` | List cells, view metadata, logs, errors, gate status | | `cells:write` | Deploy (create or update) cells, manage gate policies/links/sessions | | `cells:delete` | Delete cells | | `databases:read` | List databases, run read-only queries | | `databases:write` | Create databases, run INSERT/UPDATE/DELETE/DDL | | `databases:delete` | Drop databases | | `buckets:read` | List buckets and objects, download objects | | `buckets:write` | Create buckets, upload objects | | `buckets:delete` | Delete objects and buckets | | `vault:read` | List vault key names (never values) | | `vault:write` | Set and delete vault secrets | | `domains:read` | List custom domains and their status | | `domains:write` | Register and verify custom domains | | `domains:delete` | Remove custom domains | | `account:read` | List API tokens | | `account:write` | Create and revoke API tokens | | `vesicle:read` | List webhook endpoints, list captures, read a capture | | `vesicle:write` | Issue, bind and rotate endpoints; replay captures | | `vesicle:delete` | Revoke endpoints, drop captures | | `events:read` | Read the [account activity feed](https://docs.tissue.systems/docs/account/activity/) | | `billing:read` | Read entitlements and subscription state | | `billing:write` | Change entitlements and subscription state | | `mast:read` | Read [Mast](https://tissue.systems/mast/docs/api/) probes, alert sources, incidents, the feed and heartbeats | | `mast:write` | Connect Mast, create and change probes and alert sources, send, acknowledge | | `explant:export` | Request and download [an explant](https://docs.tissue.systems/docs/cells/explant/) of a Cell | 25 scopes in total. `events:read`, `billing:read`, `billing:write` and `explant:export` gate REST endpoints rather than MCP tools: no tool in the table above requires them, so a token holding only those sees just the two tools that need no scope. An owner's browser-login session holds all 25 implicitly; an admin or developer session is capped at its [role ceiling](https://docs.tissue.systems/docs/account/members/#roles). API tokens carry an explicit allow-list, capped the same way, so scope them to the minimum an agent needs. ### Common presets ```bash # Full access ribo token create "Claude" \ --scope cells:read --scope cells:write --scope cells:delete \ --scope databases:read --scope databases:write --scope databases:delete \ --scope buckets:read --scope buckets:write --scope buckets:delete \ --scope vault:read --scope vault:write # Read-only across everything ribo token create "Read-only" \ --scope cells:read --scope databases:read --scope buckets:read --scope vault:read # Deploy only (CI pipeline) ribo token create "CI" --scope cells:read --scope cells:write ``` --- ## Things to ask Claude Once connected, try: ``` Show me all my deployed Cells and their URLs. ``` ``` Create a c3 database called "todos" with a tasks table (id, title, done, created_at). ``` ``` Deploy a Cell called "hello" that returns "Hello, world!" for any request. ``` ``` Show me the last 20 errors from my "payment-processor" Cell. ``` --- ## Security notes - API tokens are shown once at creation and can't be retrieved again. Store them in a password manager. - Scope tokens to the minimum required. A data-analysis agent needs `databases:read`, not `cells:delete`. - The MCP server holds no credentials of its own. Revoking a token (`ribo token revoke ` or the dashboard) immediately cuts off all access. --- ## See also - [MCP server](https://docs.tissue.systems/docs/mcp/overview/): connecting Claude and other clients - [REST API](https://docs.tissue.systems/docs/api/): the `/v1` endpoints these tools call --- # Account / Accounts & users Source: https://docs.tissue.systems/docs/account/overview/ # Accounts, users and roles Four words carry the whole account model, and each has one meaning everywhere: in the dashboard, in `ribo`, over the REST API and through MCP. This page defines them. The pages after it cover each surface in depth. --- ## The four words | Word | Meaning | |---|---| | **User** | Your sign-in: one email address, a password, and [two-factor authentication](https://docs.tissue.systems/docs/account/security/) if you turn it on. A user owns nothing. Everything you deploy belongs to an account. | | **Account** | The container resources belong to: Cells, c3 databases, g7 buckets, custom domains, vault values, API tokens, billing, and the [activity feed](https://docs.tissue.systems/docs/account/activity/). Every account is the same kind of thing. There is no personal edition and no team edition; any account can hold one person or many. | | **Membership** | The link between a user and an account. One user can belong to many accounts, and one account can hold many users. | | **Role** | What a membership allows: **owner**, **admin** or **developer**. The role rides in every session and API token as a signed claim, and the platform caps the credential's scopes to it on every request. [Members and roles](https://docs.tissue.systems/docs/account/members/) has the ceilings. | An account has three identifiers, shown under **Account → Overview**: | Identifier | What it is | |---|---| | Name | A label, up to 100 characters. An owner can change it at any time, and renaming changes no URL. | | Id | `acct_<16 hex>`. Never changes. The value `ribo account pin` writes into `ribo.toml`. | | Subdomain | `-`, derived from the id. The account's Cells are served as `..tissue.dev`. | Resource names are scoped to the account: two accounts can each have a database, a bucket or a Cell called `myapp`, and they are unrelated. --- ## Signing up Signing up does three things in one step: it creates your user, creates one account, and makes you that account's owner. The sign-up form's **workspace name** field is the account's name; left blank, the account is called `'s workspace`, after the part of your address before the `@`. Change it later from **Account → Overview**. The account created at sign-up is not a special kind. It takes members, it can be renamed, left or closed, on the same terms as an account created later from the dashboard. If the address is already registered, sign-up answers *"That email address is already signed up. Sign in instead."* What exists is a user, and signing in as it is the way to reach every account that user belongs to. --- ## Joining an account A second person joins an account by **invitation**, never by signing up into it. An owner or admin sends an invite to an email address with a role of admin or developer. The link works for seven days and only for a session signed in as that address, so someone who is not signed up yet signs up first, with the same address, then opens the link. Accepting adds a membership and switches the session onto the new account. The full rules are under [inviting someone](https://docs.tissue.systems/docs/account/members/#inviting-someone). Ownership is not granted over the API or the dashboard. An account gets its owner at sign-up, and ownership moves by hand through support. --- ## Which account you are acting on A session is always on exactly one account. Signing in lands you on your **oldest membership**, which for anyone who signed up here is the account created then. Switching is explicit and re-issues the session at the role you hold on the account you switch to: | Surface | How | |---|---| | Dashboard | **Account → Overview → Your accounts** | | `ribo` | `ribo account whoami` to check, `ribo account switch ` to change. A [profile](https://docs.tissue.systems/docs/ribo/profiles/) binds a directory to one credential, and the [account pin](https://docs.tissue.systems/docs/cells/configuration/#account-pin) aborts a deploy aimed at the wrong account. | | API tokens | A `tok_` token is minted on one account and acts there only. | A user whose last membership is gone is not stranded: the next sign-in creates a fresh account for them, named `'s workspace`, with them as owner. --- ## Leaving and closing **Leaving** an account removes your membership and nothing else. The account and everything in it stay. Anyone can leave without an administrative role; an owner hands ownership over first. **Closing** an account destroys it and everything it owns, after a seven-day grace period any owner can cancel. Only an owner can close an account. A user whose only membership was the closed account is deleted with it, and can sign up again with the same address. The full sequence is on [closing an account](https://docs.tissue.systems/docs/account/closing/). --- ## See also - [Members and roles](https://docs.tissue.systems/docs/account/members/): roles, ceilings, inviting, removing - [Your account profile](https://docs.tissue.systems/docs/account/profile/): name, identifiers, email address - [Sign-in and two-factor authentication](https://docs.tissue.systems/docs/account/security/): the user side - [Accounts & profiles](https://docs.tissue.systems/docs/ribo/profiles/): keeping two accounts apart on one machine --- # Account / Sign-in & 2FA Source: https://docs.tissue.systems/docs/account/security/ # Sign-in and two-factor authentication Your user is one sign-in across the dashboard, the `ribo` CLI, the MCP server and Tissue Mast: an email address, a password, and two-factor authentication if you turn it on. It is the person, not the account; what a user and an account each are is on [Accounts, users and roles](https://docs.tissue.systems/docs/account/overview/). This page covers the password, two-factor authentication, recovery codes, and what happens when you sign out other devices. Everything here lives in the dashboard under **Account → Security**. --- ## Your password A password must be at least 8 characters, and it is checked against a public corpus of breached passwords before it's accepted: at sign-up, at password reset, and at password change. A match is refused with *"That password has appeared in a public breach. Choose a different one."* The check uses the range API at `api.pwnedpasswords.com`: only the first five characters of the SHA-1 hash of the password leave the platform, and the full hash is compared locally against the returned list. If the lookup fails or times out after 5 seconds, the password is allowed. Failing closed would block the exact action a breach notice asks a person to take. **Changing your password signs out every other device.** The browser you changed it in stays signed in; every other browser session and every `ribo login` of your user ends. See [signing out other devices](#signing-out-other-devices) for the timing. --- ## Two-factor authentication Two-factor authentication adds a six-digit code from an authenticator app after your password. Tissue uses standard TOTP: a 30-second step, six digits, and a shared secret you scan once. ### Turning it on 1. **Account → Security → Set up two-factor.** 2. Scan the QR code with an authenticator app, or type the secret shown beside it if the camera is not an option. 3. Enter the current six-digit code to confirm. Enrolment is not live until step 3 succeeds. An unconfirmed enrolment is discarded after 10 minutes, so a QR code left open on a screen does not stay usable. Codes are accepted for the current 30-second step and one step either side, which covers a clock that is up to 30 seconds out. A code that has been used cannot be used a second time, even inside its window. ### Signing in with it The sign-in page asks for the code after the password. The challenge is valid for 5 minutes and allows 5 attempts; a sixth attempt needs a fresh sign-in. Your password alone sets no cookie. ### Turning it off Turning two-factor off asks for your password **and** a current code or a recovery code. Both are required: a stolen session cookie plus a phished password should not be enough to remove the factor. ### What two-factor covers | Surface | Second factor asked for | |---|---| | Dashboard sign-in | Yes | | `ribo login` (browser authorization) | **No**: email and password only | | MCP browser login | **No**: the same authorization page, so email and password only | | `tok_` API tokens | Not applicable: a token is a bearer credential with no sign-in step | There's one limit: two-factor authentication protects the dashboard sign-in form. The OAuth authorization page that `ribo login` and the MCP client open verifies your email and password and stops there. Two other facts follow from how sessions are versioned: - **Turning two-factor on or off signs out every other session**, including any `ribo login` of your user. The device you did it from stays signed in. - **An existing `tok_` API token keeps working** through all of it. API tokens are not tied to your sign-in state; they are revoked by deleting them (`ribo token revoke `, or the API tokens page). --- ## Recovery codes Confirming two-factor enrolment produces **10 recovery codes**, each shaped `xxxxx-xxxxx`, drawn from an alphabet with no `i`, `l`, `o`, `0`, or `1` so a printed code cannot be misread. Store them somewhere other than the phone holding the authenticator app. Codes are stored as SHA-256 hashes. They can't be shown again. The screen that displays them is the only time they exist in readable form. - A recovery code substitutes for the six-digit code at sign-in, and at the second-factor prompt on [account closure](https://docs.tissue.systems/docs/account/closing/). - Each code works once. Using one **signs out every other session**, because a spent recovery code means the authenticator is presumed lost, and emails you the number of codes left. - **Regenerate recovery codes** replaces all 10 with a fresh set and invalidates the old ones. It does not sign anything out. If you lose both the authenticator app and the codes, no self-service path exists. Contact [support](https://support.tissue.systems) from the address you sign in with. --- ## Signing out other devices **Account → Security → Sign out other devices** ends every other browser session and every `ribo login` of your user, on every account you belong to. The device you clicked it from stays signed in. No password is asked for; the action is destructive to sessions only, and it is the thing a person reaches for in a hurry. **The timing is not instant everywhere.** Signing out takes effect: - **immediately** for the account area and the auth service, which reads the session counter directly, and - **within 15 seconds** for the management API, the `ribo` CLI, and MCP clients, which read a cached copy of that counter and refresh it on a 15-second cycle across every edge. So a `ribo deploy` already in flight, or one started in the same second, can still succeed. Fifteen seconds later it cannot. **API tokens are not affected.** A `tok_` token survives a sign-out, a password change, and a two-factor change by design: killing a CI pipeline's deploy token is not what "sign out my other laptop" should mean. Revoke tokens on the API tokens page or with `ribo token revoke `. Everything that moves the session counter, and therefore ends other sessions: | Action | Other sessions ended | |---|---| | Sign out other devices | Yes | | Change password | Yes | | Confirm an email change | Yes | | Turn two-factor on or off | Yes | | Sign in with a recovery code | Yes | | Have your role changed, or be removed from an account | Yes, for that person | | Account purge | Yes, for every member | | Regenerate recovery codes | No | | Schedule or cancel an account closure | No | A dashboard session cookie lasts 24 hours; a `ribo login` credential lasts 30 days. Both carry the session counter, so both answer to the table above. --- ## New sign-in notices A sign-in from a device and network you have not signed in from for 30 days sends an email with the IP address, the user agent, and the time. Devices in regular use are announced once, not monthly: the record is refreshed on every sign-in, so the 30-day window rolls forward. The notice is preference-gated; see [email preferences](https://docs.tissue.systems/docs/account/profile/#email-preferences). Security notices for password changes, email changes, two-factor changes, and scheduled closures are sent regardless of preferences. --- ## See also - [Your account profile](https://docs.tissue.systems/docs/account/profile/): changing your email address and notification preferences - [Members and roles](https://docs.tissue.systems/docs/account/members/): who can do what on a shared account - [Account activity](https://docs.tissue.systems/docs/account/activity/): the audit feed of mutating actions - [Accounts & profiles](https://docs.tissue.systems/docs/ribo/profiles/): which account the CLI acts on --- # Account / Profile & email Source: https://docs.tissue.systems/docs/account/profile/ # Your account profile The dashboard's **Account → Overview** tab holds the things that identify an account: its name, its identifiers, the email address you sign in with, and what Tissue may email you about. --- ## Account name and identifiers The account name is a label, up to 100 characters, and only an **owner** can change it. Three identifiers sit beside it: | Field | What it is | |---|---| | Account id | `acct_<16 hex>`, the value `ribo account pin` writes into `ribo.toml` | | Subdomain | The `-` label your Cells are served under: `..tissue.dev` | | Role | Your role on this account: owner, admin, or developer | **Renaming an account does not change its URLs.** The subdomain is derived from the account id, not from the name, so `ribo deploy` targets and live Cell addresses are unaffected by a rename. --- ## Changing your email address Your user's email address is what you sign in with and where account email is sent. Changing it is a two-step move, from **Account → Overview → Email address → Change**: 1. Enter the new address and your current password. 2. Open the confirmation link mailed to the **new** address. A notice also goes to the old address, so a change made with a stolen session is visible at the mailbox that no longer controls the account. Before you start: - **The link expires in one hour**, and only the most recent link works. Requesting a second change voids the first, so an old link sitting in a mailbox cannot move the address later. - **The confirmation link needs no session.** A mailbox is often opened in a browser that has never signed in to Tissue. The link completes the change and signs nobody in. - **Confirming signs out every other device**, including any `ribo login`. See [signing out other devices](https://docs.tissue.systems/docs/account/security/#signing-out-other-devices). - **Step 1 answers the same way whether or not the address is already registered.** *"Check your new address for a confirmation link"* is what you get either way; if the address belongs to another user, no mail is sent. The endpoint is not a way to test which addresses have Tissue accounts. - **The address is claimed at confirm time, not at request time.** If someone else takes it in the intervening hour, the link answers *"That email address is now in use"* and your address is unchanged. Address comparison is case-insensitive, so `Ada@example.com` and `ada@example.com` are the same address. --- ## Email preferences Two switches under **Email preferences** control non-essential mail: | Preference | Controls | |---|---| | New sign-in alerts | The email sent when the account is signed in to from a device and network not seen for 30 days | | Product updates | Occasional mail about the platform | Security notices are not preference-gated and are always sent: password changed, email change requested and completed, two-factor turned on or off, a recovery code used, an invite issued to you, and an [account closure](https://docs.tissue.systems/docs/account/closing/) scheduled. Turning new sign-in alerts off does not stop the device record from being kept, so turning them back on does not produce a burst of notices about devices you already use. --- ## Belonging to several accounts One user can belong to several accounts, for example the one created when you signed up and a company's. **Your accounts** lists them with their ids, and switching re-issues your session against the account you pick, at the role you hold there. For the CLI, the equivalent is `ribo account switch`, and the safer pattern when you work in more than one account at a time is a directory-bound profile. See [Accounts & profiles](https://docs.tissue.systems/docs/ribo/profiles/). --- ## See also - [Sign-in and two-factor authentication](https://docs.tissue.systems/docs/account/security/): passwords, TOTP, recovery codes, sessions - [Members and roles](https://docs.tissue.systems/docs/account/members/): inviting people to a shared account - [Exporting your data](https://docs.tissue.systems/docs/account/export/): a JSON file of what the account holds --- # Account / Members & roles Source: https://docs.tissue.systems/docs/account/members/ # Members and roles Any account can be shared, the one created for you at sign-up as much as one you create later. Invite people by email, give each one a role, and the platform enforces what that role may do: in the dashboard, in `ribo`, over the REST API, and through MCP. Members live under **Account → Members**. Only an owner or an admin sees the management controls. --- ## Roles | Role | May do | |---|---| | **owner** | Everything, including renaming the account, managing members, and [closing the account](https://docs.tissue.systems/docs/account/closing/) | | **admin** | Manage members and every resource, but no vault access and no account-level writes | | **developer** | Create and change Cells, databases, buckets and domains; delete none | Roles are not advisory. Every credential carries its role as a signed claim, and the management API narrows the credential's effective scopes to that role's ceiling on every request: | Role | Scopes it can exercise | Withheld | |---|---|---| | owner | All 25 | — | | admin | 22 | `vault:read`, `vault:write`, `account:write` | | developer | 12 | The three withheld from admin, plus every `*:delete`, plus `billing:*`, `vesicle:*` and `explant:export` | The twelve a developer holds are `cells:read`, `cells:write`, `databases:read`, `databases:write`, `buckets:read`, `buckets:write`, `domains:read`, `domains:write`, `account:read`, `events:read`, `mast:read` and `mast:write`. The two mast scopes are there because the person on call is often a developer: they can open Mast, link a phone and acknowledge a page. A role Tissue does not recognize is treated as a developer, which is the narrowest defined ceiling. The ceiling is a **cap, not a grant**: an API token holds the intersection of the scopes it was created with and what the holder's role allows. --- ## Inviting someone **Account → Members → Invite**, then give an email address and a role. `owner` isn't assignable over the API. Ownership moves by hand, at the operator console. - Your own address has to be verified. A session whose address has not opened its verification link is answered *"Verify your email address before inviting members."* and nothing is sent. - The invitation link is valid for **7 days**. - One open invite per address per account. A second invite to the same address answers *"There is already an open invite for that address."* - Inviting somebody who is already a member answers *"That person is already a member."* Whether the address is already signed up is not revealed: an invite to an address that has signed up looks exactly like any other. - An account sends at most 50 invites a day, one person sends at most 60 a day across every account they admin, and one address gets at most 3 a day from all accounts put together. Past any of these the answer is `429` and says which one. Revoked and accepted invites count, since each one was an email. - An invite can be withdrawn (**Revoke**) at any time before it is accepted. The link is already in the invitee's mailbox, so revoking is what makes it stop working there. ### Accepting The invitee opens the link and must be **signed in as the address the invite was sent to**. A different signed-in address gets *"That invite was sent to a different address"*. Forwarding the mail does not redirect the invite. Someone who has not signed up yet signs up with that address first, then opens the link again. Accepting joins the account and switches the session onto it at the invited role. Nothing the invitee already holds is revoked. An unknown, revoked, or expired link all answer with the same string, so a stale link is indistinguishable from a guess. --- ## Changing a role Owners and admins can move a member between `admin` and `developer`. **An owner cannot be demoted or removed over the API**, and the same message covers demoting any owner and demoting the last one, so the answer never reveals how many owners an account has. A role change takes effect by ending the member's sessions: they are signed out and sign back in at the new role. Two things move, and both have to land for the change to be fully applied: 1. Their sessions end: immediately in the account area, and **within 15 seconds** at the management API and `ribo`. 2. Their existing `tok_` API tokens on this account are re-cut down to the new role's ceiling, so a demoted admin cannot keep exercising `cells:delete` through a token minted while they could. If either half has not landed when the response is written, the dashboard reports the change as pending rather than done. The queued half drains on the next sign-in on the platform. --- ## Removing someone Removing a member deletes their membership, ends their sessions on the same timing as a role change, and **deletes every API token they hold on that account**. Their phones are signed out of the account's Mast pager and they are taken off its on-call rotations, along with any override they gave or were covered by. The session counter alone would not do it: a `tok_` token is deliberately outside that counter, so without the token delete a removed member would keep a working credential on an account they are no longer part of. Anyone can remove **themselves** without an administrative role, since leaving only reduces your own access. If you still belong to another account, your session is re-issued against it; if that was your only account, the session ends. An owner leaves by handing ownership over first. --- ## Every change is on the record Inviting, revoking an invite, joining, changing a role and removing all write a row to the [activity feed](https://docs.tissue.systems/docs/account/activity/) naming who did it and to whom. Leaving is recorded as a removal you performed on yourself, so the feed distinguishes it from an administrator removing you. --- ## What a developer sees of the account A developer's session can read the account and its [activity feed](https://docs.tissue.systems/docs/account/activity/), which is what `account:read` and `events:read` cover. Vault scopes sit above the admin ceiling, so listing a Cell's vault key names takes an owner's session or an API token an owner created. [Vault values are never returned](https://docs.tissue.systems/docs/cells/vault-security/) to any credential at any role. --- ## See also - [Accounts, users and roles](https://docs.tissue.systems/docs/account/overview/): what a user, an account and a membership are - [Sign-in and two-factor authentication](https://docs.tissue.systems/docs/account/security/): sessions and the 15-second revocation window - [Account activity](https://docs.tissue.systems/docs/account/activity/): who did what, and when - [MCP tools & scopes](https://docs.tissue.systems/docs/mcp/tools/): the full scope list and what each one grants - [Accounts & profiles](https://docs.tissue.systems/docs/ribo/profiles/): keeping two accounts apart on one machine --- # Account / Activity Source: https://docs.tissue.systems/docs/account/activity/ # Account activity Every mutating action on an account is recorded with the person who did it, what it touched, and when. The dashboard shows the feed under **Account → Activity**; the same data is available at `GET /v1/account/events`. This is the record for questions like *who deleted that Cell* and *when did that vault key change*, and on a shared account, *which of us did it*. --- ## What is recorded | Action | Written when | |---|---| | `member.invited` | Someone is [invited](https://docs.tissue.systems/docs/account/members/) to the account | | `member.invite_revoked` | An open invite is withdrawn | | `member.joined` | An invite is accepted and the person joins | | `member.role_changed` | A member moves between admin and developer | | `member.removed` | A member is removed, or leaves | | `cell.deploy.create` | A Cell is deployed for the first time | | `cell.deploy.update` | An existing Cell is redeployed | | `cell.delete` | A Cell is deleted | | `vault.set` | A vault secret is set or replaced | | `vault.delete` | A vault secret is deleted | | `gate.link.created` | A [gate](https://docs.tissue.systems/docs/cells/gate/) capability link is minted | | `gate.link.revoked` | A capability link is revoked | | `gate.session.revoked` | A gate viewer session is revoked | | `vesicle.capture.reveal` | A [vesicle](https://docs.tissue.systems/docs/vesicle/overview/) capture body is read in full | | `billing.entitlements` | The account's entitlements change | | `token.created` | An API token is created | | `token.revoked` | An API token is revoked | | `sso.connection_created`, `_updated`, `_deleted` | A [single sign-on](https://tissue.systems/mast/docs/sso/) connection is added, changed or deleted | | `sso.domain_added`, `_verified`, `_removed` | A sign-in domain is added, proven or taken off | | `sso.enforced`, `sso.unenforced` | Single sign-on is made the only way in, or stops being it | | `sso.signin`, `sso.signin_refused` | A member signs in through the provider, or is turned away | | `sso.test_signin` | The connection is tested | | `sso.break_glass` | An owner signs in past single sign-on | | `sso.sessions_revoked` | A member's sessions are ended by the provider | | `sso.member_provisioned` | A first sign-in through the provider makes a member | | `scim.token_created`, `scim.token_revoked` | A SCIM token is made or revoked | | `mast.channel.create`, `.update`, `.delete`, `.rotate` | A Mast alert source is created, changed or deleted, or gets a new URL | | `mast.channel.mute`, `.unmute`, `.test` | An alert source is muted, unmuted or sent a test | | `mast.channel.badge.create`, `.badge.delete` | An alert source's status badge is made or deleted | | `mast.heartbeat.create`, `.update`, `.delete` | A Mast heartbeat is created, changed or deleted | | `mast.heartbeat.rotate` | A heartbeat gets a new URL, and the one before it stops working | | `mast.heartbeat.mute`, `.unmute` | A heartbeat is muted or unmuted | | `mast.heartbeat.test` | A test is sent to a heartbeat | | `mast.heartbeat.badge.create`, `.badge.delete` | A heartbeat's status badge is made or deleted | | `mast.mail_domain.create`, `.update`, `.delete` | A mail domain is added to Mast, changed or deleted | | `mast.mail_domain.rotate` | A mail domain gets a new report address | | `mast.probe.create`, `.update`, `.delete` | A probe is created, changed or deleted | | `mast.probe_domain.create`, `.verify`, `.delete` | A probed domain is added, proven or removed | | `mast.message.ack`, `.resolve`, `.disown`, `.delete` | An incident is acknowledged, resolved, reported as [not yours](https://tissue.systems/mast/docs/delivery/#this-isn-39-t-mine), or deleted | | `mast.schedule.create`, `.update`, `.delete` | A rotation or its overrides are created, changed or deleted | | `mast.schedule.calendar_token` | A rotation's calendar link is made or replaced | | `mast.policy.create`, `.update`, `.delete` | An escalation policy is created, changed or deleted | | `mast.status_page.create`, `.update`, `.delete` | A status page is created, changed or deleted | | `mast.status_page.update_post`, `.update_edit`, `.update_delete` | A status update is posted, edited or deleted | | `mast.status_page.domain_verify` | A status page's own domain is checked | | `mast.maintenance.create`, `.update`, `.delete`, `.end` | A maintenance window is created, changed, deleted or ended early | | `mast.pause.start`, `.end` | Pages are paused, or the pause ends | | `mast.report.settings` | The weekly or monthly report's settings change | | `mast.device.link`, `.update`, `.delete` | A phone is linked, changed or removed | | `mast.link_code.create` | A link code is made | | `mast.pairing.create`, `.delete` | Two phones are paired as escalation partners, or unpaired | | `mast.owner.create`, `.connect`, `.disconnect` | Mast is set up on the account, or a phone's setup is connected to it or disconnected | | `mast.destination.create`, `.update`, `.delete` | A webhook or chat destination is created, changed or deleted | | `mast.destination.test`, `.replay`, `.reactivate`, `.relink` | A destination is tested, sent something again, turned back on, or linked to its chat again | | `mast.import.opsgenie`, `.pagerduty`, `.squadcast` | An import is applied. The same names ending in `.invite` are the invitations it sent | | `mast.retired_key.delete` | A deleted alert source's key is cleared from the list | | `mast.investigate.host_add`, `.host_delete` | A host is added to or removed from Investigate | | `account.created` | The account is made | | `account.closed` | A [closure](https://docs.tissue.systems/docs/account/closing/) is scheduled | | `account.close_cancelled` | A scheduled closure is cancelled | | `account.purged` | A closure completes and the account is destroyed | Gate **sign-ins** are not in the feed: one row per visitor sign-in on a gated Cell would drown everything else. Per-request traffic is a different thing entirely and lives in [analytics and the access log](https://docs.tissue.systems/docs/cells/analytics/). --- ## Retention The feed holds 30 days, 90 on Mast Team and 365 on Mast Company. Every response says which in `days`. Records older than that are deleted by a background prune, from the feed and from the store behind it. There is no longer-lived copy to ask for, so export anything you need to keep. See [exporting your data](https://docs.tissue.systems/docs/account/export/), whose `events` block carries up to 1000 rows from the same window. --- ## Reading it over the API ```bash curl -H "Authorization: Bearer $TISSUE_TOKEN" \ "https://api.tissue.systems/v1/account/events?limit=50" ``` ```json { "events": [ { "action": "cell.deploy.update", "actor_email": "ada@example.com", "actor_kind": "session", "target": "my-api", "detail": "{\"kind\":\"js\"}", "created_at": 1754870400 } ], "next_before": 1754870399, "days": 30 } ``` | Parameter | Meaning | |---|---| | `limit` | Rows per page, 1–500. Default 50 | | `before` | Keyset cursor in unix seconds, exclusive. Pass the previous response's `next_before` | | `action` | Exact action string from the table above | | `actor` | Only rows by one actor, spelled the way `actor_email` prints it | | `group` | `mast` for what was done in Mast, plus token changes; `cloud` for everything else. Both when left out | | `kind` | Only actions on one kind of thing: the action without its verb, such as `mast.heartbeat` or `token` | Paging walks backwards in time: request a page, then pass its `next_before` as `before` for the next one. `next_before` is `null` when the window is exhausted. The cursor is a timestamp rather than a row id because row ids are platform-wide, and an id cursor would tell one account how much every other account writes. Six fields come back per row and no more: `action`, `actor_email`, `actor_kind`, `target`, `detail`, `created_at`. `target` is the name of the thing acted on, which for deploys, gate changes and vault changes is the Cell name and for `member.*` rows is the other person's email address; `detail` is a small JSON document carried as a string, or `null`. A `member.removed` row carries `{"role":…,"self":…}`, where `self` is `true` when someone left on their own rather than being removed by an administrator. A vault event names the Cell, never the key's value. Source IP, server, and internal row ids stay inside the platform. `actor_email` is an email address when a signed-in person did it, `token: ` when the call came with an API token, `phone: ` when it came from a linked phone, and `system` when the platform acted on its own; `actor_kind` says the same in one word: `session`, `token`, `device`, `sso`, `scim` or `system`. The first page also carries `actors`, every actor with a row in the window. An `action` value that is not in the table, or a `group` that isn't one of the two, returns an **empty page, not an error**. The list of visible actions is fixed, and answering differently for an unlisted one would make the endpoint a way to discover the operator-only actions that exist. The endpoint needs the **`events:read`** scope. A session holds it at every role; an API token needs it granted explicitly. --- ## See also - [Exporting your data](https://docs.tissue.systems/docs/account/export/): the same events inside a full account export - [Members and roles](https://docs.tissue.systems/docs/account/members/): who can read the feed - [Analytics & access log](https://docs.tissue.systems/docs/cells/analytics/): per-request traffic data, which this feed is not --- # Account / Data export Source: https://docs.tissue.systems/docs/account/export/ # Exporting your data An export is a single JSON file describing what the account holds: its Cells, databases, buckets, domains, API tokens, webhook endpoints, members, and recent [activity](https://docs.tissue.systems/docs/account/activity/), as far back as [the plan keeps it](https://docs.tissue.systems/docs/account/activity/#retention). Download it from **Account → Overview → Export account data**, or call the API. ```bash curl -L -H "Authorization: Bearer $TISSUE_JWT" \ -o tissue-export.json \ https://api.tissue.systems/v1/account/export ``` The file is served as an attachment named `tissue-export--.json`. --- ## What the export is, and what it is not **It is metadata, not content.** The export lists the things the account owns; it does not contain them. For the content of one Cell (deployed source, database snapshots, bucket objects, as one verifiable archive), take [an explant](https://docs.tissue.systems/docs/cells/explant/). | In the file | Not in the file | |---|---| | Cell names, addresses, bindings, deploy timestamps | Cell source code | | Database names | Database rows: use `ribo db exec ""` | | Bucket names | Objects: use `ribo bucket cp` or the [S3 API](https://docs.tissue.systems/docs/g7/s3-api/) | | Custom domains and their status | — | | API token ids, names, scopes, creation and last-use times | Token values, which exist only at creation | | Members with roles and join dates | Password hashes, TOTP secrets, recovery-code digests, invite tokens | | Webhook endpoints | Captured request bodies: read those through the [vesicle API](https://docs.tissue.systems/docs/vesicle/api/) | | Up to 1000 activity events | Anything older than the plan's activity window, 30 days on most accounts | No credential and nothing close enough to one to be attacked offline leaves this endpoint. An export is a file people mail to themselves. --- ## Rules the endpoint enforces **A signed-in session is required.** `GET /v1/account/export` refuses a `tok_` API token with *"Export requires a signed-in session."* A whole-account snapshot should take the credential a person holds, not one left in a CI runner. Use the dashboard button, or a JWT from `ribo login`. **One export per five minutes per account.** A second call inside the window answers `429` with `Retry-After: 300`. **A `null` block means unavailable, not empty.** The `members` block is assembled by a different service from the rest of the file. When that call fails, the key is `null` rather than `[]`, so an export never quietly reports an account as having no members when the truth was that nobody could be asked. --- ## Shape of the file ```json { "exported_at": "2026-08-12T18:04:11Z", "account": { "id": "acct_…", "name": "Acme", "email": "ada@example.com", "subdomain": "strand-9c" }, "members": [ { "email": "…", "role": "owner", "joined_at": "…" } ], "cells": [ … ], "databases": [ … ], "buckets": [ … ], "domains": [ … ], "tokens": [ { "id": "…", "name": "CI", "scopes": ["cells:read"], "created_at": …, "last_used_at": … } ], "vesicle_endpoints": [ … ], "events": [ … ] } ``` Blocks may gain keys over time. Read the ones you need by name rather than by position. --- ## See also - [Account activity](https://docs.tissue.systems/docs/account/activity/): the events block on its own, with paging - [Closing an account](https://docs.tissue.systems/docs/account/closing/): export before the grace period runs out - [ribo CLI reference](https://docs.tissue.systems/docs/ribo/reference/): pulling database rows and bucket objects --- # Account / Closing an account Source: https://docs.tissue.systems/docs/account/closing/ # Closing an account Closing an account destroys everything it owns. To make that survivable, a closure is **scheduled**, not immediate: seven days pass before anything is deleted, and any owner can cancel inside that window. Closure lives at the bottom of **Account → Overview**. --- ## Scheduling a closure Only an **owner** can close an account. The confirmation asks for three things: 1. Your current password. 2. The account name, typed exactly. 3. A second factor, if [two-factor authentication](https://docs.tissue.systems/docs/account/security/) is armed on your user: a current six-digit code or one recovery code, which is spent. The account name is checked before the second factor, so a typo in the name does not cost you a recovery code. An account with an active subscription is refused: cancel the subscription first. A closure that is already scheduled is refused too: one open closure per account. **Every owner is emailed**, not only the one who asked. An owner who did not request this is the person that notice exists for, and they have seven days to act on it. --- ## The grace period The deadline is **seven days from the moment the closure is scheduled**, computed on the server and re-derived before anything is deleted. It cannot be shortened by a client, so a stolen session cannot turn a closure into an instant one. Nothing changes during those seven days: - Cells keep serving. - Databases, buckets, and webhook endpoints keep working. - Nobody is signed out. Scheduling a closure deliberately doesn't end sessions, because you may need them to take an [export](https://docs.tissue.systems/docs/account/export/). The dashboard shows a standing banner with the date, and **Cancel closure** beside it. Any owner can cancel, and cancelling asks for no re-authentication: undoing a destructive action should be easier than starting one. Cancelling after the purge has begun is not possible. The answer is *"The purge has already started and cannot be cancelled."* --- ## What the purge deletes After the deadline, a sweep running every five minutes picks the account up and deletes, in order: - API tokens and the account's object-storage credentials - Custom domains - Every Cell: its deployed code, its static files, gate policies, capability links and viewer sessions, pulse schedules, and its traffic and visitor rollups - Vault secrets - c3 databases, with their contents - g7 buckets, with their objects - Vesicle endpoints and every captured request - Sensor devices - Account flags, ingest limits, and the account's subdomain - Memberships, open invites, and the account itself - The user of anyone whose only membership was this account (their sign-in), along with their recovery codes, pending enrolments, and remembered devices Someone whose user is deleted this way can sign up again with the same address. Members who belong to another account keep that account and their identity. The cascade is a delete per resource, keyed by the account, so a step that fails can be re-run. A closure that stalls partway leaves the account marked as purging with the error recorded, rather than half-deleted and unmarked. --- ## What survives the purge Four things are not deleted: - **Audit records.** The [activity feed](https://docs.tissue.systems/docs/account/activity/) rows, including `account.closed` and `account.purged`, stay in the audit store and age out on [the feed's own retention](https://docs.tissue.systems/docs/account/activity/#retention): 30 days for most accounts, longer on the paid Mast plans. So records of what was done on the account outlive it by up to that long after each was written, which can be after the account itself is gone. They carry the action, the actor's email address, the target's name, and the time. - **Abuse records.** A suspension recorded against the account is kept, so a closure is not a way to shed one. - **Payment records.** Charges and invoices held by the payment processor are outside the platform's stores and are not part of the purge. - **Access-log files.** The per-request [access log](https://docs.tissue.systems/docs/cells/analytics/) is written to a platform-wide store keyed by Cell address, and the cascade does not reach into it. Those files age out on the access log's own **30-day** retention, so a purged account's last 30 days of request lines outlive it by up to that long. Everything else goes with the resources it belongs to: analytics rollups, visitor counts, and captured webhook payloads are deleted with the Cells and endpoints they describe. --- ## Before you close Take an [export](https://docs.tissue.systems/docs/account/export/) while the account still exists, and pull anything the export doesn't contain: database rows with `ribo db exec`, bucket objects with `ribo bucket cp`, Cell source from wherever you deploy it. After the purge there is nothing to restore from. --- ## See also - [Exporting your data](https://docs.tissue.systems/docs/account/export/): what the export file holds - [Account activity](https://docs.tissue.systems/docs/account/activity/): the records that outlive the account - [Members and roles](https://docs.tissue.systems/docs/account/members/): leaving an account instead of closing it --- # Glossary / What is a serverless function? Source: https://docs.tissue.systems/docs/glossary/serverless-function/ # What is a serverless function? A serverless function is a piece of code you deploy on its own, without a server to manage, that runs when something calls it: usually an HTTP request, sometimes a timer or an incoming message. There are still servers. Someone else runs them, starts your code when a request needs it, and keeps it running as long as traffic does. --- ## How it works You hand the platform your code and a little configuration. The platform gives the function an address, routes requests to it, and runs as many copies as the traffic needs. Your code exports a handler that takes a request and returns a response. Between requests it keeps no state you can count on, so anything that has to last goes into a database or object store the platform connects for you. The trade is control for less work. You don't patch an operating system, size a machine or keep a process alive, and you usually pay for use rather than for a server sitting idle. In return you live inside the platform's limits on CPU time per request, memory and what the code is allowed to reach. --- ## Serverless functions on Tissue Cloud On Tissue Cloud a serverless function is called a **Cell**. A Cell is a JavaScript or WebAssembly module that exports `fetch(request, env)`, and `ribo deploy` puts it on a live HTTPS URL of the form `https://..tissue.dev`. Storage comes in as bindings declared in `ribo.toml`: a SQL database with c3, object storage with g7, secrets from the vault. A Cell can also export `pulse(event, env)` to run on a cron schedule. Each request gets up to 10 seconds of CPU time, and time spent waiting on the network doesn't count toward it. [Cells overview](https://docs.tissue.systems/docs/cells/overview/) covers the model in full, and the [quick start](https://docs.tissue.systems/docs/get-started/) deploys one in a few minutes. --- ## Related - [What is a V8 isolate?](https://docs.tissue.systems/docs/glossary/v8-isolate/) - [What is a cold start?](https://docs.tissue.systems/docs/glossary/cold-start/) - [Build a JSON API with SQLite](https://docs.tissue.systems/docs/tutorials/json-api-sqlite/) --- # Glossary / What is a V8 isolate? Source: https://docs.tissue.systems/docs/glossary/v8-isolate/ # What is a V8 isolate? A V8 isolate is one self-contained instance of the V8 JavaScript engine, the engine inside Chrome and Node.js. It has its own heap, its own globals and its own garbage collector, and code running in one isolate can't see memory in another. Many isolates can run inside a single operating-system process. --- ## How it works V8 was built for browser tabs: lots of untrusted scripts on one machine, each kept away from the others. Serverless platforms use the same boundary to run code from many customers side by side. Instead of a container or virtual machine per function, the host process creates an isolate per function and runs the request inside it. An isolate is far lighter than a container. There's no operating system to boot and no language runtime to load, only the engine's own setup and your script. The cost is that the code has to be JavaScript or WebAssembly, and it reaches the outside world only through the APIs the host gives it, such as `fetch()`, rather than through files and raw sockets. Most of those APIs follow web standards, so `Request`, `Response`, `URL` and `crypto.subtle` behave the way they do in a browser. --- ## V8 isolates on Tissue Cloud Every Cell on Tissue Cloud runs in its own V8 isolate, with its own memory, heap and execution context. Two Cells can't share a variable or a cache, and a bug in one can't touch another. The isolate is reused across requests while the Cell stays warm, so a global variable may survive between two requests, but nothing promises that it will; data that must last goes into c3 or g7. A redeploy sends new requests to a fresh isolate running the new code. [Cells overview](https://docs.tissue.systems/docs/cells/overview/#isolation) describes the isolation model, and [Cell limitations](https://docs.tissue.systems/docs/cells/limitations/) lists what an isolate can and can't reach. --- ## Related - [What is a serverless function?](https://docs.tissue.systems/docs/glossary/serverless-function/) - [What is a cold start?](https://docs.tissue.systems/docs/glossary/cold-start/) - [What is an edge function?](https://docs.tissue.systems/docs/glossary/edge-function/) --- # Glossary / What is an edge function? Source: https://docs.tissue.systems/docs/glossary/edge-function/ # What is an edge function? An edge function is a serverless function that runs on servers spread across several locations, so a request is handled at a location near the person who sent it rather than in one central region. "The edge" means the outer layer of a network, the servers closest to users. --- ## How it works The platform puts the same code on every edge location. DNS or network routing then sends each visitor to a nearby one: the hostname resolves to different addresses depending on where the question comes from, or many locations announce the same address. Shorter distance means less round-trip time, which matters most for small, fast responses such as redirects, API calls, authentication checks and personalised pages. Code at the edge is only as quick as the data it needs. A function near the user that has to fetch every row from a database on another continent gains little. Edge platforms tend to answer that with caches, read replicas, or by keeping data next to the function, and each choice changes how fresh the data is and where writes go. It's worth knowing which one your platform picks before you rely on it. --- ## Edge functions on Tissue Cloud Tissue Cloud runs Cells on more than one serving edge. A Cell's `tissue.dev` hostname answers with the address of the Tissue edge nearest whoever asked, so `dig` run from two places can return two different addresses for the same Cell, and both are right. You deploy once, and each edge picks up the new version on its next request for that Cell. A Cell's bindings to c3, g7 and the vault work from any edge, and an access policy set with [Gate](https://docs.tissue.systems/docs/cells/gate/) is checked at the edge before the Cell runs. [Custom domains](https://docs.tissue.systems/docs/cells/custom-domains/) explains how edge routing applies when you put a Cell on your own domain. --- ## Related - [What is SQLite at the edge?](https://docs.tissue.systems/docs/glossary/sqlite-at-the-edge/) - [What is a serverless function?](https://docs.tissue.systems/docs/glossary/serverless-function/) - [What is a V8 isolate?](https://docs.tissue.systems/docs/glossary/v8-isolate/) --- # Glossary / What is a cold start? Source: https://docs.tissue.systems/docs/glossary/cold-start/ # What is a cold start? A cold start is the extra delay on a request that arrives when a serverless function isn't loaded and ready, so the platform has to set it up before your code can answer. The requests after that, served by the copy that's already running, are warm. --- ## How it works To run a function the platform needs somewhere for it to live: a container, a small virtual machine, or a JavaScript isolate. On a cold request it has to create that, load the runtime, load your code, and run whatever your code does at startup (imports, reading config, opening connections). Only then does the handler see the request. Platforms keep a running copy around for a while after traffic, and when it goes quiet they reclaim it, so the next request is cold again. How long that takes depends mostly on what gets started. Booting a container with a full language runtime is the slow end, and it gets slower as the image and dependencies grow. An isolate inside a process that's already running skips the operating system and runtime entirely and only has to compile your script. Within any of these, a bigger bundle and more work at startup make it slower. What you can do about it: keep the deployed code small, do less at module load, and connect to storage lazily, at the point a request needs it. --- ## Cold starts on Tissue Cloud Cells run in V8 isolates, so a cold Cell never waits for a container or virtual machine to boot. A new isolate is set up the first time a Cell is needed and after every redeploy, then reused across requests for warm performance. Bundle size is the thing you control: a deploy upload is capped at 20 MB, and larger bundles add cold-start latency, so keep compiled WebAssembly under a few megabytes. Bindings to c3 and g7 need no connection setup in your code, which keeps startup work down. [Cell limitations](https://docs.tissue.systems/docs/cells/limitations/) has the size limits, and [Cells overview](https://docs.tissue.systems/docs/cells/overview/#isolation) explains isolate reuse. --- ## Related - [What is a V8 isolate?](https://docs.tissue.systems/docs/glossary/v8-isolate/) - [What is a serverless function?](https://docs.tissue.systems/docs/glossary/serverless-function/) --- # Glossary / What is SQLite at the edge? Source: https://docs.tissue.systems/docs/glossary/sqlite-at-the-edge/ # What is SQLite at the edge? SQLite at the edge means giving serverless and edge functions a SQLite database to use, instead of a separate database server they connect to over a pool of connections. The function sends SQL and gets rows back. The database behind it is SQLite, the small, file-based SQL engine that runs inside phones, browsers and countless applications. --- ## How it works SQLite was built to be embedded: the whole database is one file, and the engine is a library rather than a server. That suits serverless well. There's no connection limit to exhaust when hundreds of short-lived functions start at once, no server to size, and creating a new database is as cheap as creating a file, so one database per app, per customer or per test run is practical. Functions don't have a disk that lasts, though, so the platform keeps the database file for them and exposes it through an API. Designs differ in where the file lives and how copies are kept. Some keep one primary copy and send every query to it. Some add read replicas near users, which makes reads fast and leaves writes going to the primary, with replicas a moment behind. Before choosing one, check where writes go and how stale a read is allowed to be. --- ## SQLite on Tissue Cloud Tissue Cloud's database service is c3. Each database is a full SQLite database with ordinary tables, indexes, transactions and SQL. A Cell reaches it through a `c3` binding in `ribo.toml`, with no connection string or credentials in the code, and talks to it through a SQL API with exec, batch, prepare and bind methods: `env.DB.prepare(sql).bind(...).all()`. `batch()` runs a list of statements as one transaction. You create a database with `ribo db create ` and can query it from a terminal with `ribo db exec`. The database lives on Tissue's servers, not inside the Cell, so it persists across deploys and every edge running the Cell sees the same data. [c3 overview](https://docs.tissue.systems/docs/c3/overview/) covers schemas, transactions and migrations, and [c3 limitations](https://docs.tissue.systems/docs/c3/limitations/) lists what the API refuses. --- ## Related - [Build a JSON API with SQLite](https://docs.tissue.systems/docs/tutorials/json-api-sqlite/) - [What is an edge function?](https://docs.tissue.systems/docs/glossary/edge-function/) --- # Glossary / What is object storage? Source: https://docs.tissue.systems/docs/glossary/object-storage/ # What is object storage? Object storage keeps files as objects in buckets. Each object is a blob of bytes with a key, such as `photos/2026/beach.jpg`, plus a little metadata like its content type and size. You put, get, list and delete whole objects by key over HTTP. There are no real folders and no editing part of a file in place. --- ## How it works A bucket is a flat namespace. Slashes in keys look like directories, and tools show them that way, but `photos/2026/beach.jpg` is one string, and "listing a folder" is listing every key that starts with a prefix. Writing an object replaces it whole. In exchange the storage spreads over many disks and machines, keeps redundant copies, and holds as much as you put in without you managing volumes. **S3-compatible storage** speaks the API Amazon defined for S3: the same requests, the same AWS Signature Version 4 signing, the same error shapes. That API is now the common language of object storage, so the AWS CLI, boto3, rclone, backup tools and most SDKs can talk to any S3-compatible service once you set the endpoint URL and credentials. Object storage suits images, uploads, backups, build artifacts, logs and static sites, where the unit is a whole file. Data you query by field belongs in a database. --- ## Object storage on Tissue Cloud Tissue Cloud's object storage is g7. You create a bucket with `ribo bucket create `. Inside a Cell, a `g7` binding gives you `put`, `get`, `head`, `delete` and `list` with no keys or signing. Outside a Cell, every bucket speaks the S3 API at `https://g7.tissue.systems`, region `tissue`, with path-style addressing and a key that unlocks only that one bucket. Buckets are private by default; `--public` allows anonymous reads. A single `put()` takes up to 100 MiB, and over the S3 API that cap applies per multipart part. [g7 overview](https://docs.tissue.systems/docs/g7/overview/) covers the binding and [g7 S3 API](https://docs.tissue.systems/docs/g7/s3-api/) covers outside clients. --- ## Related - [What is a presigned URL?](https://docs.tissue.systems/docs/glossary/presigned-url/) - [Handle file uploads with object storage](https://docs.tissue.systems/docs/tutorials/file-uploads/) --- # Glossary / What is a presigned URL? Source: https://docs.tissue.systems/docs/glossary/presigned-url/ # What is a presigned URL? A presigned URL is a link to one object in object storage that carries its own signature and expiry time in the query string. Whoever holds it can perform one specific action, such as downloading or uploading that object, with no account and no credentials, until it expires. --- ## How it works Someone who does have credentials signs the request ahead of time. With S3-compatible storage the signature uses AWS Signature Version 4 and covers the HTTP method, the bucket and key, the expiry and a timestamp, and it goes into the URL as `X-Amz-*` query parameters. When the link is used, the storage service recomputes the signature with the same secret key. If the method, path or expiry has been changed, or the time has passed, the request is refused. The common uses are handing someone a private file for a limited time, and letting a client upload straight to storage without the bytes passing through your server. In the upload case your server checks who is asking, mints a short-lived `PUT` URL for one key, and the client sends the file to that URL. Keep the expiry short. A presigned URL works for anyone who has it until it expires, so a leaked one stays usable for that long. --- ## Presigned URLs on Tissue Cloud g7 buckets support presigned URLs two ways. Any S3 client can presign against `https://g7.tissue.systems` with a bucket's own credentials, for example `aws s3 presign` or boto3's `generate_presigned_url`. The management API also mints one for a single object with `POST /v1/buckets/:bucket/presign`: a `PUT` unless you ask for another method, valid for 15 minutes unless you ask for a different expiry, up to 24 hours. Download links are served from `g7.tissue.dev`, the domain Cells use, so an uploaded file never runs as a page on `tissue.systems`; upload links work on `g7.tissue.systems` as signed. The g7 binding inside a Cell has no presign method, because a Cell can read and write the bucket directly. [g7 buckets](https://docs.tissue.systems/docs/g7/buckets/#public-access-and-external-clients) and [g7 S3 API](https://docs.tissue.systems/docs/g7/s3-api/#aws-cli-examples) have the details and examples. --- ## Related - [What is object storage?](https://docs.tissue.systems/docs/glossary/object-storage/) - [Handle file uploads with object storage](https://docs.tissue.systems/docs/tutorials/file-uploads/) --- # Glossary / What is a cron expression? Source: https://docs.tissue.systems/docs/glossary/cron-expression/ # What is a cron expression? A cron expression is a short line of text that describes a repeating schedule, such as "every five minutes" or "09:00 on weekdays". It comes from `cron`, the Unix job scheduler, and the same five-field format is used by most scheduled-job systems. --- ## How it works The five fields, separated by spaces, are minute, hour, day of month, month and day of week: ┌──────── minute (0-59) │ ┌────── hour (0-23) │ │ ┌──── day of month (1-31) │ │ │ ┌── month (1-12) │ │ │ │ ┌ day of week │ │ │ │ │ 30 6 * * * Each field takes a number, a `*` for every value, a list (`0,30`), a range (`1-5`) or a step (`*/15`, every 15th value). A job runs whenever the current time matches every field. `0 * * * *` is the top of every hour, `*/5 * * * *` every five minutes, `0 0 1 * *` midnight on the first of each month. Two things trip people up. First, the time zone: a schedule runs in whatever zone the scheduler uses, which is often UTC rather than your local time. Second, day of week: classic cron counts from 0 for Sunday, but not every system does, so check before you write `1-5`. Some systems also accept shorthands like `@hourly` or extra fields for seconds and years; plain five-field expressions are the portable form. --- ## Cron expressions on Tissue Cloud Tissue Cloud runs scheduled work with pulse. You add a `[[pulse]]` block to `ribo.toml` with a five-field `schedule`, and export a `pulse(event, env)` function from the Cell. All schedules are UTC. Day of week counts from **1 for Sunday** through 7 for Saturday, so Monday to Friday is `2-6` and a `0` is refused; names such as `mon-fri` work too. There's no `@hourly` shorthand. The shortest interval is one minute, a Cell can have up to 25 schedules, and `ribo deploy` rejects a schedule it can't parse before anything is published. [Pulse overview](https://docs.tissue.systems/docs/pulse/overview/#cron-schedule-reference) has the full field table and examples. --- ## Related - [Run a cron job without a server](https://docs.tissue.systems/docs/tutorials/scheduled-job/) - [What is a serverless function?](https://docs.tissue.systems/docs/glossary/serverless-function/) --- # Glossary / What is a webhook? Source: https://docs.tissue.systems/docs/glossary/webhook/ # What is a webhook? A webhook is an HTTP request one service sends to a URL you give it when something happens on its side: a payment succeeds, someone pushes to a repository, a form is submitted. Instead of your code asking every few minutes whether anything changed, the other service tells you as it happens. --- ## How it works You register a URL with the sending service and choose which events you want. When one occurs, the service sends a `POST` to that URL, usually with a JSON body describing the event and a few headers naming the event type and a delivery id. Your endpoint does its work and answers with a `2xx` status. If it doesn't answer, or answers with an error, most services retry for a while and then give up. Because the URL is public, anyone can post to it. Senders deal with that by signing each request: they compute an HMAC of the body with a secret you both know and send it in a header, and your endpoint recomputes it over the raw body and rejects anything that doesn't match. Retries mean the same event can arrive more than once, so a careful receiver records the delivery id and ignores repeats. Answering fast and doing slow work afterwards keeps the sender from timing out and retrying. --- ## Webhooks on Tissue Cloud Any Cell can receive webhooks: it already has a public HTTPS URL, and the signing secret goes in a vault binding. For more than that, Tissue Cloud has vesicle, a webhook inbox. A vesicle endpoint is a URL at `https://api.tissue.systems/hook/` that captures every delivery under your account, even before you've written any code, and forwards it to a Cell route once you bind one. It can check Stripe, GitHub or generic HMAC signatures before storing anything, without the secret ever reaching your code, and it retries failed deliveries to the Cell and lets you replay them. [Vesicle overview](https://docs.tissue.systems/docs/vesicle/overview/) covers endpoints, verification and retries. --- ## Related - [Build a GitHub webhook receiver](https://docs.tissue.systems/docs/tutorials/webhook-receiver/) - [What is a serverless function?](https://docs.tissue.systems/docs/glossary/serverless-function/) --- # API reference / REST API Source: https://docs.tissue.systems/docs/api/ OpenAPI spec: https://api.tissue.systems/openapi.json