> ## Documentation Index
> Fetch the complete documentation index at: https://docs.larksh.com/llms.txt
> Use this file to discover all available pages before exploring further.

# JavaScript SDK

> Use the Firebase JavaScript SDK with Lark

The only change you need is the `databaseURL` in your Firebase config. Here's a typical config object. The highlighted line is the only thing you change:

```javascript theme={null}
var firebaseConfig = {
  apiKey: "API_KEY",
  authDomain: "PROJECT_ID.firebaseapp.com",
  // Change this from https://PROJECT_ID.firebaseio.com
  databaseURL: "https://your-lark-project-id.larkdb.net",
  projectId: "PROJECT_ID",
  storageBucket: "PROJECT_ID.firebasestorage.app",
  messagingSenderId: "SENDER_ID",
  appId: "APP_ID",
  measurementId: "G-MEASUREMENT_ID",
};
```

## Firebase JS SDK v8

```javascript theme={null}
import firebase from 'firebase/app';
import 'firebase/database';

firebase.initializeApp({
  databaseURL: 'https://your-lark-project-id.larkdb.net'
});

const db = firebase.database();
```

## Firebase JS SDK v9 (modular)

```javascript theme={null}
import { initializeApp } from 'firebase/app';
import { getDatabase, ref, set } from 'firebase/database';

const app = initializeApp({
  databaseURL: 'https://your-lark-project-id.larkdb.net'
});

const db = getDatabase(app);
```

## Database routing

If your Firebase app stores many independent data silos under path prefixes (game rooms, workspaces, etc.), see [Database routing](/firebase/database-routing) for options on splitting them into separate Lark databases.
