Learn how to integrate Bolt.new AI with Firebase in 2025 using this step-by-step guide for fast setup, smooth workflows, and scalable apps.

Book a call with an Expert
Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.
You integrate Bolt.new with Firebase the same way you integrate any browser‑based full‑stack sandbox with Firebase: you install the real Firebase SDKs inside your Bolt project, provide your Firebase keys through environment variables, initialize the Firebase client or admin SDK in your server-side routes, and call Firebase normally. Bolt doesn’t have any hidden magic; you treat it like a small Node + browser workspace that can talk to Firebase via REST or official SDKs. The essential steps are: install Firebase packages, configure environment variables, initialize Firebase (client SDK for frontend, Admin SDK for backend), then call Firestore/Auth/Storage from your Bolt routes or frontend code.
Bolt.new gives you a frontend (runs in the browser) and a backend (Node inside Bolt’s sandbox). Firebase gives you two SDK families:
Inside Bolt.new you can use both: the Web SDK in your React/Vue/Svelte/JS frontend, and the Admin SDK in backend routes.
The steps below are the safest and most common pattern for real integrations.
npm install firebase firebase-admin
Frontend-safe variables (Web SDK):
Backend-only variables (Admin SDK):
These come from Firebase → Project Settings → Service Accounts → Generate New Private Key.
// firebaseClient.js
import { initializeApp } from "firebase/app"
import { getFirestore } from "firebase/firestore"
import { getAuth } from "firebase/auth"
const firebaseConfig = {
apiKey: import.meta.env.VITE_FIREBASE_API_KEY,
authDomain: import.meta.env.VITE_FIREBASE_AUTH_DOMAIN,
projectId: import.meta.env.VITE_FIREBASE_PROJECT_ID,
storageBucket: import.meta.env.VITE_FIREBASE_STORAGE_BUCKET,
messagingSenderId: import.meta.env.VITE_FIREBASE_SENDER_ID,
appId: import.meta.env.VITE_FIREBASE_APP_ID
}
const app = initializeApp(firebaseConfig)
export const db = getFirestore(app)
export const auth = getAuth(app)
Now you can use db and auth directly inside Bolt.new’s frontend components.
Use this when you need privileged server access, such as writing secure data, verifying auth tokens, or hitting Firestore without exposing secrets.
// firebaseAdmin.js
import admin from "firebase-admin"
if (!admin.apps.length) {
admin.initializeApp({
credential: admin.credential.cert({
projectId: process.env.FIREBASE_PROJECT_ID,
clientEmail: process.env.FIREBASE_CLIENT_EMAIL,
privateKey: process.env.FIREBASE_PRIVATE_KEY.replace(/\\n/g, "\n") // required fix
})
})
}
export const firestore = admin.firestore()
export const auth = admin.auth()
Notice the replace fix — private keys come with escaped newlines.
// routes/saveNote.js (example backend route)
import { firestore } from "../firebaseAdmin.js"
export default async function handler(req, res) {
try {
const { userId, text } = req.body
await firestore.collection("notes").add({
userId,
text,
createdAt: Date.now()
})
res.status(200).json({ ok: true })
} catch (err) {
console.error(err)
res.status(500).json({ error: "Failed to save note" })
}
}
This is how Bolt routes communicate with Firebase in production‑safe ways.
This is the typical flow you’ll implement:
This keeps secrets off the client and follows Firebase’s recommended architecture.
This is the real, production-safe way to integrate Bolt.new with Firebase.
When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.