Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.cocobase.buzz/llms.txt

Use this file to discover all available pages before exploring further.

Get started in three steps

Step 1 — Create a project

  1. Sign up at app.cocobase.cc
  2. Click New Project and give it a name
  3. Copy your API Key from the project settings

Step 2 — Install the SDK

npm install cocobase

Step 3 — Make your first call

import { Cocobase } from "cocobase";

const db = new Cocobase({ apiKey: "YOUR_API_KEY" });

// Create a document
const post = await db.createDocument("posts", {
  title: "My First Post",
  content: "Hello, CocoBase!",
});

console.log("Created:", post.id);

// List documents
const posts = await db.listDocuments("posts");
console.log("All posts:", posts.length);

Add authentication

// Register a new user
const result = await db.auth.register({
  email: "user@example.com",
  password: "securePassword123",
  data: { name: "John Doe" },
});
console.log("Registered:", result.user.id);

// Login
await db.auth.login({ email: "user@example.com", password: "securePassword123" });

// Restore session on app reload
const { isAuthenticated } = await db.auth.initAuth();
if (isAuthenticated) console.log("Welcome back,", db.auth.user?.email);

Add real-time updates

// onSnapshot — fires immediately, then on every change
const unsub = db.onSnapshot<Post>("posts", (posts) => {
  renderPosts(posts);
});

// Clean up when done
unsub();

Next steps

JavaScript SDK

Full JS/TS SDK reference — auth, queries, real-time, typed errors

Flutter SDK

Full Dart/Flutter SDK — widgets, onSnapshot, pagination

MCP Server

Manage your project with Claude, Cursor, or any AI tool

Cloud Functions

Write Python functions that run server-side