We wanted a simple way to update application configs, without redeploying. We wanted to remotely set variables, and read them in our application. We created Varse to do this.
Varse has a dashboard for creating key - value pairs and an SDK to read them. It's un-opinionated and allows for strings, booleans, or even json objects to be stored.
We have instructions for running it yourself. We also have a hosted version where you can create an account and manage variables.
This is our first time building an open source project. We'd love feedback on how to do it right.
Github: https://github.com/varse-io/varse
Hosted Version: https://app.varse.io/signup
Website: https://www.varse.io/
Contact: [email protected]
If they are trying to say "update application configuration" but wrote "update server variable", I urge them to revise their marketing ASAP.
Have you used Feature Flags in the past? I'm curious what your experience was.
Because the unwritten rule of any API is that surely as you always use "foo" someone will want to put the first chapter of War and Peace. If nothing else, some validation for what a variableId can look like would also help consumers not have to read external documentation to know if it's [a-zA-Z0-9] or what. Even the server-side of it isn't illustrative https://github.com/varse-io/varse/blob/c14e3427138d6e70f49cf... but hey, maybe the first chapter is actually a legitimate key name for all I know https://github.com/varse-io/varse/blob/c14e3427138d6e70f49cf...
Also, we should probably put restrictions the keyname scheme. Ideally, it should be something readable.
If not, I'm not sure this brings more to the table than simple configuration changes that are rolled out through your next deployment, which should be frequent anyway, assuming you have continuous delivery.
const rollout_percent = await varse_client.getNumber('rollout_percent');
const random_number = Math.random() * 100;
if (random_number <= rollout_percent) {
// do gated action and will trigger for 1% of users when rollout_percent === 1
}
Varse seems to do the latter: https://github.com/varse-io/varse/blob/master/sdk/varse-io/s...
https://docs.statsig.com/client/introduction/ is a good example of the former; each client maintains a data and execution environment that can evaluate getVariable(variable, requestContext) entirely client-side, with full logical consistency across platforms and devices (including stable auto-assignment of user IDs to different segments for A/B tests and canary rollouts), and synchronizes that environment periodically with the server. You can also do this in-house if your configuration model is more complex, with a background thread doing a periodic fetch and setting a pointer to a data structure atomically in memory; we've built a highly custom system for this, with configurability at various levels for our various marketplace participants, with Django and Gevent.
As a developer, I don't want to worry about whether I'm accessing a variable in a hot loop and suddenly creating an N+1 request scenario. And not needing to "await" is a huge plus as well. Having a highly granular configuration system that makes each access as quick and simple as an in-memory key-value read is incredibly valuable, and the slight latency in rolling out variable changes until all clients poll for the new values is well worth it.
Your approach is still very valid, of course! It's a very reasonable approach for a lot of use cases, and keeps things simple. Excited for your launch and will keep a look out for how the product evolves!
One of the features we're excited about adding is a way to cache values locally. Having control of cache ttl and refresh intervals would be a must if we added that. You're right that the tool should just work without the developer worrying about affecting latency.
The main problems I have with these kind of solutions are :
- Having to make an HTTP request to get a variable (or multiple ?) for my local function to do its job. And that's a clear no-go for me, in terms of latency
- Having variables stored "somewhere else" complexifies the rollout of new features introducing new "variables", as one needs to update the external tool (here Varse), to create this variable
- Overtime, you end up with a big bag of obsolete variables that are not used anymore by the main application because you forget to remove them
The usual combo "Environment Variable / Restart" proposed by most PaaS offerings will be hard to fight IMO.
In any case, good luck with this project.
There are already several good open source and commercial flag systems[1], some of which have SDKs for many different server-side and client-side languages, e.g. Growthbook[2].
At its most basic, a feature flag client SDK lets you evaluate a variable instantly, without blocking/async, because the variable was already fetched and cached when your app started up. The SDK also maintains an ongoing background mechanism of some kind to keep that cache updated with changes from the server; the most popular method is polling (i.e. re-fetch the variables every X seconds) but a more effective way is to keep a single long-lived HTTP connection open to the server and listen for Server-Sent Events. The SDK should also, ideally, emit in-app events whenever changes arrive.
Targeting rules are what make feature flags much more useful: they allow you to define logic that changes the evaluation of a flag depending on context. For example: enabling new features or new code versions depending on who the current user is, or which server is handling the request, or the current time of day. Sure, this is all logic you could do in code, but then every change to that logic requires an update and restart. Having the logic stored and communicated with the flag gives you a separate level of control that's much easier and faster to change.
So yeah, what you're doing here is creating yet another feature flag system. Even if you're saying "but this is meant for simpler stuff" I would honestly just go with an existing, somewhat mature system like Posthog or Growthbook than invest any more engineering time in this, unless you have major use cases in mind that they don't support - and even then, I would be careful. Simplicity alone does not give you any real advantage that is worth the effort.
[1] https://github.com/andrewdmaclean/awesome-feature-flag-manag...