Skip to content
Avatar of vercelvercel/examples

Feature Flag Apple Store

This template uses Edge Config as fast storage to control whether a store is open or closed.

Feature Flag Apple Store

Feature Flag Apple Store

This template uses Edge Config as fast storage to control whether the store is open or closed.

Demo

https://edge-functions-feature-flag-apple-store.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:

Clone and Deploy

Execute create-next-app with pnpm to bootstrap the example:

pnpm create next-app --example https://github.com/vercel/examples/tree/main/edge-middleware/feature-flag-apple-store
Set up environment variables

Copy the .env.example file in this directory to .env.local (which will be ignored by Git):

cp .env.example .env.local

This example requires you to set up an Edge Config and store its connection string in the EDGE_CONFIG environment variable.

Fill the Edge Config you create with this content:

{ "featureFlagsAppleStore_storeClosed": true }

Next, run Next.js in development mode:

pnpm dev

Deploy it to the cloud with Vercel (Documentation).

Opening / Closing the Store using the Dashboard

You can control whether the store is open or not by changing the value of featureFlagsAppleStore_storeClosed using the Edge Config Dashboard.

Opening / Closing the Store using API Routes

Note that you need to provide your own TEAM_ID_VERCEL and AUTH_BEARER_TOKEN environment variables in .env.local if you want to open or close the store using the routes shown below.

To open the store go to:

http://localhost:3000/api/store/open

To close the store go to:

http://localhost:3000/api/store/close

Alternatively you can use the Edge Config UI in your Vercel dashboard to update the featureFlagsAppleStore_storeClosed value directly.

Feature Flag Apple Store
Avatar of vercelvercel/examples

Feature Flag Apple Store

This template uses Edge Config as fast storage to control whether a store is open or closed.

Feature Flag Apple Store

This template uses Edge Config as fast storage to control whether the store is open or closed.

Demo

https://edge-functions-feature-flag-apple-store.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:

Clone and Deploy

Execute create-next-app with pnpm to bootstrap the example:

pnpm create next-app --example https://github.com/vercel/examples/tree/main/edge-middleware/feature-flag-apple-store
Set up environment variables

Copy the .env.example file in this directory to .env.local (which will be ignored by Git):

cp .env.example .env.local

This example requires you to set up an Edge Config and store its connection string in the EDGE_CONFIG environment variable.

Fill the Edge Config you create with this content:

{ "featureFlagsAppleStore_storeClosed": true }

Next, run Next.js in development mode:

pnpm dev

Deploy it to the cloud with Vercel (Documentation).

Opening / Closing the Store using the Dashboard

You can control whether the store is open or not by changing the value of featureFlagsAppleStore_storeClosed using the Edge Config Dashboard.

Opening / Closing the Store using API Routes

Note that you need to provide your own TEAM_ID_VERCEL and AUTH_BEARER_TOKEN environment variables in .env.local if you want to open or close the store using the routes shown below.

To open the store go to:

http://localhost:3000/api/store/open

To close the store go to:

http://localhost:3000/api/store/close

Alternatively you can use the Edge Config UI in your Vercel dashboard to update the featureFlagsAppleStore_storeClosed value directly.

Unleash New Possibilities

Deploy your app on Vercel and unlock its full potential