Essential commands, key files, environment setup, and common gotchas
firebase deploy or firebase login on a laptop. A merge to main deploys: only functions/** changes run deploy-functions.yml (~2 min), and anything else runs deploy-and-release.yml (~10 min).
Solomon uses dual hosting targets defined in .firebaserc:
solomon-3ead2 β the main Angular application (dist/solomon-app/browser)solomon-docs β this documentation site (docs/)| Service | Purpose |
|---|---|
AuthService | Sign-in/up, user profiles, role-based access |
SessionService | CRUD for counseling sessions, couples/individual modes |
MessageService | Real-time message stream, sequence ordering |
AiService | Wraps Cloud Function chat (5-min timeout, 2-min client) |
EncryptionService | AES-256-GCM encrypt/decrypt for messages |
TtsService | ElevenLabs streaming TTS via Cloud Function |
CounselorService | Counselor profiles, annotations, assignments |
InviteService | Couples invite workflow |
SubscriptionService | Stripe subscription management |
PdfExportService | jsPDF-based session export |
| Collection | Purpose |
|---|---|
userProfiles | User identity, denomination, profile context |
counselingSessions | Session metadata, participants, status |
chatMessages | Encrypted conversation history, sequence-ordered |
sessionKeys | AES-256-GCM encryption keys per session |
sessionInvites | Couples partner invite tokens (7-day expiry) |
counselorAnnotations | Pastoral notes on AI messages, encrypted |
counselorChats | Direct messages between counselor & counselee |
counselorApplications | Counselor approval workflow |
counselorSubscriptions | Stripe subscription state |
sessionGuidedPrompts | Counselor-seeded prompts for session openers |
secrets: ["ANTHROPIC_API_KEY"] in firebase.json or onCall() β this causes deploy-time permission errors. Do NOT use gcloud run services update --update-env-vars β it creates a separate revision that gets wiped on the next Firebase deploy. Instead, write secrets to functions/.env in CI before firebase deploy.
Some networks replace Google's certificates, and then Firebase CLI calls fail with certificate errors.
NODE_EXTRA_CA_CERTS at that network's root certificate. Never set NODE_TLS_REJECT_UNAUTHORIZED=0, which turns certificate checks off.The Firebase Emulator used for security rules tests requires Java 21 with firebase-tools@15.6.0. The default Java version on GitHub Actions runners is insufficient.
actions/setup-java@v4 with distribution: temurin and java-version: "21" before the rules test step in CI.Race condition β Firebase Auth hasn't restored the session yet when components initialize.
authService.currentUserProfile first, fallback to getUserProfile(auth.currentUser.uid).Services, guards and components get Firebase with inject(AUTH), inject(FIRESTORE), inject(FUNCTIONS) or inject(STORAGE) from src/app/firebase.ts. Tests replace these tokens with emulator or offline instances. A direct call to getAuth() or getFirestore() in app code would bypass that and reach the live project.
src/app/firebase.ts and inject itFirebase 11 returns Timestamps, not JS Dates. Angular's | date pipe throws NG02100 on raw Timestamp.
toDate(v: any): Date { return v?.toDate ? v.toDate() : v; } to component and use toDate(field) | date:... in templates.Using secrets: ["ANTHROPIC_API_KEY"] in firebase.json triggers deploy-time Secret Manager permission errors. Using gcloud run services update creates a revision that gets wiped on next deploy and fails when the old container image is garbage-collected.
functions/.env in CI before firebase deploy. Firebase 2nd-gen functions natively load .env files.SCSS token imports like @use 'styles/tokens' won't resolve without the include path configured.
angular.json has stylePreprocessorOptions: { includePaths: ["src"] }.