Firebase Setup
Code Insights needs two things from Firebase:
- Service account key — Used by the CLI to write session data to Firestore.
- Web SDK config — Used by the dashboard to read data from your Firestore.
This guide walks through creating both.
Create a Firebase Project
Section titled “Create a Firebase Project”- Go to console.firebase.google.com
- Click “Create a project” (or “Add project”)
- Enter a project name (e.g.,
code-insights-yourname) - Disable Google Analytics when prompted (not needed)
- Click “Create project” and wait for it to finish
Enable Firestore
Section titled “Enable Firestore”- In your new project, click “Build” in the left sidebar
- Click “Firestore Database”
- Click “Create database”
- Choose “Start in production mode”
- Select the region closest to you (this cannot be changed later)
- Click “Enable”
Download the Service Account Key
Section titled “Download the Service Account Key”- Click the gear icon next to “Project Overview” in the sidebar
- Select “Project settings”
- Go to the “Service accounts” tab
- Click “Generate new private key” then “Generate key”
- A JSON file will download — save it somewhere accessible (e.g.,
~/Downloads/serviceAccountKey.json)
The CLI will read three values from this file during setup: project_id, client_email, and private_key.
Register a Web App
Section titled “Register a Web App”- Still in Project settings, go to the “General” tab
- Scroll down to “Your apps”
- Click the Web icon (
</>) to add a web app - Enter a nickname (e.g.,
code-insights-web), click “Register app” - Firebase will show a code snippet — copy the entire snippet and save it to a file (e.g.,
~/Downloads/firebase-web-config.js):
// You can paste the entire Firebase snippet as-isconst firebaseConfig = { apiKey: "AIza...", authDomain: "your-project.firebaseapp.com", projectId: "your-project", storageBucket: "your-project.appspot.com", messagingSenderId: "123456789", appId: "1:123456789:web:abc123"};The CLI automatically extracts the config from the JavaScript — no manual conversion to JSON needed.
Update Firestore Security Rules
Section titled “Update Firestore Security Rules”The default production rules block all reads, which prevents the dashboard from loading your data. Update them:
- In Firebase Console, go to Firestore Database then Rules
- Replace the default rules with:
rules_version = '2';service cloud.firestore { match /databases/{database}/documents { match /{document=**} { allow read, write: if true; } }}- Click “Publish”
Next Steps
Section titled “Next Steps”You now have both JSON files needed to configure the CLI. Head to Quick Start to run code-insights init and start syncing.