← All posts

Hiding Pro in Plain SightPaid Features in an Open Source App

18th August, 2026
// src/bootstrap/proStub.js
module.exports = null;

That is the most important file in our open source repo, and it does nothing. Off Grid is open source: anyone can clone it, read every line and build it. We also sell Pro. This one-line file is how both can be true. When you build the app without our private code, every reference to Pro quietly resolves to null, and you get the full free app. This post is how we got there: three plans on paper, a folder that lived for one day, a seam that grew, and the CI and test bugs that only show up when part of your code is invisible.

Foundation : the three rules

Before any code, we wrote down what had to be true:

So where does the private code live, and how does the public code call it without knowing it exists?

Three plans on paper

We chose the third: Pro is a separate package that sits next to the app and plugs into it. The public code never imports a Pro file and never asks "is this Pro?". There's a well-known precedent: Sentry's private getsentry repo overlays its open source sentry repo the same way.

9 June : a folder next door

The first version put Pro in a sibling folder, ../offgrid-pro, beside the app. Metro (the JS bundler) was told to look there. It worked on one laptop. It did not work for a teammate, a CI runner or anyone who wanted the exact Pro code that went with a given app commit. A folder next door has no version.

The stub still says so. Its comment reads "when ../offgrid-pro is absent", a fossil from a layout that lived for one day.

10 June : a submodule

The next day Pro moved into a git submodule at pro/. A submodule is a pointer: "this folder is that repo, at this commit". Every app commit now names the exact Pro commit it needs. A stranger's clone sees the pointer, can't fetch a private repo, and gets an empty folder.

Same repo, same commit. The only difference is what sits inside pro/.

The move came with the most important line in the whole setup. An uninitialised submodule still leaves the folder, so "does pro/ exist?" is always yes. You have to check for a real file inside it:

// metro.config.js (10 June)
-const proPackagePath = path.resolve(__dirname, '../offgrid-pro');
+const proPackagePath = path.resolve(__dirname, 'pro');
-const proExists = fs.existsSync(proPackagePath);
+// pro/ is a git submodule: the directory exists even when not checked out
+const proExists = fs.existsSync(path.resolve(proPackagePath, 'package.json'));

The pointer itself moved three times in three weeks, as the private repo changed owners. One commit message says the old URL was simply "wrong, won't clone".

Six tools, one question

Every tool that touches our code asks "is Pro really here?" before using it, and falls back on its own when it isn't:

The seam : sockets, not imports

Think of the app as a house with sockets in the walls: a screen registry, a settings registry, a tool registry, UI slots and hooks. The house works with nothing plugged in. Pro is a box of appliances. At boot, it plugs itself in.

Core shows where features can go. Only Pro knows what they are.

The sockets grew as Pro did. On 9 June there were 3 registries. On 19 June we added slots (named places in the UI) and hooks (named moments in the app's life), and today there are 5 registries, about 10 slots and 11 hooks. Pro makes about 40 registration calls through them. The public code doesn't know what any of them are.

The order of the handshake changed too. The first version activated Pro first and checked the licence after. That's backwards: for a moment, unpaid features were live. Now the check comes first, and unpaid features never register:

// src/bootstrap/loadProFeatures.ts (trimmed)
-  pro.activate({ registerToolExtension, registerScreen, registerSettingsSection });
-  await refreshProStatus();
+  const active = isPro ?? (await readProFromKeychain());
+  if (!active) return;            // paid features stay dormant
+  pro.activate({ registerToolExtension, registerScreen,
+                 registerSettingsSection, registerSlot, registerHook });

Designs we talked ourselves out of

A plug-in system invites over-engineering. We wrote a design doc, and it mostly says no:

One of our own reversals is worth telling. Reviewers flagged that running activate twice registered screens twice. We added de-duplication, then reverted it a day later because "React Navigation handles duplicate screen registrations". Twelve days later we put it back: duplicate route names "crashed the navigator". Trust the crash, not the assumption.

The native half

Pro also ships Kotlin and Swift. React Native links native code automatically, so core needs one guarded entry. The split that matters: the public file says only where Pro is. Pro's own config says what it contains.

Our first version of this file put Pro's package details in the public config. It worked, but a public file was describing private code. On 7 August we moved those details into Pro's own config, so the public file now names nothing but a folder. The iOS pod followed a few days later.

What broke when part of the code is invisible

The architecture held up. The tooling around it is where we lost days. Every one of these was a check that quietly saw less than we thought:

CI : two builds from one repo

Pull requests from the public, including forks, build the free app: no Pro code, no token. Pushes to our own branches also build the Pro app, with a read-only token held in a protected environment. If the token is missing, the Pro build fails loudly instead of quietly building the free app and calling it Pro.

The part that isn't code

Open core has a social side, and our users told us about it directly:

"The introduction of 'pro' version … added lots of nagscreens … Luckily, it's all open source, so there's a chance of a decent fork."

GitHub issue #23 · July

Our reply on that thread was a promise we intend to keep: "I'll keep open sourcing the older pro features." That fork is exactly what this architecture allows. Everything in the public repo builds and runs.

What it costs

Two repos means two pull requests for a feature that spans both, and every Pro change needs a commit in the app that moves the pointer. We made 48 of those "bump the submodule" commits between mid-June and mid-August. That's the price: one public app anyone can build, one private package only we can, and a seam that is just a handful of sockets.

What we took away