Skip to content

Feature Flag Apple Store

This template uses Upstash (Edge Redis Database) as fast storage to control whether an store is open or closed.

Framework Next.js
Use Case Edge Functions
CSS Tailwind
Publisher ▲ Vercel

Apple Store

This template uses Upstash (Edge Redis Database) as fast storage to control whether an 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

After setting up your environment variables, deploy the example using 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-functions/feature-flag-apple-store
# or
yarn create next-app --example https://github.com/vercel/examples/tree/main/edge-functions/feature-flag-apple-store
Set up environment variables

Get your Upstash credentials from the Upstash's dashboard, then rename .env.example to .env.local:

cp .env.example .env.local

And update it with your Upstash credentials.

Next, run Next.js in development mode:

npm install
npm run dev

# or

yarn
yarn dev

Deploy it to the cloud with Vercel (Documentation).

Opening / Closing the Store

We can use Upstash's REST API to update the kev/value store or use API routes.

To open the store go to:

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

To close the store go to:

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

For Upstash's REST API: Replace the URLs and Authorization tokens below with the values from your Upstash Redis instance.

Open

$ curl https://your-upstash-url.upstash.io/set/store-closed/false -H "Authorization: Bearer YOUR_TOKEN"

Closed

$ curl https://your-upstash-url.upstash.io/set/store-closed/true -H "Authorization: Bearer YOUR_TOKEN"

Feature Flag Apple Store

This template uses Upstash (Edge Redis Database) as fast storage to control whether an store is open or closed.

Framework Next.js
Use Case Edge Functions
CSS Tailwind
Publisher ▲ Vercel

Apple Store

This template uses Upstash (Edge Redis Database) as fast storage to control whether an 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

After setting up your environment variables, deploy the example using 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-functions/feature-flag-apple-store
# or
yarn create next-app --example https://github.com/vercel/examples/tree/main/edge-functions/feature-flag-apple-store
Set up environment variables

Get your Upstash credentials from the Upstash's dashboard, then rename .env.example to .env.local:

cp .env.example .env.local

And update it with your Upstash credentials.

Next, run Next.js in development mode:

npm install
npm run dev

# or

yarn
yarn dev

Deploy it to the cloud with Vercel (Documentation).

Opening / Closing the Store

We can use Upstash's REST API to update the kev/value store or use API routes.

To open the store go to:

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

To close the store go to:

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

For Upstash's REST API: Replace the URLs and Authorization tokens below with the values from your Upstash Redis instance.

Open

$ curl https://your-upstash-url.upstash.io/set/store-closed/false -H "Authorization: Bearer YOUR_TOKEN"

Closed

$ curl https://your-upstash-url.upstash.io/set/store-closed/true -H "Authorization: Bearer YOUR_TOKEN"

Unleash New Possibilities

Deploy your app on Vercel and unlock its full potential