← Back to posts

Automating Firebase Deployments: Multi-Account Routing and Discord Notifications

A documented deployment automation pattern for Firebase: scripted CLI operations, account profiles, environment routing, and Discord webhook alerts.

Case Snapshot

Situation

A multi-environment Firebase setup needed repeatable deployments across accounts/projects without manually reconfiguring the CLI each time.

Issue

Manual Firebase deployments are easy to mis-target (wrong project/hosting target), hard to audit, and slow to coordinate without realtime status notifications.

Solution

Centralized deployment configuration into an `accounts.json` profile, added API endpoints for account switching, and integrated Discord webhooks for start/success/failure notifications with log snippets.

Used In

Used in RADXA AI Suite deployment automation documentation and tooling.

Impact

Reduced human error risk during deploys and made deployments observable via structured configuration and Discord notifications.

Situation

When one machine or one backend service deploys to multiple Firebase projects/environments, the biggest risk is targeting the wrong project.

The documented pattern in RADXA AI Suite is to treat deployment as a configuration-driven workflow instead of a set of manual CLI steps.

The Configuration: accounts.json

Instead of relying on whoever last ran firebase login, deployments are described via an explicit account profile file:

  • account id + email
  • Firebase project_id and friendly project_name
  • environment routing (production, staging, development)
  • per-environment hosting targets
  • optional Discord webhook settings per account

This makes “where does this deploy go?” answerable by reading a single file.

API-Driven Account Switching

The guide also documents an API endpoint that selects which account/profile to deploy with, so automation can switch contexts deliberately rather than implicitly.

Discord Webhook Notifications

Deploy status becomes team-visible by emitting Discord webhook messages:

  • notify on start/success/failure
  • include logs (with a configurable max line count)
  • allow distinct channels per project/account

The result is a deployment flow where:

  1. the target environment is chosen from config
  2. the Firebase CLI runs with the intended context
  3. the outcome is broadcast to Discord with enough log context for quick triage

Architecture Diagram

Automating Firebase Deployments: Multi-Account Routing and Discord Notifications execution diagram

This diagram supports Automating Firebase Deployments: Multi-Account Routing and Discord Notifications and highlights where controls, validation, and ownership boundaries sit in the workflow.

Post-Specific Engineering Lens

For this post, the primary objective is: Improve release confidence with visible automation outcomes.

Implementation decisions for this case

  • Chose a staged approach centered on firebase to avoid high-blast-radius rollouts.
  • Used devops checkpoints to make regressions observable before full rollout.
  • Treated automation documentation as part of delivery, not a post-task artifact.

Practical command path

These are representative execution checkpoints relevant to this post:

npm run build
firebase deploy --only hosting
curl -I https://<site>/health

Validation Matrix

Validation goalWhat to baselineWhat confirms success
Functional stabilitylatency, error budget burn, and cost profileSLO dashboard remains within target after rollout
Operational safetyrollback ownership + change windowautoscaling and quotas stay inside guardrails
Production readinessmonitoring visibility and handoff notessecurity policy checks pass in CI and runtime

Failure Modes and Mitigations

Failure modeWhy it appears in this type of workMitigation used in this post pattern
Pipeline secret driftDeploy path fails unexpectedlyPin secret names and validate before deploy step
Notification-only successChat alert says success while endpoint is brokenGate notifications on real health checks
Environment mismatchProd/staging behavior divergesUse explicit environment matrix in pipeline config

Recruiter-Readable Impact Summary

  • Scope: improve reliability while keeping cloud spend predictable.
  • Execution quality: guarded by staged checks and explicit rollback triggers.
  • Outcome signal: repeatable implementation that can be handed over without hidden steps.