Skip to content

Firestore Schema

Luke C Hartman edited this page Nov 2, 2026 · 1 revision

Firestore schema (overview)

Light reference for contributors. Access is defined in firestore.rules. This page lists collections, purpose, who can read/write, and main relationships — not every field.

Auth custom claims (not collections)

Claim Meaning
admin Full admin tools
agency + agencyId / agencyName Agency (newsroom) user

Claims are set via Cloud Functions (addAdminRole, addAgencyRole, …).

Collections

Collection / doc Purpose Typical access
reports/{reportId} Submitted / imported articles Admin; same-agency users; submitter (create/own)
agency/{agencyId} Newsroom profile + agencyUsers[] Admin; own agency; signed-in users can list for report picker (rules constrain membership fields)
mobileUsers/{userId} User profiles (signupSource, etc.) Admin; agency triage; own doc
tags/{agencyDocId} Per-agency Topic / Source / Labels pickers Signed-in read; admin or owning agency write
tagSystems/{docId} Global tag defaults (e.g. defaults) Signed-in read; admin write
locations/{docId} Geo helpers Signed-in read; admin write
helpRequests/{requestId} Support tickets Create: signed-in; read/update/delete: admin
leftOutArticles/{articleId} Pipeline articles not chosen as cluster top Admin read/update; create via Admin SDK
settings/experiment Active experiment + experiment list Signed-in read; admin write
settings/appearance UI appearance Signed-in read; admin write
settings/login Public login blurbs Public read; admin write
settings/pipeline Nightly pipeline knobs (Truth Sleuth) Admin only
settings/pipelinePrompts LLM system prompts Admin only

Indexes: firestore.indexes.json.

Common flows

  1. Submit a report — signed-in user creates reports/{id} with agencyId (or fixed study agency on study deploys).
  2. Agency membership — admin updates agency.agencyUsers and calls claim functions so Auth matches.
  3. Experiment / archive — admin uses Settings + Cloud Functions to set active experiment and bulk-archive reports (archived* fields).
  4. Pipeline left-outs — nightly job writes leftOutArticles; admins may promote into reports.

Related

Clone this wiki locally