# Web Tiles > Web Tiles are small web apps and documents that carry everything they need and are cut off from the network, so they can run safely inside a social media post, a private chat, an agent's answer, or another app. This file is a complete guide to making, testing, publishing, and embedding them. Tiles are part of [DASL](https://dasl.ing/), a small set of standard primitives for content-addressed, linked data. This guide is the Web Tiles part of DASL's own guide for LLMs and agents, : read that one for the specs tiles are built on (CIDs, DRISL, CAR, MASL), for when to use which, and for the rest of DASL. A tile is a small web app or document (HTML, CSS, JavaScript, images, anything a browser runs) that carries everything it needs and is cut off from the network. Because it cannot phone home, it is safe to run where a normal web page is not: inside a social media post, a private chat, an agent's answer, or another app. Whatever embeds the tile (the *host*) mediates everything the tile exchanges with the outside. Use a tile when you want to hand someone interactive content they can run without trusting you: a game, a poll, a chart, a calculator, an explainer, an article that keeps its look, a little tool an agent builds on the fly. Don't use one for something that must call a server by itself: a tile can't. A tile is three things: 1. **Resources**: files, each addressed by its CID. 2. **A manifest**: a MASL document in bundle mode, with a `name` and a `resources` map from absolute paths to `{ src: , content-type, …other HTTP headers }`. The `/` entry is what gets rendered. 3. **A container**: an AT Protocol record (collection `ing.dasl.masl`, resources as blobs on the author's PDS), or a CAR file with the manifest as its header (a `.tile` file). The fastest path from nothing to a published tile: write a directory with an `index.html` and a `manifest.json`, preview it at , publish it with `atile publish -s `. ## What a tile can and cannot do The host enforces this on every response, whatever the tile declares. The exact headers are in the [spec](https://dasl.ing/tiles.md); what they mean for you: Works: - Any HTML, CSS, and JavaScript, including inline ` ``` `style.css`: ```css :root { color-scheme: light dark; font-family: system-ui, sans-serif; } body { margin: 0; padding: 1rem; } button { font: inherit; padding: .4rem .8rem; } ``` `tile.js`: ```js let pokes = 0; let sendData; // set when the host speaks tp-data document.getElementById('poke').addEventListener('click', () => { document.getElementById('count').textContent = String(++pokes); sendData?.({ pokes }); }); try { const data = await import('/.well-known/web-tiles/data.js'); sendData = data.sendData; data.addDataHandler((payload) => { if (typeof payload?.greeting === 'string') { document.getElementById('status').textContent = payload.greeting; } }); data.listen(); // always call this once the handlers are in place } catch { // No data protocol here. The tile still works on its own. } ``` Always declare the charset in the HTML, and always put a real ``. ## Talking to the host: tiles protocols A tile gets capabilities by importing them from `/.well-known/web-tiles/<protocol>.js`. The host provides the implementation; if it doesn't support the protocol, the import fails. The pattern never changes: ```js try { const api = await import('/.well-known/web-tiles/some-protocol.js'); // use it } catch { // not available here: degrade, or tell the user } ``` Never bundle a copy of a protocol's implementation in the tile: different hosts implement the same protocol differently, and the path is reserved anyway. **Data passing** ([tp-data](https://dasl.ing/tp-data.md)) is implemented today, in `/.well-known/web-tiles/data.js`: - `addDataHandler(fn)`: `fn(payload)` is called with whatever the host sends. - `removeDataHandler(fn)`. - `listen()`: tells the host the tile is ready to receive. Call it once your handlers are set; hosts wait for it before sending. - `sendData(payload)`: sends data to the host. Payloads cross the boundary as structured clones: plain objects, arrays, strings, numbers, booleans, `null`, `Date`, typed arrays, `Map`, `Set`. No functions, no DOM nodes. How to use it well: - Define a small message vocabulary and document it. A good tile says what it accepts when it connects, for example `sendData({ ready: true, accepts: ['greeting', 'theme'] })` right after `listen()`. - Validate what you receive. The host is not necessarily your code. - Answer requests with a result (`{ ok: true, … }` or `{ ok: false, error }`) so a host, or an agent driving the tile, can tell what happened. - What the host does with what you send is up to the host: a chat may broadcast it to the other participants' copies of the tile (that is how a poll stays in sync), an agent may read it as the tile's result, a preview tool just logs it. **Links** ([tp-link](https://dasl.ing/tp-link.md)), in `/.well-known/web-tiles/link.js`, is how a tile sends its user to the web: - The simplest way needs no code: an ordinary link, `<a href="https://example.com/">`. When the user follows it, the host is asked to open it. `target` makes no difference. - `openLink(url)`: asks from script; resolves with `{ opened }`. The URL has to be absolute (`https://…`): a relative one is rejected, since a place inside the tile is the tile's own to go to. Call it from the user's click: hosts refuse links nobody clicked for. - The host decides. It may show the user the address first, open it in a new tab or a browser of its own, or do nothing at all. Never make a link the only way to something the tile needs. - Hosts show the whole address, so put nothing in a link's URL that the user would not expect to send. Other names are registered but not usable yet: `store.js` (self-editing tiles, [tp-editable](https://dasl.ing/tp-editable.md)) is reserved and its spec is a placeholder, as are the specs for modes and roles and for sync. Don't build on them. On the wire, in web hosts, these are `postMessage` events with an `action` (`tiles-protocol-up-data-ready`, `tiles-protocol-up-data-payload`, `tiles-protocol-down-data-payload`) and a `payload`. A tile should use the module, not the messages. So should a host: `tileData()` and the loader's `protocol` event only pass on what came from the tile's own frame, which a `message` listener of your own on `window` would have to check for itself. ## Building with frameworks and bundlers Any toolchain that produces static files works. Build, then point the tile tools at the output directory. - Put `manifest.json` where the build copies it into the output unchanged (the `public/` or `static/` directory in most setups). - Make sure the output's entry point is `index.html` at the top. - Remove every remote URL from the output: CDN scripts, hosted fonts (download the font files and use `@font-face` with a local path), remote images, analytics, error reporting. Search the build for `https://` before publishing. - Prefer a single page with hash routing. If the framework's router uses the History API, switch it to hash mode. - Turn off anything that registers a service worker (PWA plugins). - Keep it small. Every file is uploaded as a blob and every path is listed in one record, and PDSs limit both blob and record sizes. A handful of bundled files beats hundreds of chunks. - Big data (video, datasets) can be resources too, and hosts load resources on demand, which is the point of a manifest rather than a zip. Mind the PDS's blob size limit. ## Previewing and testing **Blastile** is the workbench. On the web at <https://make.webtil.es/>, with nothing to install; as a desktop app from <https://make.webtil.es/download/> (macOS, Windows, Linux). - **Watch tile dir…**: point it at the source directory. The tile renders live and reloads when a file changes. (Folder watching needs Chromium on the web; Firefox and Safari open a snapshot.) - **Data console**, under every preview: the host side of tp-data. It logs what the tile sends, shows the ready signal, and lets you compose and send JSON payloads. Use it to test your message vocabulary. - It opens `.tile` files and `at://` URIs too, and publishes over AT OAuth (below). Tiles run there exactly as they will elsewhere: on a fresh random origin with the real policy. If it works in Blastile, the sandbox is not what will break it elsewhere. When a tile misbehaves, open the browser's developer tools on the tile's frame: a resource that failed to load is either a remote URL (refused by the policy, reported as a CSP violation) or a path missing from the tile (a 404). Other ways to look at a tile: - <https://webtil.es/browser/#url=at://…> renders any published tile, first as a card, then live on click. - <https://webtil.es/host/?tile=at://…> (or `?tile=https://…/some.tile`) runs one tile filling the page. - <https://appmosphe.re/@handle/rkey> is the tile's page on the index. Example tiles to read: the `examples/` directory of [Blastile](https://tangled.org/robin.berjon.com/dasl-tiles/tree/main/blastile) has `hello-tile` (minimal, echoes tp-data), `theme-tile` (themed live over tp-data, answers with `{ ok, applied, ignored, theme }`), and `svelte-tile` (compiles and mounts a component it is sent). On AT, Minesweeper is `at://did:plc:izttpdp3l6vss5crelt5kcux/ing.dasl.masl/3mcjwwoqjqs2v`. ## Bundling into a .tile file A `.tile` is a CAR whose header is the manifest and whose blocks are the resources. It needs no account and no network, and any tile reader can open it. ```sh npx @dasl/atile bundle ./my-tile ./my-tile.tile ``` From code (Node): ```js import TileWriter from '@dasl/tile-writer'; const tw = new TileWriter({ name: 'My Cat', description: 'A picture of my cat.' }); tw.addResource('/', { 'content-type': 'text/html' }, { path: './index.html' }); tw.addResource('/img/cat.jpg', { 'content-type': 'image/jpeg' }, { path: './cat.jpg' }); await tw.write('./my-cat.tile'); ``` `@dasl/tile-car-reader` reads them back (`open()`, `meta`, `resolvePath('/')` giving headers and a stream). ## Publishing to the AT Protocol Publishing means: upload every resource to the author's PDS as a blob, then write one `ing.dasl.masl` record holding the manifest. Anyone with an AT account (a Bluesky account, for instance) can publish. Publishing is public and visible to the whole network at once, so when you are an agent, do it only when the user asked for it. **With `atile`** (the CLI): ```sh npm install -g @dasl/atile # or @dasl/tiles, which includes it atile login you.example.com # asks for an app password, kept in the OS keychain atile publish -s ./my-tile ``` - Create the app password in the account's settings (for Bluesky: <https://bsky.app/settings/app-passwords>). Never use, or ask for, the account's main password. - `atile login` asks for the app password at a prompt. It is never a command-line argument. Without a terminal, give it on standard input (`atile login you.example.com < file`) or in the `ATILE_APP_PASSWORD` environment variable. - `-s` (`--stable-id`) remembers the tile's `at://` URI for that directory in `~/.atile/identifiers.json`, so publishing again updates the same record. Without it every publish makes a new tile. **Use `-s` unless you mean to make a new one.** - `-t <rkey>` (`--tid`) publishes under a record key you choose (it overrides `-s`); `-u <handle>` publishes as another logged-in handle. - `atile delete <at:// URI or directory>` removes a tile; `atile list-users`, `atile default-user <handle>`, `atile logout <handle>` manage logins. - The command prints the tile's `at://` URI. Keep it: it is the tile's address. **With Blastile** (<https://make.webtil.es/> or the desktop app): log in with AT OAuth (no app password), watch the directory, press publish. The desktop app shares `~/.atile/identifiers.json` with `atile`, so a directory keeps the same record whichever tool publishes it. **With appmosphe.re** (<https://appmosphe.re/publish>): sign in, drop a `.tile` or a directory, check and edit the manifest, pick the record key (a fresh one, your own, or an existing tile to update, with `prev` set for you), preview, publish, all from the browser. **From your own code**, it is a short sequence of calls to the author's PDS: 1. For each resource, compute its CID: CIDv1, raw codec, SHA-256 (`create(CODEC_RAW, bytes)` in `@atcute/cid`). Identical bytes share a CID. 2. `com.atproto.repo.uploadBlob` each one with `Content-Type: application/octet-stream`. Check that the blob reference the PDS returns has your CID and your size, then use that reference, `mimeType` included, as the resource's `src`. (`verifyUploadedBlob` in `@dasl/tile-lexicon` does this.) 3. Build the manifest: your fields, plus `resources` mapping each path to `{ src: <blob ref>, "content-type": "…" }`. 4. Compute `cid`, the DRISL CID of the manifest object (`encode` in `@atcute/cbor`, then `create(CODEC_DCBOR, bytes)`). 5. `com.atproto.repo.putRecord` with `collection: "ing.dasl.masl"`, a record key (normally a fresh TID), and the record `{ $type: "ing.dasl.masl", cid, tile: <manifest>, createdAt: <ISO datetime> }`. With OAuth, ask for the scope `atproto repo:ing.dasl.masl blob:*/*`. The record, as it ends up in the repo: ```json { "$type": "ing.dasl.masl", "cid": "bafyrei…", "createdAt": "2026-10-02T15:26:26.697Z", "tile": { "name": "Hello Tile", "description": "Says hello, counts pokes, and talks to its host when it can.", "sizing": { "width": 480, "height": 280 }, "resources": { "/": { "src": { "$type": "blob", "ref": { "$link": "bafkrei…" }, "mimeType": "application/octet-stream", "size": 612 }, "content-type": "text/html" }, "/tile.js": { "src": { "$type": "blob", "ref": { "$link": "bafkrei…" }, "mimeType": "application/octet-stream", "size": 734 }, "content-type": "text/javascript" } } } } ``` Details that bite: - On AT, `src` is a **blob reference**, not a bare CID link: a PDS only keeps blobs that a record references as blobs. In a `.tile` file, `src` is a plain `{ "$link": "…" }`. - `size` must be the exact byte length. `mimeType` in the blob reference is not the resource's type and need not match it; the type the tile is served with is the separate `content-type`. - Some PDSs sniff uploads and store them under the type they detect, then refuse a record that names another type. Uploading as `application/octet-stream` and publishing the reference the PDS answers with is right everywhere. - `cid` is the CID of the `tile` object alone, encoded as DRISL. It is what a later version's `prev` points at. **Updating a tile** means writing the same record key again (`atile publish -s`, or the same `rkey` in `putRecord`). The `at://` URI stays the same and every embed picks up the new version. To keep a chain of versions, set `prev` to the previous manifest's CID; `atile` does not do that for you. ## After publishing: finding and sharing A tile's address is its `at://` URI: `at://<did or handle>/ing.dasl.masl/<rkey>`. - **[appmosphe.re](https://appmosphe.re/)** indexes every tile on the network, with search, authors, and categories. A tile's page is `https://appmosphe.re/@<handle>/<rkey>` (the DID works in place of the handle). New tiles normally show up by themselves; to get one indexed within seconds, `POST https://appmosphe.re/api/index` with `{"actor": "<did or handle>"}`, or use <https://appmosphe.re/index>. - Its JSON API is open to any origin, no key: `GET /api/tiles?page=N`, `GET /api/tiles?category=…`, `GET /api/search?q=…`, `GET /api/tiles/:actor/:rkey` (the full record), `GET /api/authors`, `GET /api/authors/:actor`, `GET /api/stats`. - To give someone a link that runs the tile: `https://webtil.es/browser/#url=<at:// URI>` or its appmosphe.re page. - Without an index: `com.atproto.sync.listReposByCollection?collection=ing.dasl.masl` on a relay lists the repos that have tiles, and `com.atproto.repo.listRecords` on each PDS lists them. ## Embedding tiles in your own app A tile must run on an origin of its own, under the spec's policy. Two ways to get that. **The quick way: the host page.** Frame `https://webtil.es/host/?tile=<url>`, which runs one tile filling the frame: ```html <iframe src="https://webtil.es/host/?tile=at://did:plc:…/ing.dasl.masl/3m…" sandbox="allow-scripts allow-same-origin allow-forms" title="Dice Roller"></iframe> ``` It talks to its embedder in JSON strings, each an object with `tilesHost: 1`. Up, to `window.parent` (or `window.ReactNativeWebView` in a React Native WebView): `manifest` (`url`, `name`, `description`, `sizing`; always first), `load`, `title`, `error` (`message`), `size` (`width`, `height`, either possibly absent: the tile asks for a size, and you resize the frame within your limits), `link` (`url`, `activated`, `id`: the tile asks for a link to be opened, which you do yourself, somewhere of your own, or don't), and `protocol` (`protocol`, `kind`, `payload`) for what the tile sends. In a page they are `message` events on your window: act only on those whose `ev.source` is `iframe.contentWindow`, since any other window, the tile's included, can post one that reads the same. Down, with `iframe.contentWindow.postMessage(json, origin)`: `{ tilesHost: 1, action: "send-protocol", protocol, kind, payload }` (for tp-data, `protocol: "data"`, `kind: "payload"`), and `{ tilesHost: 1, action: "limits", minWidth, minHeight, maxWidth, maxHeight }` to tell the tile your limits on its size (send them whole, once the page is up and whenever they change). Use `sizing` from the `manifest` event to size the frame. `@dasl/tile-host/messages` has the types and parsers. In a native app's WebView on iOS, the host page's domain must be in `WKAppBoundDomains` (service workers need it); the [tile-host README](https://tangled.org/robin.berjon.com/dasl-tiles/tree/main/tile-host) has the full WebView recipe. **The full way: the loader**, when you want cards, several tiles, or your own loading server: ```js import { TileMothership } from '@dasl/tile-loader'; import { ATTileLoader } from '@dasl/tile-loader/at'; import { tileData } from '@dasl/tile-loader/data'; import { tileLinks, linkPrompt } from '@dasl/tile-loader/link'; const ship = new TileMothership({ loadDomain: 'load.webtil.es' }); // or your own ship.init(); // once per page ship.addLoader(new ATTileLoader()); // at:// URIs; also /car, /webxdc, /memory const tile = await ship.loadTile('at://did:plc:…/ing.dasl.masl/3m…'); if (!tile) throw new Error('No loader recognised that URL'); // A card: name, icon, banner, description. Cheap, metadata only; runs the tile on click. document.body.append(await tile.renderCard()); // Or run it straight away, in a frame of the height you choose. const frame = tile.renderContent(tile.manifest.sizing?.height ?? 400); document.body.append(frame); // tp-data, host side const data = tileData(tile); data.onReady(() => data.send({ greeting: 'Hello from the host' })); data.onData((payload) => console.log('the tile says', payload)); // tp-link, host side: a link out of the tile is shown to the user, who opens it or not, // in a dialog on top of the page that keeps clear of the tile's frame. tileLinks(tile, { frame, open: linkPrompt(document.body) }); ``` - Render cards in feeds and lists, and run a tile only when the user asks: a card costs nothing, a running tile is a frame with a service worker. - Wait for `onReady` before sending data. What `onData` gives you is untrusted input: check its shape before you use it, and never put it in your page as markup. - A tile opens nothing itself: a link out of it reaches `tileLinks`, and without a handler nothing opens. The address is the tile's to choose and can carry data, so show it to the user before opening it; `linkPrompt` does, in a modal dialog of your page's own that names the destination's host, with a link of your own for them to follow that waits until they have moved to it. Name the tile's frame to `tileLinks` (`frame`) and the dialog keeps clear of it. A dialog of your own in its place needs the same care: the loader's README says what. - Isolation comes from the random origin and the policy, not from a `sandbox` attribute on the frame the loader makes. That attribute is yours to set, to take more away from a tile. It has to keep `allow-scripts` and `allow-same-origin`, without which the tile's service worker cannot run and nothing loads, and `allow-forms` unless a tile's forms are to do nothing. Leave out `allow-modals` and `allow-downloads` where tiles sit among other content, a feed above all: a tile then raises no dialog and starts no download. - `MemoryTileLoader` (`@dasl/tile-loader/memory`) runs a manifest whose `src` entries are bytes or strings you hold, at `memory://<id>`. That is how to preview a tile you just generated, before publishing anything. - `load.webtil.es` is a public loading server. It serves only the fixed runtime and never sees tile content. To run your own: `createTileLoadingRouter('tiles.example')` from `@dasl/tile-server` in an Express app (or `npx @dasl/tile-server tiles.example 8080`), with wildcard DNS and a wildcard TLS certificate for `*.tiles.example`, since every tile load is a new hostname. Make that a domain that carries nothing else, not your site's or a subdomain of it: cookies and saved passwords go with the registered domain, so a tile on a subdomain of your site's domain reads the cookies the site shares with its subdomains and sets cookies the site then receives, and the browser offers the site's saved passwords in a sign-in form the tile draws. - Check any deployment with the containment tile at <https://webtil.es/check/>: it tries every way out of the sandbox it knows and reports what held. If you are a host, the rules that matter: treat everything a tile sends as untrusted data (names, titles, payloads); tell which tile a message comes from by the window that sent it, never by what the message says; and never give a tile a way to reach the network that the user did not ask for. ## For agents making tiles - Generate the whole tile as a directory, with every asset local. Inline small things; no CDN links, no web fonts by URL, no remote images. - Write a real `name` and `description`, add an icon, and set `sizing` to the size the content needs. - Put the result where the user can see it before it goes anywhere: Blastile's watch mode on the directory, or `atile bundle` and hand over the `.tile`. - If the tile is meant to be driven (by a chat, by you), give it a tp-data vocabulary: say what it accepts on connect, validate input, answer with results. - Don't publish unless asked. When asked, use `atile publish -s`, report the `at://` URI and the appmosphe.re link, and say that the tile is public. - Credentials: an app password given by the user for `atile login`, or OAuth in Blastile. Never the main password, and never write either into the tile or the repository. ## Checklist before publishing - `manifest.json` has a `name`, a `description`, an icon; every `icons` and `screenshots` path exists in the directory. - `index.html` is at the top of the directory, declares its charset, and has a `<title>`. - No `http://` or `https://` URL is loaded anywhere in the output (links for the user to click are fine). - No reliance on `localStorage`, IndexedDB, or cookies surviving a reload. - No routing on paths that are not files; no directory URLs. - The directory holds only what should be public. - The layout works at the requested `sizing` and at other sizes. - Every protocol import is in a `try`, with a fallback. - It runs in Blastile. ## Troubleshooting - **Blank tile**: `index.html` is missing from the top of the directory, or the page depends on a remote script that was refused. Check the console for CSP violations. - **A file 404s**: the path is not in the tile. Paths are exact and case-sensitive, and `/dir/` is not `/dir/index.html`. - **Fonts or images missing**: they were remote. Bundle them. - **"Tile icon … is not in resources"**: the `src` in `icons` or `screenshots` does not match a file path, or lacks the leading `/`. - **"Cannot publish tile without name"**: add `name` to `manifest.json`. - **A file is served with the wrong type**: set `content-type` for that path under `resources` in `manifest.json`. - **The PDS refuses the record**: a blob reference doesn't match what the PDS stored (use the reference it returned), a `size` is wrong, or a blob or the record is over the PDS's limit. - **Every publish creates a new tile**: use `-s`, or pass the record key with `-t`. - **State disappears on reload**: by design; the origin is new each time. - **A link does nothing**: links out of a tile are requests, and this host ignores or refuses them. Show the address as text too. - **The host never sends data**: the tile didn't call `listen()`, or the host doesn't support tp-data and the import failed. - **The tile doesn't show on appmosphe.re**: ask for the repo to be indexed (`POST /api/index`). ## Tools and references - Specs: [Web Tiles](https://dasl.ing/tiles.md), [Tiles Protocols](https://dasl.ing/tiles-protocols.md), [Data Passing](https://dasl.ing/tp-data.md), [Links](https://dasl.ing/tp-link.md), [MASL](https://dasl.ing/masl.md), [CAR](https://dasl.ing/car.md). The lexicon is `ing.dasl.masl`, in the Web Tiles spec and at <https://dasl.ing/tiles-lexicon.json>. - [webtil.es](https://webtil.es/): the tiles site. [Browser and tutorial](https://webtil.es/browser/), [host page](https://webtil.es/host/), [containment check](https://webtil.es/check/), the public loading server `load.webtil.es`. - [Blastile](https://make.webtil.es/): open, watch, test, and publish tiles, on the web or [on the desktop](https://make.webtil.es/download/). - [appmosphe.re](https://appmosphe.re/): the index of tiles on AT, with [a publish page](https://appmosphe.re/publish), [a developer guide](https://appmosphe.re/developers), and a JSON API. - [dasl-tiles](https://tangled.org/robin.berjon.com/dasl-tiles): the source of all the packages, on npm under `@dasl/`: - `@dasl/atile`: the CLI (`atile`) to bundle, publish, and delete tiles. - `@dasl/tile-loader`: runs tiles in a web page (mothership, shuttle, worker), with loaders for AT, CAR, WebXDC, and in-memory tiles. - `@dasl/tile-server`: the loading server that gives each tile its own origin (`tiles-loading-server`). - `@dasl/tile-host`: the hosted page that runs one tile for iframes and WebViews, and its message schema. - `@dasl/tile-writer`, `@dasl/tile-car-reader`: write and read `.tile` files in Node. - `@dasl/tile-lexicon`: the lexicon, shared TypeScript types, the security policy, and the blob helpers. - `@dasl/containment-tile`: the red-team tile, published at `at://robin.berjon.com/ing.dasl.masl/bad`. - `@dasl/tiles`: a meta-package with all of the above under the older import paths. - [tilers](https://tangled.org/robin.berjon.com/tilers): turns feed entries (RSS, Atom, JSON) into self-contained tiles.