Buzzlet

Buzzlet (Local-First Social Network MVP)

System Overview (Plain English)

Folder Structure

/html
  index.html
  town.html
  national.html
  profile.html
  groups.html
  messages.html
  admin.html
/css
  styles.css
/js
  firebase.js
  auth.js
  app.js
  town.js
  national.js
  profile.js
  groups.js
  messages.js
  admin.js
  utils.js
/manifest.webmanifest
/service-worker.js
/firestore.rules
/storage.rules
/firebase.json

Firebase Setup (Beginner Steps)

  1. Create a Firebase project.
  2. Enable Authentication → Email/Password.
  3. Create a Firestore Database (production mode).
  4. Create a Storage bucket (default settings are fine).
  5. Copy your Firebase config into js/firebase.js.
  6. Deploy the Firestore rules in firestore.rules.
  7. Deploy the Storage rules in storage.rules.
  8. Add a curated list of towns in Firestore:
    • cities/{cityId} with fields: name, state, stateCode, lat, lng, searchTokens.
  9. Create Firestore composite indexes (see below).
  10. To make a user an admin, set users/{uid}.isAdmin = true.

Data Model (Key Collections)

Tradeoffs & Scaling Notes

Firestore Composite Indexes (Required)

Create these indexes in Firestore for the feed queries to work:

  1. Collection: posts
    • Fields: townId (Ascending), createdAt (Descending)
    • Query usage: Town feed (town posts)
  2. Collection: posts
    • Fields: stateCode (Ascending), createdAt (Descending)
    • Query usage: Town feed (statewide posts)
  3. Collection: posts
    • Fields: scope (Ascending), createdAt (Descending)
    • Query usage: Town feed + National feed (national posts)

Deployment (GitHub Pages)