examples icon indicating copy to clipboard operation
examples copied to clipboard

feature-flag-firebase-remote-config

Open tengweiherr opened this issue 2 years ago β€’ 4 comments

Description

Feature flag with Firebase remote config, inspired by the example feature-flag-split

  1. Create three variant pages (index.tsx, B.tsx, C.tsx) in about folder.
  2. Run a script during the pre-build time to fetch the treatments from Firebase remote config.
  3. Save the treatments to a JSON file and store it in the directory.
  4. Proceed to build the app to generate static pages for each variant (/about, /about/B, /about/C).
  5. When a client requests the about page, instead of calling API routes and sending HTTP requests to fetch data from Firebase, the middleware can directly retrieve the data from the pre-generated JSON file and assign a variant to it.

Full article about this approach here.

Demo URL

https://feature-flag-firebase-remote-config.vercel.app

Type of Change

  • [x] New Example
  • [ ] Example updates (Bug fixes, new features, etc.)
  • [ ] Other (changes to the codebase, but not to examples)

New Example Checklist

  • [ ] πŸ›« npm run new-example was used to create the example
  • [x] πŸ“š The template wasn't used but I carefully read the Adding a new example steps and implemented them in the example
  • [x] πŸ“± Is it responsive? Are mobile and tablets considered?

tengweiherr avatar May 02 '23 02:05 tengweiherr

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Comments Updated (UTC)
app-dir-css-in-js βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
app-dir-i18n βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
app-dir-share-state βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
edge-api-routes-cache-control βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
edge-api-routes-hello-world βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
edge-api-routes-json-response βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
edge-api-routes-query-parameters βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
edge-functions-authed-proxy βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
edge-functions-cookies βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
edge-functions-news ❌ Failed (Inspect) Jul 12, 2024 11:09am
edge-functions-streams βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
edge-geolocation-country-block βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
edge-middleware-modify-request-header βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
edge-user-agent-based-rendering βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
example-auth-with-ory ❌ Failed (Inspect) Jul 12, 2024 11:09am
example-reduce-image-bandwidth-usage βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
examples βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
geolocation-script βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
i18n βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
next-edge-api-route-hello-world βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
next-flask βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
nodejs-api βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
redirect-with-fallback βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
redirects-bloom-filter βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
solutions-combining-data-fetching-strategies βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
solutions-image-fallback βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
solutions-image-offset βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
solutions-loading-web-fonts βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
solutions-microfrontends βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
solutions-microfrontends-docs βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
solutions-pagination-with-ssg βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
solutions-parallel-routes-navbar ❌ Failed (Inspect) Jul 12, 2024 11:09am
solutions-reuse-responses βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
solutions-script-component-ad βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
solutions-script-component-strategies βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
solutions-testing βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
wasm-rust-hello-world βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am
wasm-rust-xor βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 12, 2024 11:09am

vercel[bot] avatar May 02 '23 02:05 vercel[bot]

@tengweiherr is attempting to deploy a commit to the Vercel Examples Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar May 02 '23 02:05 vercel[bot]

🚨 Potential security issues detected. Learn more about Socket for GitHub β†—οΈŽ

To accept the risk, merge this PR and you will not be notified again.

Alert Package NoteCI
Critical CVE npm/[email protected] 🚫

View full reportβ†—οΈŽ

Next steps

What is a critical CVE?

Contains a Critical Common Vulnerability and Exposure (CVE).

Remove or replace dependencies that include known critical CVEs. Consumers can use dependency overrides or npm audit fix --force to remove vulnerable dependencies.

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of ecosystem/package-name@version specifiers. e.g. @SocketSecurity ignore npm/[email protected] or ignore all packages with @SocketSecurity ignore-all

socket-security[bot] avatar Jul 18 '24 01:07 socket-security[bot]