Skip to content

Latest commit

 

History

History
127 lines (91 loc) · 3.87 KB

quickstart.mdx

File metadata and controls

127 lines (91 loc) · 3.87 KB
title Quickstart
description Create a project and start building in minutes

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

The native TypeScript SDK. Lightweight (~20KB), WebTransport support, volatile paths, modern API. Already using Firebase? Change one URL and your existing code works with Lark. Supports JS, Android, iOS, Flutter, C++, and Unity.

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
});

// Write some data
await db.ref('players/alice').set({
  name: 'Alice',
  score: 0
});

The anonymous: true option connects without authentication, which is 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

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();

Developer tools

Lark CLI

The Lark CLI lets you manage projects, databases, data, and security rules from the terminal:

npm install -g @lark-sh/cli
lark login
lark config set-project your-project-id

Once set up, you can read and write data, export and import databases, deploy security rules, and monitor your project, all without leaving the terminal. See the CLI overview for common workflows.

Claude Code plugin

If you use Claude Code, install the Lark plugin so Claude has full context on the Lark platform:

/plugin marketplace add lark-sh/lark-skill
/plugin install lark@lark-tools

Use /lark in any conversation to activate it, or Claude will load it automatically when you're working with Lark. See the Claude Code plugin page for details.

What's next?

Understand how Lark organizes data as a JSON tree. Lock down who can read and write your data. Learn about real-time event types and how delta updates work. Explore your project's databases, metrics, and settings. Self-hosting Lark? See the [open-source quickstart on GitHub](https://github.com/lark-sh/lark). This guide uses Lark Cloud, but everything after project setup is identical on both.