The Backend-as-a-Service (BaaS) that lets you focus on the frontend.

By The Coding Gopher

Published: 2026-07-21

URL: https://thecodinggopher.substack.com/p/what-is-firebase


A technical breakdown of how Google’s BaaS abstracts server infrastructure, and the engineering trade-offs of client-side driven architecture.Firebase with React and TypeScript: A Comprehensive Guide - DEV Community

In traditional software development, building an application requires managing two entirely separate domains: the frontend (what the user sees) and the backend (the servers, databases, and authentication logic that power it).

Firebase, acquired and heavily expanded by Google, is a Backend-as-a-Service (BaaS) platform. It is designed to completely abstract the server layer away from the developer. Instead of writing backend routing logic or configuring Linux servers, developers interact directly with Firebase’s managed infrastructure using pre-built client-side SDKs.Import segments | Firebase Documentation

This architecture fundamentally shifts the center of gravity of an application, allowing frontend code to securely communicate directly with the database.Building a real-time web app with Google Firebase, Python, & VueJS

Here is a breakdown of the core infrastructure pillars of Firebase and the engineering realities of adopting it.

Subscribe now

1. The Core Infrastructure

Firebase is a massive ecosystem of over 20 distinct products, but the architecture of most applications relies on four foundational services.

Authentication and Identity Management

Implementing secure, cryptographic user authentication from scratch is highly error-prone. Firebase Auth provides a fully managed OIDC (OpenID Connect) compliant identity service.Authenticate a new user.

-

The Abstraction. Developers do not need to manage password hashing (bcrypt/Argon2) or the lifecycle of JSON Web Tokens (JWTs). Firebase handles session persistence, token refreshing, and OAuth 2.0 flows for third-party providers (Google, Apple, GitHub) directly within the frontend SDK.

Real-Time NoSQL Databases

Firebase offers two primary cloud-hosted NoSQL databases: the legacy Realtime Database and the modern Cloud Firestore.Patterns for security with Firebase: offload client work to Cloud Functions  | by Doug Stevenson | Firebase Developers | Medium

-

The Abstraction. Unlike standard SQL databases (like PostgreSQL) that rely on a request-response cycle, Firestore utilizes persistent WebSocket connections. When data mutates in the cloud, Firestore automatically pushes that delta to every connected client in milliseconds. This makes building real-time dashboards, collaborative tools, or chat applications nearly effortless.

Read / write in realtime.

What’s Actually Happening Under the Hood?

Because the above code uses the Firebase Web SDK, the real-time connection needs to be flexible enough to work across various browsers and restrictive networks. Here is how Firestore manages the connection.

-

gRPC-Web & WebChannel. While the Firestore backend and mobile/Node.js SDKs communicate natively using gRPC (a high-performance Remote Procedure Call framework), standard web browsers don’t fully support raw gRPC. To bridge this gap, the Firebase Web SDK uses a Google-developed protocol called WebChannel.

-

The WebSocket Attempt. WebChannel’s first move is to try and establish a standard WebSocket connection. This provides the low-latency, bidirectional stream needed for your onSnapshot listener to react instantly to database changes.

-

The Long-Polling Fallback. If a user is on a restrictive network (like a strict corporate firewall or a proxy) that blocks WebSocket traffic, WebChannel gracefully degrades to HTTP Long-Polling. In long-polling, the client opens a standard HTTP request and leaves it hanging open until the server has new data to send. Once the data is received, the client immediately opens a new request.Firebase uses WebSockets as its primary mechanism for real-time data synchronization in the Firebase Realtime Database and Cloud Firestore.

Firebase includes a built-in fallback mechanism that uses HTTP long polling if a WebSocket connection cannot be established—typically due to restrictive firewalls, proxy servers, or older browsers that do not support the WebSocket protocol.

Cloud Functions (Serverless Compute)

Because the frontend communicates directly with the database, exposing certain operations (like processing a credit card payment or sending a welcome email) on the client side is a severe security risk.What can you do with Cloud Functions? | Cloud Functions for Firebase

Firebase Cloud Messaging (FCM) is a cross-platform, no-cost messaging solution that allows you to reliably send notifications and messages to users on Android, iOS, and the web. It acts as a bridge between servers and devices, supporting targeted messages to specific devices, device groups, or topics to drive user re-engagement.

-

The Abstraction. Cloud Functions allow developers to write isolated, single-purpose Node.js or Python scripts that live on Google’s servers. These functions are highly scalable and strictly event-driven—they only spin up and execute in response to specific triggers, such as an HTTP request, a new user signing up, or a document being updated in Firestore.

𝐋𝐞𝐚𝐫𝐧 𝐭𝐨 𝐛𝐮𝐢𝐥𝐝 𝐆𝐢𝐭, 𝐃𝐨𝐜𝐤𝐞𝐫, 𝐑𝐞𝐝𝐢𝐬, 𝐇𝐓𝐓𝐏 𝐬𝐞𝐫𝐯𝐞𝐫𝐬, 𝐚𝐧𝐝 𝐜𝐨𝐦𝐩𝐢𝐥𝐞𝐫𝐬, 𝐟𝐫𝐨𝐦 𝐬𝐜𝐫𝐚𝐭𝐜𝐡. Get 40% OFF CodeCrafters: https://app.codecrafters.io/join?via=the-coding-gopher

This Substack is reader-supported. To receive new posts and support my work, consider becoming a free or paid subscriber.

Cloud Storage and HostingSave an image to Cloud Storage.

For handling large binary files (images, video, audio), Firebase provides Cloud Storage, which is essentially a wrapper around Google Cloud Storage buckets. For the frontend code itself, Firebase Hosting acts as a globally distributed Content Delivery Network (CDN) to serve static assets (HTML, CSS, JS) with built-in SSL provisioning.Firebase HostingFirebase Hosting is a fully managed, secure, and fast hosting service by Google for web apps, static content, and microservices. It serves content via a global CDN (Content Delivery Network) with automatic SSD storage and SSL encryption, making it ideal for SPAs, static sites, and modern web frameworks.

2. The Security Model. Client-Side Rules

The most glaring architectural question surrounding Firebase is security: If the frontend can read and write directly to the database, what stops a malicious user from opening their browser console and deleting the entire database?

Traditional backends use server-side middleware to verify permissions before touching the database. Firebase replaces this with Security Rules.

Security Rules are a custom, declarative configuration language hosted on Firebase’s servers. Every time a client attempts to read or write a document, the request is intercepted by this rules engine. The engine verifies the user’s authentication token against the rules you define (e.g., allow write: if request.auth.uid == resource.data.ownerId) before allowing the transaction to proceed.

3. The Engineering Trade-offs

Choosing a BaaS like Firebase is a permanent architectural commitment that trades deep customization for extreme development velocity.

The Advantages

-

Extreme Velocity. An engineering team can bypass months of DevOps, infrastructure provisioning, and API design, allowing them to ship a scalable application in weeks.

-

Zero Infrastructure Management. There are no operating systems to patch, load balancers to configure, or database shards to manage. Google handles infinite horizontal scaling automatically.

-

Out-of-the-Box Real-Time Sync. Native offline-support and multi-device real-time state synchronization are notoriously difficult distributed system problems that Firebase solves entirely behind the scenes.

The Limitations

-

Strict Vendor Lock-in. Your application’s data models, authentication flows, and security rules are tightly coupled to proprietary Google APIs. Migrating off Firebase requires a near-total backend rewrite.

-

NoSQL Relational Complexities. Firestore lacks native support for complex JOIN queries. Modeling highly relational data often requires heavy data duplication (denormalization) and complex manual synchronization logic.

-

Unpredictable Billing (The Read/Write Trap). Firestore charges per document read and write, not strictly by storage. Inefficiently structured queries or runaway frontend loops can result in staggering, unexpected infrastructure bills.

This Substack is reader-supported. To receive new posts and support my work, consider becoming a free or paid subscriber.

Thanks for reading! This post is public so feel free to share it.

Share