An Agent Builds an App
The end-to-end reference for a coding agent — account, project, data model, SDK, identity, XP + streaks, push, live updates, and the ship checklist, in order, with real calls.
This is the reference build. It walks the entire journey from "no account" to "shipping app" in nine steps, and every call on this page is real — the MCP tool names, argument shapes, and SDK methods are taken from the live surface, not paraphrased. If you are a coding agent, you can execute this page top to bottom.
The example app is a language-practice app, but every step generalizes. For a one-page map of everything else Amba can do, see the Capability Index.
0. Entry points
Two ways in, identical results:
- MCP (you have
mcp.amba.devconfigured): everything below is direct tool calls. Start at step 1. - No MCP yet: run
npx -y @layers/amba initin the project directory. It provisions the account + project headlessly, writes.env.local, and wires the MCP server into every detected client config — steps 1 and 2 collapse into that one command. See MCP install.
1. Create the account and project
Call amba_developer_signup — no Authorization header needed:
The response carries everything you need:
pat— your developer Personal Access Token. Pass it as an inlinepatargument on every subsequentamba_*call this session; write the matchingmcp_configsnippet to the MCP client config so future sessions authenticate automatically.project.project_id,project.client_key,project.server_key— a real isolated project, provisioning asynchronously.project.verify_token— verify the account headlessly:
Provisioning takes ~10 seconds. Poll until status is active before
sending client traffic:
Write the keys where the app will read them:
client_key ships in the app. server_key is for server-side code only —
never embed it in a client bundle.
2. Model the data
Collections are schema-first typed tables with automatic per-user row scoping. Create one for practice decks:
The server adds id, user_id, created_at, updated_at, deleted_at and
applies the change via an async workflow — the response includes the workflow
status. Columns are NOT NULL unless you pass "nullable": true; column
defaults are not supported, so set values like difficulty at insert time.
Column types: text, integer, bigint, boolean, jsonb,
timestamptz, date, uuid, numeric, vector (with dimension), plus
array types (text[], integer[], …).
Seed shared catalog data with the atomic batch insert (up to 500 rows):
Per-user data vs shared catalog. Collections default to strict per-user scoping — each
signed-in user reads only their own rows. For a shared, read-by-everyone catalog, create the
collection with shared: true, or use Content Libraries for scheduled editorial
content. Choosing the wrong primitive here is the most common migration wrong-turn — see
Collections for the chooser.
3. Install and initialize the SDK
Pick the package for the stack (the runtime surface is identical everywhere — see the parity matrix). For an Expo app:
(Expo exposes only EXPO_PUBLIC_-prefixed env vars to client code — copy the
values from .env.local under that prefix. Web apps use @layers/amba-web
and import the same Amba object; see Quickstart for the full
Expo walkthrough including the config plugin.)
4. Identity
configure() seeds a stable anonymous id; the first authenticated call signs
in anonymously on its own, so the app works before any sign-up UI exists.
When you add accounts:
Account linking preserves the anonymous user's history — XP, streaks, and collection rows follow the user through sign-up. See /auth.
5. First feature: XP + streaks
Define the rules from the admin side. Award XP whenever a lesson completes, capped at 10 awards per day:
Add a daily practice streak keyed for SDK use:
The client side is two calls — track the event (XP and the streak both fire from it server-side) and read the results:
Before wiring UI, verify the rules do what you think with the dry-run — it
returns what a track call would trigger without writing anything:
6. Push notifications
Configure credentials once. They're validated at configure time against the exact contract the send path uses, and stored encrypted:
(For Android, provider: "fcm" with service_account_json. Full field
reference: Push setup.)
Register the device from the app — the Expo helper captures the token and registers it in one call, picking APNs on iOS and FCM elsewhere:
Prove the loop end-to-end before building campaigns:
Then target real cohorts — create a segment and a campaign against it:
Segments re-evaluate every 15 minutes; campaigns deliver on schedule. See Push notifications.
7. Live updates
Subscribe to collection changes so the UI updates the moment a row lands — no polling. Requires an authenticated session (step 4):
Live updates are generally available, including for shipped apps:
long-lived subscriptions connect to a dedicated realtime host
(realtime.amba.host) with no request-duration ceiling, and the SDK routes
there automatically — in @layers/amba-web ≥ 4.0.6, @layers/amba-node
≥ 4.0.7, and @layers/amba-react-native ≥ 4.0.5 (Expo inherits via React
Native). If the app pins outbound hosts, allowlist realtime.amba.host
alongside api.amba.dev. Conversations
(Amba.messaging.conversation(id).subscribe) and gamification
(Amba.gamification.subscribe) stream over the same channel. See
Live Updates.
8. Ship
The pre-release checklist, each item verifiable by a call:
-
Account verified —
amba_developer_verifyreturned success (step 1), oramba_developer_meshowsis_verified: true. -
Provisioning active —
amba_projects_get_provisioning_statusreportsactive. -
Push proven end-to-end —
amba_push_send_testlanded on a real device with production-environment credentials (re-runamba_integrations_configurewith"environment": "production"for the App Store build). -
Keys in the right places —
client_keyin the app bundle,server_keyonly in server-side code and CI secrets. -
Spend guarded — set a project spend ceiling so a runaway client can't surprise anyone:
and read headroom anytime with
amba_billing_status. See /billing. -
Promote configuration, not clicks — when you split dev/prod into separate projects, export the dev project's configuration as a declarative bundle and import it into prod in one call. See Environment promotion.
From here, the rest of the surface is one tool call away — entitlements and paywalls, virtual currencies, social, AI prompts, serverless functions, and more. The Capability Index is the map.