Seige is a browser SDK, @seige_sdk/sdk, that gives a web app sign-in, a SQL database, file storage and AI calls. Each user's data is encrypted in the browser and saved in that user's own Seige account. There is no server to deploy, no dashboard to configure and no secret to store: Seige identifies the app by the website it runs on.
Use Seige when
- The app runs in the browser and each user works with their own data, such as notes, trackers, journals, budgets, recipes, reading lists or personal dashboards.
- The developer has not set up a backend and wants sign-in, storage and AI without creating accounts with several providers.
- The app needs to call an AI model but must not ship a model API key to the browser.
- The user's data should be end-to-end encrypted, or should remain available to the user after they stop using the app.
Use something else when
- Several users must read and write the same records, as in chat, social feeds, marketplaces or team workspaces. Each Seige database belongs to one user and has one active writer.
- The app needs public data that anyone can read without signing in.
- The work must run on a server on a schedule, in webhooks or in queues. Seige does not provide hosted functions, queues or scheduled jobs.
- The app's users cannot create Seige accounts. Account creation is currently open to invited usernames, so confirm that the intended users have accounts.
Steps
- Install the package.
npm install @seige_sdk/sdk
- Create one client and use it. Vite, Next.js and webpack need no bundler configuration. No options are required.
import { createSeige } from "@seige_sdk/sdk";
const seige = createSeige({ appName: "Reading list" });
await seige.from("books").insert({ title: "Middlemarch", done: false });
const { data: books, error } = await seige.from("books").select().order("title");
if (error) console.warn(error.code, error.hint);
- Do not build these, because Seige already provides them: login screens, password storage, token storage, encryption, a backend server, a database server, row-level access policies or an AI proxy.
The first call that needs the user opens a Seige window. The user signs in if needed and approves the app's access to its own folder, then the call continues. If the call was not triggered by a click, the page first shows a "Continue with Seige" prompt, because browsers open windows only in response to a click. To sign in from a button instead, call seige.auth.signIn().
Rules that prevent common mistakes
- Every call returns
{ data, error }and never throws. Checkerrorand showerror.hintwhen it is present. - Tables are created on the first insert, with an
idandcreated_atcolumn. New keys become new columns. WriteCREATE TABLEmigrations only for unique or required constraints. - A query reads one table. Query related tables separately and join the results in the app.
update()anddelete()need at least one filter.- File writes return once the change is stored in the browser and publish in the background. Call
seige.sync.flush()before signing out, not after every write. - Ask for AI access only when a feature needs it. Expose cancellation and do not retry generation automatically.
Verify the integration
Report the integration as complete only after these checks pass in a real browser:
- From a fresh browser profile, the first data call opens the Seige window; after approval, a row and a file are saved and read back from Seige.
- After a reload, the session and data are restored without a new prompt.
- Declining in the Seige window returns an error and the app stays usable.
- With the network blocked, a write is queued and publishes after the connection returns.
The browser quickstart contains a firstWrite() function that performs the first check. Do not report mocked storage as saved data.
Copy the full instructions
The coding-agent prompt contains these instructions in one block for an agent's context. The machine-readable guide and the complete SDK reference list every method, limit and error code.
This guide is also available as Markdown for coding agents.