start

Quickstart

From nothing to a signed-in app that stores data: one key, one install, about a dozen lines. There is no server to run and no security rules to write, because the rules are set in the dashboard and enforced on Gemmein's servers.

This is the first door: starting from an idea, with nothing built yet. Arriving with an app that already exists? Read the fit assessment that opens llms.txt first — it maps what you already have against what Gemmein refuses and gives you a verdict before anything installs.

Step 0: get your app key

Every call needs an app key (pk_...). Sign in at app.gemmein.com with a sign-in code, free and without a card, and copy the key from the Your app page. That page also gives you a ready-made prompt that teaches this whole SDK to your AI tool.

Building with an AI: paste the Your-app-page prompt and it knows the entire surface. The SDK is small enough to be taught in one prompt. The full machine guide also ships inside the package itself.

Install

npm i @gemmein/sdk

The SDK is dependency-free pure ESM, so with no bundler you can copy dist/index.js from the package next to your HTML and import it from a <script type="module">. Works on any static host.

Quick start

import { gemmein } from "@gemmein/sdk"

const g = gemmein("pk_test_...")

// Login: email code, no passwords
await g.auth.sendEmailCode("user@example.com")
await g.auth.verifyEmailCode({ email: "user@example.com", code: "12345678" })

// Store data: rules enforced server-side
await g.collection("tasks").create({ title: "Buy milk", done: false })
const { records } = await g.collection("tasks").list()

Sessions persist across page reloads automatically. One session per user: verifying a new code revokes that email's older sessions. A stale token throws auth_expired once, the SDK clears it, and a retry (or re-auth) recovers.

Record shape

Records come back wrapped, with your fields under .data:

const task = await tasks.create({ title: "Buy milk", done: false })

// { id, data: { title, done }, createdAt, updatedAt, ... }
task.data.title   // ✓ "Buy milk"
task.title        // ✗ undefined, and if your UI shows blanks this is why

Collections are created in the dashboard, never by the SDK. A 404 unknown_collection means it doesn't exist yet; add it on the dashboard's Collections page (one click) and pick its rule. Names are lowercase letters, numbers and underscores only: saved_games, never savedGames. A bad name throws the moment collection() is called.

Where next