├── packages ├── dashboard │ ├── src │ │ ├── lib │ │ │ ├── enviroment-store.ts │ │ │ ├── database-store.ts │ │ │ └── countries.ts │ │ ├── app │ │ │ ├── favicon.ico │ │ │ ├── globals.css │ │ │ ├── layout.tsx │ │ │ └── page.tsx │ │ ├── server │ │ │ └── credentials.ts │ │ ├── components │ │ │ ├── input-label.tsx │ │ │ ├── add-flag.tsx │ │ │ ├── empty.tsx │ │ │ ├── rename-flag-modal.tsx │ │ │ ├── flag-dropdown.tsx │ │ │ ├── select-db.tsx │ │ │ ├── add-db-modal.tsx │ │ │ ├── flag-rules.tsx │ │ │ └── flag.tsx │ │ ├── api │ │ │ ├── query-client.ts │ │ │ └── flags.ts │ │ └── hooks │ │ │ └── use-redis.tsx │ ├── .eslintrc.json │ ├── next.config.mjs │ ├── CHANGELOG.md │ ├── postcss.config.mjs │ ├── tailwind.config.ts │ ├── README.md │ ├── .gitignore │ ├── tsconfig.json │ ├── prettier.config.mjs │ ├── package.json │ └── bin.cjs └── sdk │ ├── src │ ├── version.ts │ ├── environment.ts │ ├── index.ts │ ├── types.ts │ ├── flag.ts │ ├── cache.ts │ ├── evaluation.ts │ ├── middleware.ts │ ├── client.ts │ ├── hook.ts │ ├── admin.test.ts │ ├── handler.ts │ ├── rules.ts │ ├── admin.ts │ └── rules.test.ts │ ├── jest.config.js │ ├── tsup.config.js │ ├── CHANGELOG.md │ ├── package.json │ └── tsconfig.json ├── img ├── flag.png ├── simple.png ├── with-cdn.png └── edge-flags │ ├── flag.png │ ├── rule.png │ ├── context.png │ ├── created.png │ ├── simple.png │ ├── with-cdn.png │ ├── countries.png │ └── percentage.png ├── pnpm-workspace.yaml ├── examples ├── middleware-rewrites │ ├── app │ │ ├── page.tsx │ │ ├── blocked │ │ │ └── page.tsx │ │ └── layout.tsx │ ├── public │ │ ├── favicon.ico │ │ ├── vercel.svg │ │ ├── thirteen.svg │ │ └── next.svg │ ├── next.config.mjs │ ├── README.md │ ├── CHANGELOG.md │ ├── .gitignore │ ├── package.json │ ├── tsconfig.json │ └── middleware.ts └── nextjs │ ├── public │ ├── favicon.ico │ └── vercel.svg │ ├── next.config.js │ ├── next-env.d.ts │ ├── CHANGELOG.md │ ├── styles │ ├── globals.css │ └── Home.module.css │ ├── app │ ├── layout.tsx │ ├── api │ │ └── edge-flags │ │ │ └── route.ts │ └── page.tsx │ ├── .gitignore │ ├── README.md │ ├── package.json │ └── tsconfig.json ├── .github ├── dependabot.yml └── workflows │ └── changeset.yml ├── .changeset ├── config.json └── README.md ├── turbo.json ├── .gitignore ├── rome.json ├── cmd └── set-version.js ├── package.json ├── docs ├── percentage.md ├── react.md ├── overview.md ├── environments.md ├── getstarted.md └── rules.md └── README.md /packages/dashboard/src/lib/enviroment-store.ts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/sdk/src/version.ts: -------------------------------------------------------------------------------- 1 | export const VERSION = "development"; 2 | -------------------------------------------------------------------------------- /img/flag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upstash/edge-flags/main/img/flag.png -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - "packages/*" 3 | - "examples/*" 4 | -------------------------------------------------------------------------------- /img/simple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upstash/edge-flags/main/img/simple.png -------------------------------------------------------------------------------- /img/with-cdn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upstash/edge-flags/main/img/with-cdn.png -------------------------------------------------------------------------------- /packages/dashboard/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "next/core-web-vitals" 3 | } 4 | -------------------------------------------------------------------------------- /img/edge-flags/flag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upstash/edge-flags/main/img/edge-flags/flag.png -------------------------------------------------------------------------------- /img/edge-flags/rule.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upstash/edge-flags/main/img/edge-flags/rule.png -------------------------------------------------------------------------------- /img/edge-flags/context.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upstash/edge-flags/main/img/edge-flags/context.png -------------------------------------------------------------------------------- /img/edge-flags/created.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upstash/edge-flags/main/img/edge-flags/created.png -------------------------------------------------------------------------------- /img/edge-flags/simple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upstash/edge-flags/main/img/edge-flags/simple.png -------------------------------------------------------------------------------- /img/edge-flags/with-cdn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upstash/edge-flags/main/img/edge-flags/with-cdn.png -------------------------------------------------------------------------------- /img/edge-flags/countries.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upstash/edge-flags/main/img/edge-flags/countries.png -------------------------------------------------------------------------------- /img/edge-flags/percentage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/upstash/edge-flags/main/img/edge-flags/percentage.png -------------------------------------------------------------------------------- /examples/middleware-rewrites/app/page.tsx: -------------------------------------------------------------------------------- 1 | export default function Home() { 2 | return
No databases added yet
22 | 23 | } 24 | > 25 |Error {error}
; 25 | } 26 | 27 | if (loading) { 28 | returnLoading...
; 29 | } 30 | 31 | returnFlag is {isEnabled ? "enabled" : "disabled"}
; 32 | }; 33 | ``` 34 | 35 | ## Custom Attributes 36 | 37 | You can use custom attributes to enable a flag for a subset of users. For 38 | example, you can identify users by `userId` or `email`. 39 | 40 | To set attributes, you can pass an object to the `useFlag` hook. 41 | 42 | ```tsx 43 | import { useFlag } from "@upstash/edge-flags"; 44 | 45 | const { isEnabled } = useFlag("my-flag", { 46 | userId: "chronark", 47 | email: "andreas@upstash.com", 48 | }); 49 | ``` 50 | -------------------------------------------------------------------------------- /docs/overview.md: -------------------------------------------------------------------------------- 1 | # Overview 2 | 3 | Edge Flags is a low latency feature flagging solution running at the edge and 4 | storing data in a global Redis database. It is designed to be used with 5 | [Next.js](https://nextjs.org) and [Vercel](https://vercel.com) but we will soon 6 | roll out support for other popular frameworks and platforms. Let us know what 7 | you are looking for! 8 | 9 | You can find the Github Repository [here](https://github.com/upstash/edge-flags). 10 | 11 | ## Features 12 | 13 | - **Global Low latency:** Flags are stored in a global Redis database and are 14 | evaluated at the edge. 15 | - **Environments:** Flags have different environments to support your deployment 16 | process: `production`, `preview`, `development` 17 | - **Flexible:** Flags support geo targeting, percentage based rollouts and 18 | custom attributes 19 | - **Manage:** Flags can be created and managed using the SDK or the self-hosted [dashboard](https://github.com/upstash/edge-flags/tree/main/packages/dashboard). 20 | - **Free:** Edge Flags is free to use. You only pay for the Redis database. 21 | - **Cache:** Flags can be cached for a short period of time to reduce the 22 | required requests to redis, making it cheaper to use. 23 | 24 |
63 | {targetEnv}
64 | {" "}
65 | will overwrite any existing configuration.
66 |