Skip to content

Comments

feat: centralize configuration and secure firebase handling#1492

Open
bhoomiiee wants to merge 1 commit intoomroy07:mainfrom
bhoomiiee:feature/centralize-config
Open

feat: centralize configuration and secure firebase handling#1492
bhoomiiee wants to merge 1 commit intoomroy07:mainfrom
bhoomiiee:feature/centralize-config

Conversation

@bhoomiiee
Copy link
Contributor

Problem

  • Previously, Firebase configuration values were either hardcoded or implicitly handled across modules. This creates:
  • Security risks (exposed API keys in frontend)
  • Tight coupling between frontend & config values
  • Difficult scalability for future integrations
  • Risk of configuration drift

What This PR Implements
-Centralized Backend Configuration
Added /api/firebase-config endpoint in app.py
Firebase configuration is now read securely from environment variables
No sensitive credentials are stored in frontend files

  • Secure Environment-Based Setup
    The following variables are now expected:
    FIREBASE_API_KEY
    FIREBASE_AUTH_DOMAIN
    FIREBASE_PROJECT_ID
    FIREBASE_STORAGE_BUCKET
    FIREBASE_MESSAGING_SENDER_ID
    FIREBASE_APP_ID
    FIREBASE_MEASUREMENT_ID

  • Graceful Degradation
    If Firebase variables are not configured, API returns null values
    Frontend logs a warning:
    "Firebase not configured on server."
    Application does not crash

-Frontend Refactor
Removed hardcoded Firebase config from JS
Added dynamic fetch:
fetch('/api/firebase-config')
Firebase now initializes only after config is retrieved

-Testing Performed
Verified /api/firebase-config returns 200
Confirmed null-safe behavior when environment variables are missing
Confirmed no Firebase credentials are exposed in frontend source
Checked Network tab for successful fetch
Verified console warnings are expected and handled

-What Is NOT Included (Future Scope)
Strict runtime schema validation across all modules
Full migration of all modules to shared domain contracts
Production deployment configuration
Actual Firebase production keys (intentionally excluded)

  • Impact
    Improves security posture
    Prepares system for scaling
    Makes configuration environment-agnostic
    Enables safer ML/API integrations in future

@vercel
Copy link

vercel bot commented Feb 14, 2026

@bhoomiiee is attempting to deploy a commit to the Om Roy's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link

Thanks for creating a PR for your Issue! ☺️

We'll review it as soon as possible.
In the meantime, please double-check the file changes and ensure that all commits are accurate.

If there are any unresolved review comments, feel free to resolve them. 🙌🏼

@omroy07
Copy link
Owner

omroy07 commented Feb 16, 2026

Conflict

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants