For developers

The developer on-ramp — install the SDK, model your data, query it, add auth and files, then go deeper.

#For developers

You're building an app and EmuView is your backend. This page walks the whole journey — install, connect, model data, query, auth, files, automation — with one small example per step and a link to the deep page for each. Everything the SDK does maps to a plain REST endpoint, so you can follow along with fetch too.

flowchart LR
    A[Install SDK] --> B[Connect client]
    B --> C[Create collections]
    C --> D[Query with filters]
    D --> E[Add auth]
    E --> F[Upload files]
    F --> G[Automate flows]
    G --> H[Go further<br>API reference, MCP, LLM context]

#Prerequisites

  • An EmuView project (self-hosted or cloud) — the 5-minute quickstart gets you one
  • An API key from Settings → API Keys, or user credentials

#Steps

#1. Install the SDK

The SDK is a zero-dependency TypeScript client that works in browsers, Node.js, Deno, and Cloudflare Workers.

npm install @emuview/sdk

Deep dive: installation and setup

#2. Connect

Create one SvelteSync instance and reuse it across your app. Use an API key server-side; in the browser, the SDK stores the session token after sign-in.

import { EmuView } from '@emuview/sdk';

const sdk = new EmuView({
	url: 'https://your-api.example.com',
	auth: { apiKey: 'sk-your-api-key' } // server-side only
});

Deep dive: SDK overview

#3. Model your data with collections

Collections are database tables with an auto-generated CRUD API. Define fields from 23 types — text, decimal, enum, relation, geo, and others — in the dashboard or from code.

const schema = await sdk.createCollection('posts', {
	fields: [
		{ name: 'title', type: 'text', required: true },
		{ name: 'status', type: 'enum', enumValues: ['draft', 'published'] }
	]
});

Deep dives: create your first collection, field types, relations, SDK schema management

#4. Query with filters

Every collection gets list, get, create, update, and delete. Filters support operators (_eq, _gte, _contains, and others), relation dot-paths, sorting, pagination, and full-text search.

const results = await sdk.collection('posts').list({
	filter: { status: { _eq: 'published' } },
	sortBy: '-created_at',
	limit: 10
});
console.log(`${results.total} published posts`);

Deep dives: SDK collections, filtering, search, batch and aggregate

#5. Add auth to your app

Users sign up and sign in with email/password, magic links, 2FA, or Google/GitHub OAuth. The SDK stores the session token automatically and sends it on every request.

const session = await sdk.auth.signIn({
	email: 'alex@example.com',
	password: 'securePassword123'
});
// Subsequent calls run as this user, scoped by their role

Deep dives: SDK authentication, auth overview, API keys, access control

#6. Store files

Files go to Cloudflare R2 via presigned URLs. The SDK's upload() wraps the three-step flow into one call, and images get thumbnails automatically.

const avatar = new Blob([imageBytes], { type: 'image/png' });

const { fileId } = await sdk.files.upload(avatar, {
	filename: 'avatar.png',
	mimeType: 'image/png'
});

Deep dives: SDK files, files overview

#7. Automate

Automation flows react to record events, webhooks, and cron schedules with built-in operations — HTTP calls, AI, email, scripts. Build them in the dashboard or drive them from the SDK.

const run = await sdk.automate.executeFlow('flw_01HXK5M9QZ3T', {
	input: { postId: 'rec_01HXK5MABC12' }
});

Deep dives: automation overview, triggers, operations, SDK automation client

#Go further

  • API reference — every REST endpoint, for when you drop below the SDK
  • Real-time subscriptions — SSE and WebSocket updates for live UIs
  • Error handling — catch ApiError and handle session expiry
  • MCP server — connect Claude, Cursor, and other AI tools directly to your project for AI-assisted development
  • LLM context — point your coding assistant at /api/v1/system/llms-full.txt for the full docs as plain text, or fetch the agent-rules resource from the MCP server for ready-made agent instructions

#What you learned

  • One SDK client covers collections, auth, files, real-time, and automation
  • Collections give you a typed CRUD API without writing backend code
  • Every SDK call has a raw HTTP equivalent in the API reference

#Next steps