Show HN: next-flag ∙ Feature flags by GitHub Issues and NextJS

by linesofcodeon 5/27/2024, 11:22 AMwith 2 comments

I built a package that provides a feature-flag service powered entirely by GitHub issues and NextJS.

Define a list of app features and environments in an issue description, then simply toggle a feature on/off by ticking a checkbox - without having to redeploy your app.

It can be used directly inside a NextJS app or be deployed as a standalone service and consumed by any client over HTTP. Plus it supports react server-side components right out of the box.

The architecture leverages GitHub Webhooks to invalidate the NextJS cache whenever there is a change. The next time a user reloads a page in their NextJS app the cache is repopulated with the latest enabled features by sending a request to GitHub.

Features:

- Define feature flags across multiple environments or branches.

- Supports React Server Side and Client Side Components. Powered by the NextJS Cache.

- Define custom conditions that are evaluated at runtime to enable or disable features.

- Can be deployed as a stand-alone service to manage feature flags for multiple NextJS apps.

- Totally free. Unlimited projects, features and environments.

How does it work?

1. Define a list of features using Markdown in a Github Issue.

2. Configure a Github Webhook that hits your self-hosted `/api/next-flag` route when a feature is toggled and invalidates the NextJS cache.

3. Consume the `next-flag` package anywhere in your code. Features are fetched once and cached. Supports React Server Side Components, React Hooks, or simply send an HTTP GET request to `/api/next-flag`.

by ataschzon 5/29/2024, 3:12 PM

Hey, this looks great! I'm going to try it