Vercel hosts frontends — static assets, server rendering, edge functions — with the smoothest deploy experience available for Next.js. Firebase is a backend suite: authentication, a realtime document database, file storage and cloud functions. They overlap only at hosting, and a great many projects end up using both.
The comparison is common because both are answers to “where do I put my app”, and they answer it at different layers. Deciding well means separating the frontend question from the backend one, because you can pick differently on each.
Table of contents
- What each actually provides
- The combination most teams land on
- Pricing shapes, which differ in a way that matters
- Lock-in, honestly assessed
- Choosing
- How this fits the rest of the stack
- FAQ
What each actually provides
Vercel is a frontend delivery platform:
- Global CDN with automatic static optimisation.
- Serverless and edge functions for API routes.
- Preview deployments per pull request — genuinely one of the best features in the category.
- Deep Next.js integration, since Vercel maintains Next.js.
- Image optimisation, analytics, and now some managed storage and database offerings.
Firebase is a backend-as-a-service:
- Authentication with a long list of providers, which is the standout feature.
- Firestore, a document database with realtime subscriptions and offline support.
- Cloud Storage for files.
- Cloud Functions for server-side logic.
- Hosting, which is competent but not its main attraction.
- Push notifications, remote config, crash reporting, analytics.
So the overlap is hosting and serverless functions, and both do more outside that overlap than inside it. Vercel has no authentication or database in the sense Firebase means; Firebase’s hosting has no preview deployments per pull request and less sophisticated framework integration.
The combination most teams land on
Frontend on Vercel, backend services from Firebase, is a common and sensible arrangement. You get Vercel’s deploy experience and Firebase’s auth and database without either having to be something it is not.
// lib/firebase.js
import { initializeApp } from 'firebase/app';
import { getAuth } from 'firebase/auth';
import { getFirestore } from 'firebase/firestore';
const app = initializeApp({
apiKey: process.env.NEXT_PUBLIC_FIREBASE_API_KEY,
authDomain: process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN,
projectId: process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID,
});
export const auth = getAuth(app);
export const db = getFirestore(app);
The Firebase web API key being public is by design — it identifies the project rather than authorising access. Security comes from Firestore rules, which is the part people get wrong:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /users/{userId} {
allow read, write: if request.auth != null
&& request.auth.uid == userId;
}
}
}
Because the client talks to Firestore directly, those rules are your entire access control layer. A permissive rule left over from development — allow read, write: if true — is a fully open database, and this has caused real breaches. Firebase warns about it; the warnings get dismissed.
Test rules rather than assuming them:
firebase emulators:start --only firestore
npm run test:rules
Pricing shapes, which differ in a way that matters
Both are usage-priced and both have surprised people, in different ways.
Vercel bills on bandwidth, function invocations, function duration and build minutes. The Hobby tier is free and explicitly non-commercial. The surprises come from image optimisation counts, high-traffic bandwidth, and long-running serverless functions.
Firebase bills Firestore on document reads, writes and deletes, plus storage and egress. The classic surprise is read volume: a listener on a collection that re-reads on every change, or a query fetching 500 documents to display 10, generates far more reads than the interface suggests.
// 1000 reads every time this runs
const snap = await getDocs(collection(db, 'posts'));
// 10 reads
const snap = await getDocs(
query(collection(db, 'posts'), orderBy('createdAt', 'desc'), limit(10))
);
That difference is invisible in development with 20 test documents and expensive at 100,000.
Set budget alerts on both before launching anything public. Neither platform stops at a threshold by default, and the failure mode is a bill rather than an outage.
The structural point worth noting: usage pricing means your cost scales with traffic in ways that are hard to predict before you have traffic. That is fine when it is understood and unpleasant when it is not, which is why per-plan pricing remains attractive for projects that want a predictable number.
Lock-in, honestly assessed
Vercel’s lock-in is moderate. A Next.js application can be self-hosted or run on other platforms — output: 'standalone' produces a deployable Node bundle. What you lose in moving is preview deployments, image optimisation and edge middleware behaviour, which take work to replicate but are not irreplaceable.
Firebase’s lock-in is substantially higher. Firestore’s data model, query semantics and security rules have no equivalent elsewhere; there is no drop-in replacement. Firebase Auth holds your users, and exporting password hashes is possible but not simple. Cloud Functions use Firebase-specific triggers.
A migration off Firestore is typically a rewrite of the data layer, not a configuration change. That is worth knowing at the start rather than discovering at the point you want to leave.
If lock-in matters to you, the mitigation is boring and effective: keep data access behind an interface rather than calling Firestore from components, and avoid modelling data in a way that only Firestore’s query semantics support.
The counter-argument is real too. Firebase’s auth alone saves weeks, and weeks of engineering time is worth a lot to a small team. Lock-in you chose deliberately for a reason you can state is a trade; lock-in you drifted into is a problem.
Choosing
- Next.js frontend, need it live today — Vercel. Nothing is smoother, and the preview deployments are genuinely valuable for review.
- Mobile app needing auth, sync and offline — Firebase. This is exactly what Firestore’s realtime and offline support were built for.
- Web app needing both — frontend on Vercel, auth and data from Firebase, or a single platform hosting both halves.
- Relational data with real constraints and joins — neither. Firestore’s document model fights relational data, and you want Postgres or MySQL.
- Predictable monthly cost matters more than scaling to zero — a plan-priced platform rather than usage billing on both.
The last two are where a lot of projects genuinely belong and where this comparison sends them wrong. A conventional web application with users, orders and a reporting requirement is a relational application, and choosing a document database because the hosting comparison mentioned it is how teams end up denormalising data by hand to work around missing joins.
How this fits the rest of the stack
The useful conclusion is that the frontend and backend decisions are separable, and treating them as one choice is what makes this comparison confusing. Where the assets are served from and where the data lives can be answered independently.
The case for keeping them together is operational rather than technical: one deploy path, one place to set environment variables, one bill that does not scale unpredictably with traffic. RunxBuild runs static sites with 120GB bandwidth included, Node and Next.js services, and managed MySQL or Postgres on plan pricing rather than per-read billing — so the frontend, the API and the database are one deployment with a number you can predict. We do not offer Firestore or a managed auth product, and for a realtime offline-first mobile app a specialist is the honest recommendation. The RunxBuild hosting calculator shows each line item.
Useful related references:
- Firebase vs Supabase: Document Store or Postgres, and What That Costs You Later
- Deleting a Firebase Auth Account Properly: The Data Nobody Remembers
- Services on RunxBuild
FAQ
Is Vercel or Firebase better for hosting?
Vercel for frontend hosting — better framework integration, preview deployments per pull request, and a stronger CDN story. Firebase Hosting is competent but is not the reason to choose Firebase. Firebase’s value is its authentication, database and storage services, which Vercel does not provide equivalents for.
Can I use Vercel and Firebase together?
Yes, and it is a common arrangement — the frontend deploys to Vercel while authentication, Firestore and storage come from Firebase. The Firebase web API key is public by design, so your access control is entirely Firestore security rules, which must be tested rather than assumed.
Why is my Firebase bill so high?
Almost always Firestore document reads. Fetching a whole collection to display a handful of items, or attaching listeners that re-read on every change, generates far more reads than the interface suggests. Add limit() to queries and set a budget alert before launching.
How hard is it to migrate off Firebase?
Harder than off most platforms. Firestore’s data model, query semantics and security rules have no direct equivalent, so migrating is usually a rewrite of the data layer rather than a configuration change. Keeping data access behind an interface from the start makes it substantially easier.
Should I use Firestore for relational data?
No. Firestore is a document store with no joins and limited query capability across collections, so relational data ends up denormalised by hand with consistency maintained in application code. If your data has real relationships and constraints, use Postgres or MySQL.