# Backlit

> Backlit is managed hosting for AI-generated static HTML apps, called "glows," served from `*.backlit.run` subdomains with built-in authentication and per-app data persistence. App code uses the `window.backlit` runtime SDK (auth, glow-shared data, per-user data, owner-write records, write-only capture, and realtime subscriptions); agents create and deploy glows over a REST API or the hosted MCP server.

This index points to the docs an agent needs. For app code, start with the SDK reference and the TypeScript type surface; to deploy, use the MCP server or the deploy API.

## SDK (the `window.backlit` runtime surface app code calls)

- [SDK reference](https://sdk.backlit.run/sdk.md): Full Markdown reference for `window.backlit.*` — methods, return types, error codes, validation rules, and examples.
- [SDK type surface](https://sdk.backlit.run/sdk.d.ts): Ambient TypeScript declaration (`.d.ts`) of the whole surface — the canonical machine contract; agents read it natively without parsing prose.
- [Full docs in one file](https://sdk.backlit.run/llms-full.txt): The complete SDK reference plus the type surface concatenated into a single plain-text fetch.

## Guides (task-focused, cross-layer recipes)

Recipes that narrate one goal across the SDK, the deploy bundle, and auth modes, linking every fact to the reference rather than restating it. (Also appended to `llms-full.txt`.)

- [Push notifications end-to-end](https://sdk.backlit.run/guides/push-end-to-end.md): Ship a `notify.json` so a matching data write fires a doorbell, then enroll users and react to taps with `window.backlit.push.*`.
- [Permissions and write-gating](https://sdk.backlit.run/guides/permissions-and-write-gating.md): How a glow's auth mode and a signed-in user's permission combine to decide who can write which store, and how to design the UI around it.
- [Migrate a static app to Backlit](https://sdk.backlit.run/guides/migrate-a-static-app.md): Port a `localStorage`/`indexedDB` app to a glow — pick the store by ownership, satisfy the deploy bundle contract, deploy a draft, and promote.
- [Build a new app on Backlit](https://sdk.backlit.run/guides/build-a-new-app.md): Go from a blank page to a live glow — sketch the data model, pick stores by ownership, write the app against `window.backlit`, wrap it in the deploy bundle, deploy a draft, and promote.
- [Realtime sync and live collaboration](https://sdk.backlit.run/guides/realtime-collaboration.md): Make shared state live across sessions — subscribe to `storage.change`, refetch and dedup on events, and write with `updateJSON` so concurrent edits merge instead of clobbering.

## Deploy & management API

- [Deploy API OpenAPI spec](https://glow.backlit.run/openapi.yaml): The machine-readable OpenAPI document for the glow deploy/management REST API, served by the API itself.
- MCP server: `https://mcp.backlit.run/mcp` — the hosted Model Context Protocol server an agent connects to in order to create, deploy, and manage glows on a user's behalf (no API key to copy around).

## Optional

- [SDK reference (HTML)](https://sdk.backlit.run/reference): The same SDK reference rendered as a human-readable page.
- [Guides (HTML)](https://sdk.backlit.run/guides/push-end-to-end): Every guide above is also rendered as a human-readable HTML page at its extensionless URL (drop the `.md`).
- [SDK site home](https://sdk.backlit.run): The landing page describing the JavaScript SDK and linking the task guides.
