Connecting Your App
Every PocketBase instance on PocketBase Cloud exposes a standard PocketBase REST + realtime API over HTTPS. The easiest way to talk to it is the official JavaScript SDK, which works in the browser, Node.js, Deno, Bun, and React Native.
Step 1: Install the SDK
npm install pocketbase
Step 2: Create a client
Point the client at your instance URL (shown on the instance detail page in the dashboard):
import PocketBase from "pocketbase";
const pb = new PocketBase("https://<instance-name>.pocketbasecloud.com");
That’s it — no API keys or extra configuration. HTTPS and CORS are already handled by the platform.
Step 3: Make your first request
// list records from a collection
const posts = await pb.collection("posts").getList(1, 20, {
sort: "-created",
});
// fetch a single record
const post = await pb.collection("posts").getOne("RECORD_ID");
// create a record
const newPost = await pb.collection("posts").create({
title: "Hello from PocketBase Cloud",
});
Which operations are allowed for unauthenticated or authenticated users is controlled by each collection’s API rules.
Using environment variables
Hard-coding the instance URL works, but most apps keep it in an environment variable so staging and production can point at different instances:
const pb = new PocketBase(import.meta.env.VITE_POCKETBASE_URL);
If you host your frontend on PocketBase Cloud, you can set this in your build environment. Backends deployed on PocketBase Cloud can read it from the Env Vars page of the deployment.
Other languages
PocketBase has an official Dart SDK for Flutter apps, and community SDKs for Go, Python, Rust, and more. Any HTTP client works too — the full REST API is documented in your instance’s admin panel under API preview on each collection.