Maintainer overview of server SDK and client script surfaces.
Surfaces
PHP (server) JS (client)
──────────── ───────────
\PRC\Platform\Firebase @prc/firebase script module [modern]
$this->db Realtime Database credentials via script_module_data filter
$this->auth Firebase Auth
firebase script handle [legacy]
window.firebase* globals
prcFirebaseConfig localization
Use Firebase for outside user data written from many clients. Use MySQL for PRC editorial data.
Server
includes/class-firebase.php initializes the Kreait SDK from firebase-service-account.json in WPCOM_VIP_PRIVATE_DIR (generated by bin/setup/generate-firebase-service-account.sh; never commit).
Client modern module
Assets registers @prc/firebase via wp_register_script_module. Config injects through script_module_data_@prc/firebase. When apiKey is missing (common on alpha/staging without env vars), src/index.js skips initializeApp / getAuth so anonymous loads do not throw auth/invalid-api-key.
Client legacy handle
On wp_enqueue_scripts / admin_enqueue_scripts (priority 0), the firebase handle loads Firebase 10 compat and localizes prcFirebaseConfig and prcFirebaseInteractivesConfig. Prefer the script module for new blocks.
Required constants
Defined in vip-config/ (production vs __DEV variants):
PRC_PLATFORM_FIREBASE_KEYPRC_PLATFORM_FIREBASE_AUTH_DOMAINPRC_PLATFORM_FIREBASE_AUTH_DBPRC_PLATFORM_FIREBASE_INTERACTIVES_DBPRC_PLATFORM_FIREBASE_DATA_TABLE_BUILDER_DB(server-side data-table block reads; see plugin README)PRC_PLATFORM_FIREBASE_PROJECT_IDWPCOM_VIP_PRIVATE_DIR
Production PRC_PLATFORM_FIREBASE_DATA_TABLE_BUILDER_DB currently points at prc-app-prod-data-table-builder until the Firebase project cutover to prc-platform-prod; update the VIP env var value only when that migration is ready.
Build
npx turbo build --filter=@prc/firebase
Runs build:module and build:compat webpack configs.