
๐ง Project Overview
Goal: a small real-time chat that proves you can ship a production-shaped web application in a single sitting using React on the client and Firebase on the backend. No server to provision, no auth database to maintain, no WebSocket plumbing to wire โ Google sign-in for identity and a realtime database for messages, then a one-line deploy to Firebase Hosting.
It was an onboarding project for the React + Firebase stack at a time when the Firebase Realtime Database was still the simplest way to wire live state from a browser without standing up a backend. The intended outcome was not feature depth; it was to internalize the deploy loop and the auth flow so that the next project could start a step further along.
Current features:
- Google sign-in via Firebase Authentication โ one click, no password stored anywhere, no email verification flow.
- Per-user message timeline persisted to the Firebase Realtime Database, with optimistic insert in the UI so the user sees their own message appear before the round-trip completes.
- Live message sync across open tabs and devices โ every new message in the database is pushed down to every connected client in the same room.
- Lightweight UI: a Google avatar + display name per message, a single text field at the bottom, and a scrollable list that reflows as new entries arrive.
- Public demo hosted at
chat-react-c9d77.web.appvia Firebase Hosting, with HTTPS and a global CDN provided out of the box.
๐๏ธ Architecture: React Frontend + Firebase Backend
The app is intentionally two-sided: the React client owns the view layer, the Firebase SDKs own identity, persistence and live sync. There is no custom server in the loop โ every read and write goes straight from the browser to a Firebase backend.
graph LR
UI[React UI<br/>message list + input] --> LIST[ListComponent<br/>onValue subscribe]
UI --> INPUT[InputComponent<br/>handleSubmit]
LIST --> SDK[Firebase Web SDK]
INPUT --> SDK
SDK --> AUTH[Firebase Auth<br/>Google provider]
SDK --> DB["Firebase DB<br/>RDB or Firestore<br/>/messages/:roomId"]
AUTH --> TOKEN[ID token<br/>browser memory]
TOKEN --> DB
DB --> PUSH[onValue push<br/>fan-out to clients]
PUSH --> LIST
This shape lets us:
- Drop the entire backend by deleting one
firebaseConfigobject and re-pointing it at another project โ there is no server to redeploy. - Add a second room by introducing a
roomIdparameter and a second<ListComponent />โ the auth + database plumbing does not change. - Recover the exact deployed asset with
firebase serveor by re-deploying from the same source โ Hosting builds a hashed asset bundle and serves it from a CDN by path.
๐งฐ Technologies Used
โ๏ธ Frontend (React)
- React as the view layer โ functional and class components mixed, with state managed locally per component.
- Firebase Web SDK (
firebase/app,firebase/auth,firebase/database) initialized once at app startup from afirebaseConfigobject. - Realtime Database listeners (
onValue) wired into the message list component so the UI subscribes to updates instead of polling. - A thin CSS layer (no framework era-appropriate) for spacing, the input bar and the avatar bubble.
โ๏ธ Backend (Firebase, fully managed)
- Firebase Authentication with the Google sign-in provider โ no passwords stored, one-click login.
- Firebase Realtime Database as the message store โ JSON tree, fan-out on write, perfectly suited to a live chat.
- Firebase Hosting for the static React bundle, with HTTPS
and a global CDN; deploy is a single
firebase deploy --only hostingcommand.
๐ ๏ธ Tooling
- Create React App as the build tool โ
npm start,npm run build, ready to drop into thepublic/folder of Hosting. - firebase-tools as the CLI for
firebase init,firebase deployandfirebase serve.
๐ Key Technical Decisions
โ 1. Google Sign-In as the only auth path
The whole point of this project was to remove the parts of โbuilding a chatโ that are not the chat: password storage, reset flows, email verification. Firebase Authentication with the Google provider collapses all of that into one button and comes back with a display name and avatar URL that the UI can consume directly.
โ 2. Realtime Database instead of Firestore
In late 2019 the Realtime Database was the lowest-friction
choice for a one-file demo: JSON-shaped, no schema, no
collection/document model to learn, native onValue listener
that maps almost line-for-line onto a React component. The
trade-off (no offline cache, no compound queries, no
document-shaped security rules) was acceptable for a demo and
would only matter once the data model outgrew the chat use
case.
โ 3. Firebase Hosting over a custom CDN
Firebase Hosting gave us HTTPS, a custom domain hookup, a predictable deploy loop and preview channels on the same project, with no Nginx to write and no TLS cert to renew. For a project this small, the operations cost of any other hosting choice would have dwarfed the time saved writing the code.
๐ Current Outcome
โ๏ธ Public demo live at https://chat-react-c9d77.web.app, served from Firebase Hosting with HTTPS.
โ๏ธ Google sign-in working end-to-end โ anyone can open the URL and start sending messages within one click.
โ๏ธ Live message sync verified across two browser tabs and across two devices: a message sent in one place appears in the other within the round-trip of the WebSocket push.
โ๏ธ Source open for anyone to fork as a starting point โ the readme points at the repo and the live demo in three lines.
๐ Conclusion
This is the smallest โchat you can ship in a sittingโ that still looks like a real product: real auth, real persistence, real live sync, real public URL. None of it is novel โ every piece is what Firebase was designed for โ but the combination is what proves that React + Firebase is still one of the shortest paths from โblank pageโ to โdeployed, authenticated, real-time appโ when the use case fits.
The two biggest things it teaches are the deploy loop
(firebase deploy and you are live) and the data loop
(onValue and you are subscribed). Once those two are
internalized, every subsequent Firebase project gets to start
from a known-good baseline.
Want to read the source or run your own version?
- ๐ Repository
- ๐ Live demo
๐ง Spinning up your own real-time app?
If you are building something on top of Firebase Auth + Realtime Database and want to talk through the data-shape trade-offs or the hosting preview workflow, feel free to reach out ๐