InstantBackend

InstantBackend

Public documentation

InstantBackend is the backend built for AI-generated apps. Authenticate, create collections, and query data with a lightweight SDK or REST API. Designed for use with Cursor, Claude, and ChatGPT.

Using an AI coding agent? Start with a ready-made prompt: Use this prompt. Then get your API key and set INSTANTBACKEND_API_KEY (or NEXT_PUBLIC_INSTANTBACKEND_API_KEY for web).

More examples on GitHub: instantbackend/instantbackend-examples

Quick SDK examples

Node / JS

// Sign up to get your API key:
// https://www.instantbackend.dev/register
import { InstantBackend } from "instantbackend-sdk";

const sdk = new InstantBackend("YOUR_API_KEY");
await sdk.login("user", "pass");
const tasks = await sdk
  .collection("tasks")
  .get();

Login + query

update(id, data) replaces or upserts the full document for that ID. It is not a partial merge.

// Sign up to get your API key:
// https://www.instantbackend.dev/register
const sdk = new InstantBackend("YOUR_API_KEY");
await sdk.login("user", "pass");

await sdk.collection("tasks").add({
  title: "Send proposal",
  status: "open",
  priority: "high",
});

await sdk.collection("tasks").update("task-123", {
  title: "Send proposal",
  status: "done",
  priority: "high",
});

await sdk.collection("tasks").delete("task-123");

const openTasks = await sdk
  .collection("tasks")
  .where("status", "==", "open")
  .get();

Register + login + invoices

// Sign up to get your API key:
// https://www.instantbackend.dev/register
const sdk = new InstantBackend("YOUR_API_KEY");

await sdk.registerUserForAccount(
  "jane.doe",
  "secure-password",
  "[email protected]",
  "Jane Doe"
);

await sdk.login("jane.doe", "secure-password");

await sdk.collection("invoices").add({
  number: "INV-2026-001",
  status: "paid",
  total: 1290,
});

const paidInvoices = await sdk
  .collection("invoices")
  .where("status", "==", "paid")
  .limit(10)
  .get();

Pagination + sorting

// Sign up to get your API key:
// https://www.instantbackend.dev/register
const sdk = new InstantBackend("YOUR_API_KEY");
await sdk.login("user", "pass");

const recentInvoices = await sdk
  .collection("invoices")
  .sort("desc")
  .limit(5)
  .get();

const nextPage = await sdk
  .collection("invoices")
  .sort("desc")
  .limit(5)
  .nextToken(recentInvoices.nextToken)
  .get();

Custom sort field

// Sign up to get your API key:
// https://www.instantbackend.dev/register
const sdk = new InstantBackend("YOUR_API_KEY");
await sdk.login("user", "pass");

await sdk.collection("ranking").add({
  username: "jane.doe",
  score: 1280,
  __sortBy: "score",
});

const topScores = await sdk
  .collection("ranking")
  .sort("desc")
  .limit(10)
  .get();

Android (Kotlin)

// Sign up to get your API key:
// https://www.instantbackend.dev/register
val client = OkHttpClient()

val loginPayload = """
  {"username":"jane.doe","password":"secure-password"}
""".trimIndent()

val loginRequest = Request.Builder()
  .url("https://api.instantbackend.dev/login")
  .post(
    loginPayload
      .toRequestBody("application/json".toMediaType())
  )
  .addHeader("X-API-Key", "YOUR_API_KEY")
  .build()

val loginResponse = client
  .newCall(loginRequest)
  .execute()
val token = JSONObject(
  loginResponse.body!!.string()
).getString("token")

val invoicePayload = """
  {"number":"INV-2026-001","status":"paid","total":1290}
""".trimIndent()

val createInvoiceRequest = Request.Builder()
  .url("https://api.instantbackend.dev/invoices")
  .post(
    invoicePayload
      .toRequestBody("application/json".toMediaType())
  )
  .addHeader("Authorization", "Bearer $token")
  .build()

client
  .newCall(createInvoiceRequest)
  .execute()

val listInvoicesRequest = Request.Builder()
  .url(
    "https://api.instantbackend.dev/invoices" +
      "?status=paid&limit=10"
  )
  .get()
  .addHeader("Authorization", "Bearer $token")
  .build()

val invoicesResponse = client
  .newCall(listInvoicesRequest)
  .execute()

iOS (Swift)

// Sign up to get your API key:
// https://www.instantbackend.dev/register
import Foundation

let apiKey = "YOUR_API_KEY"
let baseUrl = "https://api.instantbackend.dev"

func request(
  _ path: String,
  method: String,
  body: Data? = nil,
  token: String? = nil
) -> URLRequest {
  var req = URLRequest(
    url: URL(string: baseUrl + path)!
  )
  req.httpMethod = method
  req.setValue(
    "application/json",
    forHTTPHeaderField: "Content-Type"
  )
  if let token = token {
    req.setValue(
      "Bearer \(token)",
      forHTTPHeaderField: "Authorization"
    )
  } else {
    req.setValue(apiKey, forHTTPHeaderField: "X-API-Key")
  }
  req.httpBody = body
  return req
}

let loginBody = try JSONSerialization.data(
  withJSONObject: [
    "username": "jane.doe",
    "password": "secure-password"
  ]
)

let loginReq = request(
  "/login",
  method: "POST",
  body: loginBody
)
let loginData = try await URLSession.shared
  .data(for: loginReq).0
let token = try JSONSerialization.jsonObject(
  with: loginData
) as? [String: Any]
let jwt = token?["token"] as? String ?? ""

let invoiceBody = try JSONSerialization.data(
  withJSONObject: [
    "number": "INV-2026-001",
    "status": "paid",
    "total": 1290
  ]
)

let createReq = request(
  "/invoices",
  method: "POST",
  body: invoiceBody,
  token: jwt
)
_ = try await URLSession.shared.data(for: createReq)

let listReq = request(
  "/invoices?status=paid&limit=10",
  method: "GET",
  token: jwt
)
_ = try await URLSession.shared.data(for: listReq)

Unity (C#)

// Sign up to get your API key:
// https://www.instantbackend.dev/register
using System.Text;
using UnityEngine;
using UnityEngine.Networking;

public class InstantBackendExample : MonoBehaviour
{
  private const string ApiKey = "YOUR_API_KEY";
  private const string BaseUrl =
    "https://api.instantbackend.dev";

  private IEnumerator Start()
  {
    var loginBody =
      "{"username":"jane.doe","password":"secure-password"}";
    var loginReq = new UnityWebRequest(
      BaseUrl + "/login",
      "POST"
    );
    loginReq.uploadHandler = new UploadHandlerRaw(
      Encoding.UTF8.GetBytes(loginBody)
    );
    loginReq.downloadHandler = new DownloadHandlerBuffer();
    loginReq.SetRequestHeader(
      "Content-Type",
      "application/json"
    );
    loginReq.SetRequestHeader("X-API-Key", ApiKey);
    yield return loginReq.SendWebRequest();

    var token = JsonUtility.FromJson<TokenResponse>(
      loginReq.downloadHandler.text
    ).token;

    var saveBody =
      "{"userId":"jane.doe","level":5," +
      ""coins":1200,"updatedAt":"2026-01-28T12:00:00Z"}";
    var createReq = new UnityWebRequest(
      BaseUrl + "/saves",
      "POST"
    );
    createReq.uploadHandler = new UploadHandlerRaw(
      Encoding.UTF8.GetBytes(saveBody)
    );
    createReq.downloadHandler = new DownloadHandlerBuffer();
    createReq.SetRequestHeader(
      "Content-Type",
      "application/json"
    );
    createReq.SetRequestHeader(
      "Authorization",
      "Bearer " + token
    );
    yield return createReq.SendWebRequest();

    var listReq = UnityWebRequest.Get(
      BaseUrl + "/saves?userId=jane.doe&limit=1"
    );
    listReq.SetRequestHeader(
      "Authorization",
      "Bearer " + token
    );
    yield return listReq.SendWebRequest();
  }

  [System.Serializable]
  private class TokenResponse
  {
    public string token;
  }
}

AI prompts

Production-ready prompts for React, Flutter, Swift, Kotlin, Unity, and Godot. Each prompt instructs the AI to use only InstantBackend (no custom backend).

Open prompt library →

Quick web app prompt (Node / JS)

You are a senior full-stack engineer. Build a small web app that uses the InstantBackend SDK.
- SDK: https://www.npmjs.com/package/instantbackend-sdk
- Docs: https://instantbackend.dev/docs
- You MUST use InstantBackend as the only backend. Do NOT create a custom backend.
- Use env var NEXT_PUBLIC_INSTANTBACKEND_API_KEY for the API key.
- Implement login, create, and list (e.g. collection "tasks"). Include loading, error, and empty states.

Swagger

Embedded OpenAPI reference. You can open it in a new window if you prefer.