Custom apps (hosted sites)
A custom app is a frontend your workspace’s admins build and deploy
themselves, often with an AI’s help. Tessule hosts it at its own address,
https://<address>.tessule.dev (the workspace’s address), and handles the
sign-in, the hosting and the API. Only signed-in members of the workspace can open it, and it acts as
whoever is using it, with that member’s own permissions.
A workspace has at most one custom app. Use it for a live, signed-in, API-backed frontend: a field app for one process, a portal over a few tables, a branded reporting surface. For a single static HTML page that never calls the API, publish a page instead (see AI assistants & MCP).
The first half of this guide is for members and admins; from
Building a custom app on it is for whoever writes
the app, person or AI. An AI client connected over MCP reads the same
contract with get_hosted_site_authoring_guide.
Opening a custom app
Section titled “Opening a custom app”Open the address your admin gave you. If you are not signed in to that app, you are sent to Tessule to sign in and asked to allow the app to act as you in the workspace. Then you are taken back to the page you asked for.
You may see one of these pages instead of the app:
- There is no site at this address. No custom app lives at this address. It may have been removed, or the link may be mistyped. Check the link with whoever shared it, or ask your workspace admin for the right address.
- This site is under construction. The app exists but nothing has been deployed to it yet. If you are waiting to use it, ask your workspace admin when it will be ready. If you are building it, see Deploying a build.
You stay signed in to the app while you use it. After two hours without using it, or a day after you signed in, you are signed out. Opening it again signs you straight back in, without asking again, as long as you are still signed in to Tessule and allowed the app within the last 30 days.
To sign out of the app, use the app’s own sign-out, or go to /_auth/logout on
the app’s address, which asks you to confirm. Tessule then shows a page saying
you are signed out. The next time you open the app, Tessule asks you to allow
it again. Signing out of Tessule signs you out of the app too.
Creating a site
Section titled “Creating a site”Workspace admins create the site in Workspace settings → Custom app with
Create custom app, or with POST /hosted-site (the hostedSites:manage
action). The tab then shows the site’s address. Members can sign in to that
address straight away and see the under-construction page until something is
deployed.
Delete custom app in the same tab, or DELETE /hosted-site, takes the site
offline at once. Its address then shows the no-site page.
Building a custom app
Section titled “Building a custom app”A custom app is a static single-page app: HTML, JavaScript, CSS and assets,
with an index.html at the top. Any build tool works. The app’s pages call
the workspace API on the app’s own origin under /_api/; the browser sends
the member’s sign-in with each call, so no token ever sits in page script and
the app has no login form, no token handling and no CORS to set up.
Starting from the starter kit
Section titled “Starting from the starter kit”The starter kit is a Vite + React app with the API client and the build
tooling wired in. Its packages are served from GitHub Packages under the
@henrycpainter scope, which needs a GitHub token to read even though the
packages are public: create a personal access token with the read:packages
scope and put these two lines in your ~/.npmrc:
@henrycpainter:registry=https://npm.pkg.github.com//npm.pkg.github.com/:_authToken=<your token>Then:
npm create @henrycpainter/tessule-app my-appcd my-appexport GITHUB_TOKEN=<your token> # read by the app's own .npmrcnpm installexport TESSULE_TOKEN=<an API token for the workspace>npm run pull # types and accessors for your workspace's own APInpm run dev # /_api proxied to the workspace, as younpm run deploy # build, upload, make liveThe app depends on @henrycpainter/client, the typed API client for a custom
app (/_api as its base URL, the member’s session, sign-in and sign-out, and
unwrap for a typed answer or a thrown error), and on @henrycpainter/cli:
tessule pull fetches GET /workspace/openapi, removes the /api prefix
from its paths and writes src/tessule-api.ts, the types of your workspace’s
own API, and src/tessule-ws.ts, one typed accessor per table
(ws.jobs.list(), ws.jobs.create(data), …); tessule deploy runs the
three steps of Deploying a build. The app’s .npmrc
points the scope at GitHub Packages and reads the token from GITHUB_TOKEN,
so it holds no secret and can be committed. The app pins both packages to the
version it was created with; move them together.
Building with an AI assistant, without a registry
Section titled “Building with an AI assistant, without a registry”An AI assistant connected to the workspace over MCP gets the client without
npm, GitHub Packages or any token. The tool get_workspace_sdk answers a
download URL for one archive, with its version, digest (the archive’s
SHA-256) and size. The archive holds the API client (client/, with no
dependencies of its own) and the two files tessule pull writes for your
workspace: openapi.d.ts, the types of your workspace’s API, and
tessule-ws.ts, one typed accessor per table. The URL works for ten minutes,
reaches that one archive and gives access to nothing the assistant cannot
already read; a new one is one call away.
curl -fsSL -o tessule-ws.tgz "<url>"echo "<digest> tessule-ws.tgz" | sha256sum -c -tar -xzf tessule-ws.tgz && mv package src/tessuleimport { createClient } from './tessule/client/index.js';import type { paths } from './tessule/openapi.js';import { createWorkspace } from './tessule/tessule-ws.js';
const ws = createWorkspace(createClient<paths>());const jobs = await ws.jobs.list();Everything in the archive sits under package/, so npm i ./tessule-ws.tgz
installs it too. Pass audience: "api" for the types of the API as a client
of the API host calls it; that archive has the client and the types and no
table accessors. Download a new archive when the schema changes: the
version changes with it. The registry route under
Starting from the starter kit works the
same way for a build that has a GitHub token.
Typing the API for your workspace
Section titled “Typing the API for your workspace”GET /workspace/openapi is the OpenAPI document of your workspace: every
table as typed endpoints, plus the workspace-wide resources (flows, dashboards,
views, imports and the rest). Ask for it with audience=site: that is the
document as your app calls the API — only the operations /_api forwards
(the ones under What an app may call are left out),
every path relative to /_api with the /api prefix removed, servers set
to /_api, and no bearer security, because the member’s session is the
credential. Run any OpenAPI code generator over it as it is; nothing needs
rewriting. tessule pull (the CLI’s --audience site, its default) fetches
it with an API token and writes the types and one accessor per table; an AI
assistant gets the same file through the MCP tool get_openapi_document,
which answers with a short-lived download URL, or the generated files with the
client through get_workspace_sdk
(above). Use the complete document
rather than scope=tables, which leaves the workspace-wide resources out.
Fetch it again whenever the schema changes; the document’s info.version
changes with it. The platform’s own specification, without any workspace’s
tables, is public at GET /openapi/v1/openapi.json.
Calling the API from a page
Section titled “Calling the API from a page”| Rule | What it means for the page |
|---|---|
| Path mapping | /_api/<path> on the app’s origin is <path> of the workspace API: /_api/tables is GET /tables, /_api/tables/<table id>/items is GET /tables/{tableId}/items, /_api/me is GET /me. The method, query string and body pass through unchanged. |
| Workspace | Implied by the app: the session is bound to the app’s workspace. Send no workspace header, id or ?ws= parameter. |
| Credentials | A same-origin fetch is all it takes. The session is an HttpOnly cookie the page cannot read; nothing is injected on window, and there is no token to store. An Authorization header on a /_api request is ignored, apart from the credential Tessule hands an extension shown inside its own pages. |
| Same-origin rule | Every /_api request, reads included, must carry Sec-Fetch-Site: same-origin or an Origin equal to the app’s own origin. A browser adds one of them to any fetch from the app’s pages; a request without either is refused with 403. Non-GET requests need nothing more: no CSRF token, no custom header. |
| Errors | The API’s own: { error, code?, details? } with the status and code each operation documents (PERMISSION_DENIED, STALE_RECORD, validation details per field). A 429 carries Retry-After when the limiter knows its window. |
| Row and field permissions | Apply as in the app: a record the member cannot see is absent from GET /tables/{tableId}/items, and a hidden field is masked. The app never sees more than its user. |
Scanning barcodes and QR codes
Section titled “Scanning barcodes and QR codes”A custom app scans with the same code as Tessule’s own Scan page:
@henrycpainter/client/scan from npm, or client/scan.js in the typed client
archive. It reads QR, Data Matrix, Aztec, PDF417, Code 128, Code 39, Code 93,
Codabar, ITF, EAN and UPC from the live camera, in every current browser.
import { startCameraScanner, findRecordsByCode } from '@henrycpainter/client/scan';
const scanner = await startCameraScanner(document.querySelector('video'), { onCode: async ({ rawValue }) => { const { matches } = await findRecordsByCode(rawValue); // matches: [{ table, field, record }] },});// scanner.stop() turns the camera offfindRecordsByCodelooks the code up exactly in everytextfield marked Scannable code (fieldConfig.scannable), across the tables the member can read, with their row and field permissions applied.- A label printed from a record in Tessule carries a link to the record:
parseRecordLink(code, 'https://app.tessule.com')reads it. - The scanner carries the camera’s controls for your own buttons:
scanner.torchSupported()andscanner.setTorch(true)for a dim room,scanner.cameras()andscanner.useCamera(deviceId)on a device with several cameras (the choice is remembered on that device), andscanner.focusAt(x, y)to focus on a point of the picture. Each does nothing on a camera that lacks the feature. - Offer a text box beside the camera: a handheld USB or Bluetooth scanner types the code there and presses Enter.
- The decoder’s
.wasmfile (about 1 MB) comes with the typed client archive (client/zxing_reader.wasm) and loads from besidescan.js. From npm it loads from the jsDelivr CDN unless you passwasmUrl: to serve it from the app itself, import@henrycpainter/client/scan/zxing_reader.wasmwith your bundler (in Vite,?url) and pass that URL. - The camera works on the app’s own pages. A page shown inside Tessule as an extension cannot open it; link to a page of the app instead.
code128Modules(value)gives the bars of a Code 128 barcode, for printing labels that 1D handheld scanners read.
Sessions and sign-in
Section titled “Sessions and sign-in”- Sign-in. A visitor without a session asking for any page is redirected
to
/_auth/login?return=<path>, which takes them through Tessule’s sign-in and consent screen and back toreturn, a path on the app’s own origin. A request with a method other than GET or HEAD gets401instead of the redirect. - Lifetime. A session opens with a two-hour expiry and slides: each
/_apicall pushes the expiry out to two hours from then. However active, a session ends 24 hours after it opened. Loading files alone does not renew it; calling the API does. - What a
401from/_apimeans. The session is over: expired, signed out, or ended because the member signed out of Tessule, changed their password, left the workspace, or the app was deleted. Every401is answered before any handler runs, so the request did nothing and is safe to send again, writes included, once the member has signed in again. A401never means “wrong permission”; that is403. - Signing in again. Send the browser to
/_auth/login?return=<current path>. A member who allowed the app within the last 30 days and is still signed in to Tessule comes straight back with no click. To keep the page instead of leaving it, open/_auth/login?return=/_auth/donein a popup from a click handler (browsers block popups opened from a fetch’s error handler). When the sign-in finishes,/_auth/doneposts{ type: "sign-in", outcome }on the BroadcastChanneltessule-site-session(outcomeissigned-in,cancelledorfailed) and closes itself; every tab of the app hears it. The popup cannot be observed throughwindow.opener, so listen on the channel, and poll/_api/meevery few seconds as a fallback. - Signing out. A
POSTto/_auth/logoutfrom the app’s own pages ends the session and forgets the member’s consent; a navigation is sent on to/_auth/signed-out, a script’sfetchgets204. AGETof/_auth/logoutis a confirmation page, so a plain link to it is a working sign-out for any app.
What an app may call
Section titled “What an app may call”/_api is an allow-list. An app’s pages reach the workspace API, which is
what GET /workspace/openapi describes: tables, fields, records, views,
queries, charts, dashboards, flows (reading and running them), approvals,
imports, exports, comments, attachments, the store, GET /me,
GET /me/permissions, and the rest. Account and organization operations are
not part of it. Within it, an app may never:
- create or manage API tokens;
- read or write workspace secrets;
- create, edit, switch on or publish a flow (a flow’s author decides where the secrets it uses are sent); reading flows, running the ones a member wrote and deciding flow approvals stay open;
- start a credentialed HTTP import pull;
- manage integration connections;
- manage integrations (the workspace’s machine principals) or their tokens;
- create, deploy or delete the custom app itself;
- administer membership;
- create a download link for the workspace’s OpenAPI document (a link works
without the member’s session, so it would outlive it); the app reads the
document itself, at
/_api/workspace/openapi; - change a credential or end sessions.
Two refusals tell an app what happened:
403with codeSITE_ROUTE_NOT_EXPOSED: the operation exists, but an app may not call it.404{ "error": "Not found" }: there is no operation at that path and method. Check the path against the OpenAPI document.
What a session can hold
Section titled “What a session can hold”A session is the member, narrowed twice. Its effective permission is the
member’s own role, intersected with the actions they allowed on the consent
screen, intersected with the ceiling below. The Administration category is
withheld from every app, whatever the member’s role: an admin using the app
cannot manage members, secrets, tokens or the app itself through it. Read what
a session holds with /_api/me/permissions; for an admin it differs from
the app’s answer by exactly the withheld list. Build for the actions a session
can hold, and expect 403 with PERMISSION_DENIED on anything a particular
member lacks.
Held (the ceiling, by category — data: records:read, records:create, records:update, records:delete, records:importProvenance, records:backfillHistory, store:read, store:manage, attachments:read, attachments:manage, comments:read, comments:create, comments:moderate, notifications:read; schema: tables:read, tables:manage, fields:manage, schema:apply, intakes:manage; analytics: query:execute, savedQueries:read, savedQueries:manage, charts:read, charts:manage, dashboards:read, dashboards:manage, derivedViews:read, derivedViews:manage, pages:read, pages:publish, pages:manage, customization:read; processes: flows:read, flows:create, flows:update, flows:delete, flows:execute, approvals:request, approvals:decide, approvals:manage).
Withheld from every app session: audit:read, workspace:members:read, workspace:members:manage, groups:read, groups:manage, tokens:manage, agents:manage, integrationAccounts:manage, secrets:manage, webhooks:manage, exports:manage, integrations:read, integrations:manage, mirrors:manage, hostedSites:manage, limits:manage, permissions:manage, customization:manage, builder:access.
How files are served
Section titled “How files are served”- Any path whose last segment has no file extension serves
index.html, so the app’s own router handles its routes. A path with an extension serves that file; a file that is not in the deployment gets a plain404. - Path segments may use letters, digits and
. _ ~ @ + -only, with no.or..segments. The path a browser asks for is exactly the uploaded path. - Files are served with the content type the deployment declared and the
Cache-Controlof their cache policy (see Cache policy):no-cacheispublic, max-age=0, must-revalidate, s-maxage=31536000(browsers revalidate every time),immutableispublic, max-age=31536000, immutable(browsers keep the file for a year). The edge caches each deployment for a year under its own key either way, so there is no cache-busting to do. - Every response of the app’s files and of
/_apicarries these headers, which the app cannot change (an extension shown inside Tessule is framed by Tessule’s own pages only, and its responses differ in exactly that):Content-Security-Policy: frame-ancestors 'none',X-Frame-Options: DENY,Cross-Origin-Opener-Policy: same-origin,X-Content-Type-Options: nosniff,Referrer-Policy: strict-origin-when-cross-origin,Strict-Transport-Securityfor a year including subdomains, andX-Robots-Tag: noindex, nofollow. The content security policy constrains framing only: inline script, inline style and third-party scripts are the app’s own choice. To run a stricter script policy, set it with a<meta http-equiv="Content-Security-Policy">tag inindex.html.
Addresses
Section titled “Addresses”Custom apps live under tessule.dev, a domain of their own, one origin per
app, so each app’s storage, service workers and cookies are separate from
every other app’s and from Tessule itself.
An app is named by its workspace’s address (Workspace settings → Appearance,
PUT /workspace/address), the same name the workspace opens at in Tessule’s
own app: a workspace at acme.app.tessule.com has its custom app at
acme.tessule.dev. Changing the address renames the app.
An app also answers on its id, https://<site id>.tessule.dev (unrelated to
the workspace id), and on every address its workspace had before. Each of
those redirects to the current address, keeping the path, so links and
bookmarks keep working after a rename, and the app always runs on one origin.
A workspace with no address serves its app on the id. The Custom app tab
and GET /hosted-site’s url always give the current address.
Members sign in to each origin separately. After a rename, members sign in once more on the new address. A sign-in that was in progress during the rename has to be started again.
The -prv suffix of an address label is reserved for preview addresses
(<site>-prv-<deployment>): a label ending in -prv or containing -prv-
never names an app.
An app cannot call https://api.tessule.com/api with the member’s session:
the session cookie is for the app’s origin only, and /_api is the one way
in.
Showing a page inside Tessule
Section titled “Showing a page inside Tessule”A page of the app can also appear inside Tessule itself, as a panel on a
record page, with the record it is looking at: an extension. It is a
directory of the build, ext/<id>/, declared in one file,
tessule.site.json, at the root of the built directory, and it is deployed
and rolled back with the app. It acts as the member viewing it, within the
actions it declares and the member allows. See
App extensions.
Your own domain
Section titled “Your own domain”An app can also answer on a hostname you own, such as app.example.com.
Under Your own domain on the Custom app tab, enter the hostname and
choose Add. The tab then shows the one DNS record to create at your DNS
provider: a CNAME whose name is the hostname and whose value is the Tessule
name shown beside it. Once the record resolves, Tessule obtains a certificate
for the hostname, serves the app there and redirects the app’s other
addresses to it; the hostname’s status moves from Waiting for your CNAME
to Active, usually within minutes of the record resolving and at most a
few hours. Tessule renews the certificate for as long as the record points
at it.
Use a subdomain. A bare domain such as example.com cannot point at Tessule
with a CNAME and is refused, as is any name on a Tessule domain. How many
hostnames an app may have depends on your plan.
Members sign in to the new address once, as after a rename. A hostname whose record is removed, or whose certificate cannot be renewed, shows Failed with the reason after three daily checks; create the record again, then remove the hostname and add it back.
Removing a hostname stops the app answering on it within seconds. A hostname that has served your app stays reserved to your workspace, so you can add it again later and no other workspace can take it over while an old record still points at Tessule. A hostname that never went live is held for seven days from when it was added, after which another workspace may claim it.
The same operations are GET /hosted-site/domains, POST /hosted-site/domains and DELETE /hosted-site/domains/{domainId}.
Deploying a build
Section titled “Deploying a build”A deployment is immutable: it is declared, uploaded, then made live. There
are two ways to send one: a manifest with one upload per file, which is what
tessule deploy does, or one archive of the built directory.
With a manifest
Section titled “With a manifest”- Declare the files.
POST /hosted-site/deploymentstakes the manifest: every file’s path, content type, exact size and, to reuse what the app already holds, its SHA-256./index.htmlis required, and the workspace’s limits on files per deployment and total size apply (hostedSites.maxFilesPerDeployment,hostedSites.maxDeploymentBytes). The answer carries one presigned upload URL for each file the app does not already hold: a file declared with a hash the app holds from an earlier deployment is reused, andreusedFileCountsays how many were. A build whose hashed assets did not change therefore uploads only what changed. - Upload. Send each listed file with a
PUTto its URL, with exactly the headers the answer names and nothing else. No API token reaches storage, each file can be written once, and a hashed file’s URL carries the hash, which storage checks against the bytes. - Make it live.
POST /hosted-site/deployments/{deploymentId}/activatelinks the held files, checks that every file is present at its declared size (a409names any that are missing), then switches the app within seconds. Members never see a half-uploaded app.
With one archive
Section titled “With one archive”POST /hosted-site/deployments/archive takes a zip or tar.gz of the built
directory, base64-encoded in the request body (2.5 MB decoded at most;
larger builds use the manifest), and does the three steps in one: it unpacks
and validates the archive, stores the files the app does not hold, and makes
the deployment live, or leaves it ready with activate: false. One directory
wrapping every entry (dist/) is stripped; directory entries, __MACOSX/ and
.DS_Store are ignored; a symbolic or hard link, an absolute or .. path, an
encrypted entry or a file over 16 MB is refused, and the answer says which
entry. Content types come from file extensions. Over MCP, deploy_site is
this call (see AI assistants & MCP).
Keeping the source with a deployment
Section titled “Keeping the source with a deployment”An app with no repository of its own, such as one an AI assistant built and
deployed in a conversation, has no copy anywhere but its built files. Send
the project it was built from with the archive: source in the body of
POST /hosted-site/deployments/archive (over MCP, deploy_site’s source)
is an archive of the project before its build step, such as src/,
package.json and its configuration, without node_modules or the build.
It is kept with the deployment and never served. The build and its source
share the 2.5 MB an archive deploy can carry, and the source is checked as
a build is: a link, an absolute path or a .. segment is refused.
Downloading a deployment
Section titled “Downloading a deployment”GET /hosted-site/deployments/{deploymentId}/files reads a ready or
active deployment back: every file with a download URL that works for 15
minutes, the whole build as one zip when the build and its source fit in
2.5 MB, and the source it was deployed with. The zip deploys again as it is.
To change an app, download it, unpack the source (or the build, when it was
deployed without one), edit, rebuild and deploy with the source. Over MCP,
download_site reads the live deployment unless you name another. The
Custom app settings page has a download button on each deployment.
A workspace backup includes the live deployment and its source, and a restore gives the restored workspace a custom app of its own serving it.
Cache policy
Section titled “Cache policy”Each file is served with one of two cache policies. no-cache makes browsers
revalidate on every use, right for a file whose path keeps its name across
deployments, index.html above all. immutable lets browsers keep the file
for a year without asking, right for a file whose name carries a content hash
and so changes whenever its bytes do. The deployment’s cache rules set the
policy by glob over the served path (* matches within one segment, **
across segments, ? one character; the first matching rule wins, at most 50
rules). A file no rule matches gets the defaults: /assets/** and an asset
(a script, style, source map, font, image, media or wasm file) whose stem ends
in a content hash (index-BxYz12ab.js, main.3f9a1c2b.css) are immutable;
everything else, HTML and JSON documents whatever their name, extensionless
paths and favicon.ico among them, is no-cache. Mark a file immutable only if its name changes
whenever its content does.
{ "cache": [{ "pattern": "/data/**", "policy": "no-cache" }] }GET /hosted-site/deployments lists every deployment with its status and who
uploaded it, and the same list is in Workspace settings → Custom app. To
roll back, activate an earlier deployment there with Roll back to this, or
with the same activate call. The newest ten ready deployments are kept, and a
held file is kept while any of them declares it.
From CI. Create a role holding only hostedSites:manage, create an API
token with starting access Role-only, and attach the role to it (see
API access & tokens). That token can read the
site and list, upload and activate deployments, and nothing else. Fetching
GET /workspace/openapi needs tables:read as well, so fetch the document
with your own token or add that action to the role.
Building a branded deck
Section titled “Building a branded deck”Tessule does not write PowerPoint files itself: a firm’s slide layout is the firm’s own, and a custom app is where it lives. Everything the deck needs is already an operation the app calls as the signed-in member, so the deck holds exactly what that member may see:
| Input | Operation |
|---|---|
| Branding: display name, colours, logo key, chart palette, font | GET /workspace/settings |
| The charts and how each is drawn | GET /charts, then GET /charts/{chartId} for the config |
| A chart’s rows | POST /tables/{tableId}/aggregate for a chart drawn from a table’s records (the response is row-scoped for the caller); POST /query for one backed by a saved query or custom SQL |
| A data appendix | POST /query/exports with format: xlsx |
A deck is then a loop: fetch the branding once, fetch each chart’s rows, draw
the chart with the app’s own chart component (any library), and hand each
picture and the palette to a client-side deck library. The sketch below uses
pptxgenjs, which runs in the browser and takes PNG data URLs and native
chart data alike; it is the app’s dependency, not Tessule’s, and api is any
typed client over the workspace document with /_api as its base URL.
import PptxGenJS from 'pptxgenjs';
const { branding } = await api.GET('/workspace/settings');const { data: charts } = await api.GET('/charts');
const deck = new PptxGenJS();deck.defineLayout({ name: 'WIDE', width: 13.33, height: 7.5 });deck.layout = 'WIDE';
for (const chart of charts.slice(0, 5)) { const rows = await rowsFor(chart); // one of the two operations above const png = await drawChartAsPngDataUrl(chart, rows, branding?.chartPalette); const slide = deck.addSlide(); slide.addText(chart.name, { x: 0.5, y: 0.3, fontFace: branding?.fontFamily ?? 'Calibri', color: (branding?.primaryColor ?? '#1f2937').slice(1) }); slide.addImage({ data: png, x: 0.5, y: 1, w: 12.3, h: 6 });}await deck.writeFile({ fileName: 'market-update.pptx' });The same loop can take the PNG the Charts page downloads: the picture a member saves from a card is drawn the same way, so a deck assembled by hand and one built by the app agree.