Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
16 changes: 8 additions & 8 deletions flags-sdk/bucket/README.md → flags-sdk/reflag/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# Bucket Flags SDK Example
# Reflag Flags SDK Example

This example uses [Bucket](https://bucket.co) for feature flags with the [Flags SDK](https://flags-sdk.dev) along with the `@flags-sdk/bucket` [Bucket adapter](https://flags-sdk.dev/docs/api-reference/adapters/bucket) and the [Flags Explorer](https://vercel.com/docs/workflow-collaboration/feature-flags/using-vercel-toolbar).
This example uses [Reflag](https://reflag.com) for feature flags with the [Flags SDK](https://flags-sdk.dev) along with the `@flags-sdk/reflag` [Reflag adapter](https://flags-sdk.dev/docs/api-reference/adapters/reflag) and the [Flags Explorer](https://vercel.com/docs/workflow-collaboration/feature-flags/using-vercel-toolbar).

## Demo

[https://flags-sdk-bucket.vercel.app/](https://flags-sdk-bucket.vercel.app/)
[https://flags-sdk-reflag.vercel.app/](https://flags-sdk-reflag.vercel.app/)

## How it works

This demo uses two features on Bucket to control the visibility of two banners on the page.
This demo uses two features on Reflag to control the visibility of two banners on the page.
Both gates are configured to show/hide each banner 50% of the time.

If you deployed your own and configured the features on Bucket, you can also use the [Flags Explorer](https://vercel.com/docs/workflow-collaboration/feature-flags/using-vercel-toolbar) to enabled/disabled the features.
If you deployed your own and configured the features on Reflag, you can also use the [Flags Explorer](https://vercel.com/docs/workflow-collaboration/feature-flags/using-vercel-toolbar) to enabled/disabled the features.

## Deploy this template

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fvercel%2Fexamples%2Ftree%2Fmain%2Fflags-sdk/bucket&env=FLAGS_SECRET&envDescription=The+FLAGS_SECRET+will+be+used+by+the+Flags+Explorer+to+securely+overwrite+feature+flags.+Must+be+32+random+bytes%2C+base64-encoded.+Use+the+generated+value+or+set+your+own.&envLink=https%3A%2F%2Fvercel.com%2Fdocs%2Fworkflow-collaboration%2Ffeature-flags%2Fsupporting-feature-flags%23flags_secret-environment-variable&project-name=bucket-flags-sdk-example&repository-name=bucket-flags-sdk-example)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fvercel%2Fexamples%2Ftree%2Fmain%2Fflags-sdk/reflag&env=FLAGS_SECRET&envDescription=The+FLAGS_SECRET+will+be+used+by+the+Flags+Explorer+to+securely+overwrite+feature+flags.+Must+be+32+random+bytes%2C+base64-encoded.+Use+the+generated+value+or+set+your+own.&envLink=https%3A%2F%2Fvercel.com%2Fdocs%2Fworkflow-collaboration%2Ffeature-flags%2Fsupporting-feature-flags%23flags_secret-environment-variable&project-name=reflag-flags-sdk-example&repository-name=reflag-flags-sdk-example)

### Step 1: Link the project

Expand All @@ -37,7 +37,7 @@ vercel env pull

### Step 3: Create Features

Head over to the [Bucket application](app.bucket.co) and create the features required by this template.
Head over to the [Reflag application](app.reflag.com) and create the features required by this template.

Features:

Expand All @@ -48,7 +48,7 @@ You can also find the feature keys in the `flags.ts` file.

### Step 4: Configure the Features

Select the `Summer Sale` and `Free Shipping` features and configure them on the Bucket Console.
Select the `Summer Sale` and `Free Shipping` features and configure them on the Reflag Console.

Create a new rule by clicking on "+ Add Rule" and set the percentage to 50%.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getProviderData, createFlagsDiscoveryEndpoint } from 'flags/next'
import { getProviderData as getBucketProviderData } from '@flags-sdk/bucket'
import { getProviderData as getReflagProviderData } from '@flags-sdk/reflag'
import { mergeProviderData } from 'flags'
import * as flags from '../../../../flags'

Expand All @@ -9,7 +9,7 @@ export const GET = createFlagsDiscoveryEndpoint(async (request) => {
return mergeProviderData([
// Data declared from Flags in Code
getProviderData(flags),
// metadata from Bucket API using the default bucket adapter
getBucketProviderData(),
// metadata from Reflag API using the default reflag adapter
getReflagProviderData(),
])
})
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import './globals.css'
import { ExamplesBanner } from '@/components/banners/examples-banner'

export const metadata: Metadata = {
title: 'Bucket - Flags SDK Example',
description: 'A Flags SDK ecommerce example using Bucket',
title: 'Reflag - Flags SDK Example',
description: 'A Flags SDK ecommerce example using Reflag',
}

export default function RootLayout({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ export function ExamplesBanner() {
className="text-link hover:text-link-light transition-colors no-underline [&_code]:text-link [&_code]:hover:text-link-light [&_code]:transition-colors text-accents-6 duration-200 hover:text-accents-8 cursor-pointer"
target="_blank"
rel="noreferrer"
href="https://github.com/vercel/examples/tree/main/flags-sdk/experimentation-bucket"
href="https://github.com/vercel/examples/tree/main/flags-sdk/reflag"
>
Vercel Examples / Flags SDK / bucket
Vercel Examples / Flags SDK / Reflag
</Link>
</li>
</ul>
Expand All @@ -62,7 +62,7 @@ export function ExamplesBanner() {
<Link
data-variant="primary"
className="relative inline-flex items-center justify-center cursor pointer no-underline px-3.5 rounded-md font-medium outline-0 select-none align-middle whitespace-nowrap transition-colors ease-in duration-200 border border-solid text-background bg-success border-success-dark hover:bg-success/90 shadow-[0_5px_10px_rgb(0,68,255,0.12)] h-10 leading-10 text-[15px]"
href="https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fvercel%2Fexamples%2Ftree%2Fmain%2Fflags-sdk%2Fbucket&env=FLAGS_SECRET&envDescription=The+FLAGS_SECRET+will+be+used+by+the+Flags+Explorer+to+securely+overwrite+feature+flags.+Must+be+32+random+bytes%2C+base64-encoded.+Use+the+generated+value+or+set+your+own.&envLink=https%3A%2F%2Fvercel.com%2Fdocs%2Fworkflow-collaboration%2Ffeature-flags%2Fsupporting-feature-flags%23flags_secret-environment-variable&project-name=bucket-flags-sdk-example&repository-name=bucket-flags-sdk-example"
href="https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fvercel%2Fexamples%2Ftree%2Fmain%2Fflags-sdk%reflag&env=FLAGS_SECRET&envDescription=The+FLAGS_SECRET+will+be+used+by+the+Flags+Explorer+to+securely+overwrite+feature+flags.+Must+be+32+random+bytes%2C+base64-encoded.+Use+the+generated+value+or+set+your+own.&envLink=https%3A%2F%2Fvercel.com%2Fdocs%2Fworkflow-collaboration%2Ffeature-flags%2Fsupporting-feature-flags%23flags_secret-environment-variable&project-name=reflag-flags-sdk-example&repository-name=reflag-flags-sdk-example"
target="_blank"
rel="noreferrer"
>
Expand Down
6 changes: 3 additions & 3 deletions flags-sdk/bucket/flags.ts → flags-sdk/reflag/flags.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { bucketAdapter, type Context } from '@flags-sdk/bucket'
import { reflagAdapter, type Context } from '@flags-sdk/reflag'
import { flag } from 'flags/next'
import { identify } from './lib/identify'

export const showSummerBannerFlag = flag<boolean, Context>({
key: 'summer_sale',
adapter: bucketAdapter.featureIsEnabled(),
adapter: reflagAdapter.isEnabled(),
defaultValue: false,
identify,
})

export const showFreeDeliveryBannerFlag = flag<boolean, Context>({
key: 'free_delivery',
adapter: bucketAdapter.featureIsEnabled(),
adapter: reflagAdapter.isEnabled(),
defaultValue: false,
identify,
})
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Identify } from 'flags'
import type { Context } from '@flags-sdk/bucket'
import type { Context } from '@flags-sdk/reflag'
import { dedupe } from 'flags/next'
import { getStableId } from './get-stable-id'

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "bucket",
"name": "reflag",
"version": "0.0.0",
"private": true,
"scripts": {
Expand All @@ -9,7 +9,7 @@
"start": "next start"
},
"dependencies": {
"@flags-sdk/bucket": "link:../../../flags/packages/adapter-bucket",
"@flags-sdk/reflag": "1.0.0",
"@headlessui/react": "^2.2.0",
"@heroicons/react": "2.2.0",
"@tailwindcss/aspect-ratio": "0.4.2",
Expand All @@ -20,7 +20,7 @@
"@vercel/edge-config": "1.4.0",
"@vercel/toolbar": "0.1.33",
"clsx": "2.1.1",
"flags": "^4.0.0",
"flags": "^4.0.1",
"motion": "12.17.0",
"nanoid": "5.1.2",
"next": "15.4.0-canary.79",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.