Skip to main content
Moving from Firebase Realtime Database to Lark is straightforward. Your code, security rules, and data model all carry over.
1

Create a Lark project

Create a project in the Lark dashboard. Note your project ID — you’ll need it for the connection URL.
2

Enable Firebase compatibility

In project settings, toggle Allow Legacy Firebase. This turns on the Firebase wire protocol so your existing SDKs can connect.If your Firebase app stores multiple independent data silos (game rooms, workspaces, etc.) under path prefixes, Lark can split them into separate databases automatically. See Database routing for your options.
3

Configure Firebase Auth (if applicable)

If you use Firebase Auth, enter your Firebase project ID in the Firebase Auth Project ID field. This lets Lark validate your users’ tokens. See Firebase Auth with Lark for details.
4

Migrate security rules

Copy your Firebase RTDB security rules into Lark’s security rules editor. The syntax is identical — paste them in and click Save Rules.You can find your current rules in the Firebase console under Realtime Database > Rules.
5

Export your data

In the Firebase console, export your database as JSON. Or use the Firebase CLI:
firebase database:get / > backup.json
For large databases, consider exporting individual paths to keep file sizes manageable.
6

Import your data

In the Lark dashboard, open your database and use Import to upload the JSON file. This writes the data to your Lark database in the same structure it had in Firebase.
7

Update your connection URL

Change your databaseURL from:
https://your-project.firebaseio.com
to:
https://your-lark-project-id.larkdb.net
This is the only code change required.
8

Test

Run your app and verify that reads, writes, and subscriptions work as expected. Start with a staging environment or a small percentage of production traffic.
You don’t have to migrate all at once. Start by pointing a staging environment at Lark, run your test suite, then gradually shift production traffic.

Common gotchas

A few things to double-check before you go live:
  • Ephemeral mode — Make sure ephemeral mode is OFF if you want data to persist. Ephemeral mode is a Lark feature that discards data when all subscribers disconnect. Great for presence systems, not great for your users table.
  • Auto-create — If you’re using database routing to split data into separate databases, enable auto-create so Lark creates databases on first connect.
  • Security rules — Test your rules in Lark’s rules editor before going live. The syntax is the same, but it’s worth verifying that everything was copied correctly.
  • Volatile paths — If you have high-frequency data like cursor positions or player movement, consider configuring volatile paths. Firebase SDK clients fully support volatile updates — Lark batches them on the server and delivers them as PATCH events that the Firebase SDK handles natively. You just need to define the volatile path patterns in your project settings.

What’s next