Quickstart
Get Amba running in your Expo app in 5 minutes.
Not on Expo? This page is for the Expo managed workflow. If you're building with bare React Native, see SDK → React Native for the bare-RN setup (pod install,
react-native-configenv, Apple/Google sign-in via the platform-native libraries). The runtime API is identical — only install + native config differs.
1. Install the SDK
@layers/amba init walks you through:
- Creating an Amba account (or logging in).
- Creating a project.
- Generating API keys.
- Writing
.env.local,AMBA.md, and.cursor/rules/amba.mdcto your project.
Then install the Expo SDK:
If you already have an account:
Rename env vars for Expo
Expo only exposes env vars prefixed with EXPO_PUBLIC_ to client code. Copy the CLI output into your app's .env.local with the prefix:
2. Initialize the client
@layers/amba-expo provides an Amba singleton that handles storage, push tokens, and social sign-in for you. Call init() once in your root layout:
init() restores the session from persistent storage, creates an anonymous id, fetches remote config, and (by default) registers the device push token.
3. Register the Expo config plugin
In app.json, add @layers/amba-expo to the plugins array. The plugin wires up iOS aps-environment, Apple Sign In capability, URL schemes, and Android intent filters — no hand-editing Info.plist / AndroidManifest.xml.
Push on iOS requires a development build (not Expo Go) because custom entitlements aren't supported in Expo Go.
4. Track your first event
Events are sent to POST /client/events and automatically:
- Update the user's
last_seen_at. - Qualify any matching streaks.
- Trigger XP rules.
- Generate activity feed items (if configured).
5. Create a push campaign via MCP
If you're using an AI agent (Cursor, Claude Code), add the Amba MCP server:
Then ask your AI agent:
"Create a push notification campaign called 'Welcome Back' that targets users who haven't opened the app in 7 days"
The agent will use amba_segments_create and amba_push_campaigns_create to set it up.
6. Check project status
This shows your project health: active users, push token count, segment count, and integration status.
Alternative: manual signup via the API
If you'd rather script signup (CI tasks, internal dashboards), the API exposes the same flow:
Sign up
Returns 201 with data.access_token, data.refresh_token, and data.developer. Passwords below 8 characters return WEAK_PASSWORD; duplicate emails return 409 EMAIL_EXISTS.
Log in
Same response shape. Invalid creds return 401 INVALID_CREDENTIALS.
Rotate tokens
Refresh tokens live 30 days. Every refresh rotates both the access token and the refresh token — the old session is revoked atomically, so a replayed refresh is detected.
Fetch the current developer
Log out
Logout is idempotent — an invalid token still returns { data: { success: true } }.
Create a project
Provisioning runs in the background. Poll the response until project status flips to active.
Mint an API key
Client SDKs authenticate with X-Api-Key. Keys are per-project and scoped to either development or production.
The response includes the plaintext key once — store it immediately. Rotating a key creates a new row and leaves the old key valid until you explicitly revoke it.
Rate limits
Developer auth is rate-limited per IP to catch credential stuffing:
| Endpoint | Per minute | Per day |
|---|---|---|
signup | 5 | 50 |
login | 10 | 100 |
refresh | 30 | — |
Exceeding any window returns 429.
What's next?
- Walk through the kitchen-sink Expo tutorial — a full to-do app exercising every SDK module.
- Set up push notifications with APNs/FCM.
- Create user segments for targeting.
- Add streaks to drive daily engagement.
- Configure remote config for feature flags.
- Build an XP and levels system.