Feature flags for solo developers: ship unfinished work safely
George · 2 min read
The short answer: a feature flag is a switch in your code that decides whether a feature is shown. It lets you deploy unfinished work without users seeing it, try it in production yourself, then turn it on for a few users and finally everyone. For a small product, a simple setting in your database or config is enough; you do not need a big tool.
Solo developers often keep features in long-lived branches until they are "done". Those branches drift from the main code, get painful to merge, and delay everything else. Flags let you ship in small pieces instead.
How a flag works
At its simplest:
if (flags.newEditor) show the new editor, otherwise show the old one
The flag's value comes from somewhere you can change without deploying: an environment variable, a row in your database, or a setting in an admin page.
What flags are good for
- Merging early. Put half-built code behind a flag that is off. Your main branch stays deployable.
- Testing in production. Turn a feature on only for your own account and try it with real data.
- Gradual rollout. Turn it on for a few users, watch for errors, then for everyone.
- A quick off switch. If a new feature misbehaves, turn it off in seconds instead of rushing a fix.
A simple setup for a small product
- Keep a small table or document of flags with a name and an on or off value.
- Allow a list of user ids that always see a feature, for you and early testers.
- Read flags on the server where possible, so users can not turn features on from the browser.
- Give flags clear names, like new-invoice-editor, not test2.
Clean up
Flags left in the code forever make it hard to read and test. When a feature is fully rolled out, remove the flag and the old code path. A short "flags to remove" note in your project helps.
What not to hide behind a flag
Flags are not a security boundary. Anything users must not access needs real permission checks on the server, not just a hidden button. Also be careful with database changes: a new column or table is usually shipped first, then the feature that uses it.
The short version
- A flag is a switch that turns a feature on or off without a deploy.
- Use it to merge early, test in production, roll out gradually and switch off fast.
- A simple table with on, off and a list of user ids is enough.
- Remove flags once a feature is fully live.
- Never rely on a flag for security.
