/bolt-ai-integration

Bolt.new AI and Firebase integration: Step-by-Step Guide 2025

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.

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

Book a free No-Code consultation

How to integrate Bolt.new AI with Firebase?

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.

 

What Firebase + Bolt.new Integration Actually Means

 

Bolt.new gives you a frontend (runs in the browser) and a backend (Node inside Bolt’s sandbox). Firebase gives you two SDK families:

  • Firebase Web SDK — meant for browser apps (Auth, Firestore, Storage, etc.)
  • Firebase Admin SDK — server‑side SDK used in Node (secure writes, privileged access)

Inside Bolt.new you can use both: the Web SDK in your React/Vue/Svelte/JS frontend, and the Admin SDK in backend routes.

 

Step-by-Step Integration

 

The steps below are the safest and most common pattern for real integrations.

  • Install Firebase SDKs
npm install firebase firebase-admin
  • Add environment variables in Bolt.new (project settings → environment variables).
    These should be your real Firebase credentials—not placeholder values.

Frontend-safe variables (Web SDK):

  • VITE_FIREBASE_API\_KEY
  • VITE_FIREBASE_AUTH\_DOMAIN
  • VITE_FIREBASE_PROJECT\_ID
  • VITE_FIREBASE_STORAGE\_BUCKET
  • VITE_FIREBASE_SENDER\_ID
  • VITE_FIREBASE_APP\_ID

Backend-only variables (Admin SDK):

  • FIREBASE_PROJECT_ID
  • FIREBASE_CLIENT_EMAIL
  • FIREBASE_PRIVATE_KEY

These come from Firebase → Project Settings → Service Accounts → Generate New Private Key.

 

Initialize Firebase in the Frontend (Web SDK)

 

// 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.

 

Initialize Firebase in the Backend (Admin SDK)

 

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.

 

Create a Backend API Route in Bolt.new That Talks to Firebase

 

// 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.

 

Frontend → Backend → Firebase Flow

 

This is the typical flow you’ll implement:

  • The frontend collects data or a signed-in Firebase user token.
  • The frontend calls a Bolt backend route using fetch().
  • The backend verifies the user (optional) and writes/reads from Firestore via Admin SDK.

This keeps secrets off the client and follows Firebase’s recommended architecture.

 

When to Use Each SDK

 

  • Use Firebase Web SDK when running code in the browser: authentication, reading public Firestore data, or showing UI.
  • Use Firebase Admin SDK in backend routes when performing secure operations (server writes, role checks, token verification).

 

Important Gotchas

 

  • Never expose your Admin SDK credentials to the frontend. Only store them in Bolt backend environment variables.
  • Firebase private keys must be stored with \n escapes in env vars and fixed at runtime.
  • Bolt.new can call Firebase’s REST APIs too if you prefer minimal dependencies.

This is the real, production-safe way to integrate Bolt.new with Firebase.

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with. They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

CPO, Praction - Arkady Sokolov

May 2, 2023

Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost. He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space. They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-code solutions.
We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 
This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022