Skip to content

Example of implementing Next.js edge middleware with Firebase remote config for core web vitals optimised A/B testing. This is the origin of this PR to Vercel (https://github.com/vercel/examples/pull/670).

Notifications You must be signed in to change notification settings

tengweiherr/feature-flag-firebase-remote-config

Repository files navigation

name slug description framework useCase deployUrl demoUrl relatedTemplates
A/B Testing with Firebase remote config
ab-testing-firebase-remote-config
Firebase remote config is a Google cloud service that used to run A/B Testing and random percentage targeting with Google Analytics to A/B test improvements to your app across different segments of your user base to validate improvements before rolling them out to your entire user base.
Next.js
Edge Middleware
ab-testing-simple

A/B Testing with Firebase remote config

Firebase remote config is a Google cloud service that used to run A/B Testing and random percentage targeting with Google Analytics to A/B test improvements to your app across different segments of your user base to validate improvements before rolling them out to your entire user base.

nextjs-middleware-1

Demo

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

How to Use

You can choose from one of the following two methods to use this repository:

One-Click Deploy

Deploy the example using Vercel:

Deploy with Vercel

Clone and Deploy

Execute create-next-app with npm or Yarn to bootstrap the example:

npx create-next-app --example https://github.com/vercel/examples/tree/main/edge-middleware/feature-flag-firebase-remote-config feature-flag-firebase-remote-config
# or
yarn create next-app --example https://github.com/vercel/examples/tree/main/edge-middleware/feature-flag-firebase-remote-config feature-flag-firebase-remote-config

You'll need to have an account with Firebase and start an project with Firebase remote config. You will be asked to setup your first remote config and a few conditions. After setup, at the Firebase remote config console, go to Project Overview > Project Settings > Service accounts tab and click the button Generate new private key. It will prompt a download of a JSON file with your service account variables. Once that's done, copy the .env.example file in this directory to .env.local (which will be ignored by Git):

cp .env.example .env.local

Then open .env.local and set the environment variables to match the ones in the JSON file you have downloaded just now.

Next, run Next.js in development mode:

yarn dev

Deploy it to the cloud with Vercel (Documentation).

About

Example of implementing Next.js edge middleware with Firebase remote config for core web vitals optimised A/B testing. This is the origin of this PR to Vercel (https://github.com/vercel/examples/pull/670).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published