Skip to main content

1. Create a project

Head to the Lark dashboard and sign in with Google. Click New Project and give it a name — this generates a project ID you’ll use to connect. In your project’s Settings page, note your Project ID. You’ll need it in the next step.
Enable Auto Create in your project settings so databases are created automatically when a client connects. This is the fastest way to get started.

2. Pick your SDK

3. A quick example with the Lark SDK

If you’re starting fresh, here’s what it looks like end-to-end:

Install

npm install @lark-sh/client

Connect and write data

import { LarkDatabase } from '@lark-sh/client';

// Connect to your project and database
const db = new LarkDatabase('your-project-id/my-first-database', {
  anonymous: true
});
await db.connect();

// Write some data
await db.ref('players/alice').set({
  name: 'Alice',
  score: 0
});
The anonymous: true option connects without authentication — useful for getting started quickly. You’ll add proper auth later.

Read data

const snapshot = await db.ref('players/alice').once('value');
console.log(snapshot.val()); // { name: 'Alice', score: 0 }

Subscribe to real-time updates

This is where it gets interesting. Subscribe to a path and your callback fires every time the data changes — from any connected client.
const unsubscribe = db.ref('players').on('value', (snapshot) => {
  console.log('Players:', snapshot.val());
});

// Update a score — every subscriber sees it instantly
await db.ref('players/alice/score').set(42);

// When you're done listening
unsubscribe();

Clean up

await db.disconnect();

What’s next?