initializeUser — Auth Trigger

An event-triggered backend function that seeds new users with a default setup in the prod Firestore database.

Behavior

  • Trigger: auth.user().onCreate
  • Creates/merges users/{uid} with profile and lastLogin
  • Creates users/{uid}/workflows/workflow-1 with a default workflow
  • Initializes users/{uid}/config/concurrency (defaults: maxConcurrent=3)

Region and runtime

  • Region: us-central1
  • Runtime: Node.js 20 (emulator parity required)

Parity requirements

  • Emulator must mirror production: schema, rules, paths, and side effects
  • Frontend relies on workflow-1 presence for first-time load

A manual backfill endpoint is available in development to initialize existing users when the auth trigger didn’t fire.