Build — Firestore Comments with Edit Support
What Was Built
Firestore-backed comment system
- Replaced localStorage comment engine with Google Cloud Firestore REST API
- Comments persist across devices and browsers — shared by all visitors
- Edit support: original author can edit their comment (name-verified)
- Edited comments show "(edited)" tag
- Name remembered in localStorage for convenience
Decisions Made
Architecture
- No Firebase SDK — direct Firestore REST API calls. Zero dependencies. Roll your own.
- API key restricted — locked to bahalaka.com, www.bahalaka.com, bahalaka.pages.dev, localhost. Firestore API only.
- Security rules — public read/create on comments, update only if name matches (same author)
- Collection structure:
comments/{sectionId}/entries/{autoId} — subcollection per section
- Edit verification: prompt-based name match. Simple, honest, no auth overhead.
Infrastructure
GCP / Firestore
- Project: pantheon-platform-hq
- Database: bahalaka-website (named, not default)
- Location: nam5
- API Key: AIzaSyCU4Mj7vME6u3FT3bUHeTLzgBK72_b5f6Q (browser-restricted)
- Security Rules: deployed via Firebase Rules API
Files Changed
site/index.html — new CSS for edit UI, entire comment engine JS rewritten