I created a startup to fund my nearly abandoned 2.6k star Open Source project and others like it
Tags: opensource, npm, javascript, git
Published: 2019-11-30 23:05:00

I maintain a fairly popular open source project called [Disk](https://github.com/saoudrizwan/Disk) that helps iOS developers work with the iPhone’s filesystem. I had to learn the inner workings of obscure iOS frameworks and build Disk around Apple’s exhaustive storage guidelines involving user privacy and iCloud backup behavior — all appropriately handled behind Disk’s simple API, saving tons of iOS developers from having to understand it all themselves. Unfortunately after moving out to California and getting a full time job I found myself committing less time to open source and no one I trusted was willing to take over the project. I also realized that other OSS maintainers faced the same problems (see [event-stream](https://github.com/dominictarr/event-stream/issues/116#issuecomment-440927400)) so a few months later I launched [GitRoyalty](https://gitroyalty.com/) — a new solution to open source sustainability using a git-based paywall.

GitRoyalty is a platform that allows OSS project maintainers to hide a package’s manifest or build script (e.g. package.json) behind a monthly subscription. This way users will have to subscribe in order to use dependency managers (like NPM or pip that require the manifest) to install the package into their projects. Alternatively, instead of hiding the manifest/build script, you could even use GitRoyalty to hide good-to-have files that aren’t required to use the project (e.g. in-depth documentation/guides/examples or extra source code). This way users are incentivized to subscribe but not forced to.

The idea is that with *low prices* and the *power of numbers*, both popular and transitive OSS dependencies can sustain development while keeping licensing permissive. Most employment contracts strictly forbid using OSS with copyleft/commercial/dual licensing — resulting in most commercial projects having to switch to permissive licensing to keep developers out of trouble. Now GitRoyalty can provide these projects an avenue for income without imposing dysfunctional licensing structures.

GitRoyalty also distributes subscription earnings to all contributors of a project, which will hopefully incentivize more developers to collaborate on OSS projects instead of creating issues for bugs, feature requests, or security vulnerabilities and putting the burden on overworked maintainers’ shoulders.

## Using GitRoyalty with Disk

### 1. Follow GitRoyalty’s docs to add paywall to Disk

After following the ‘[Configure a project with GitRoyalty](https://gitroyalty.com/docs/guides/configure-a-project)’ doc, Disk’s repository looked just like before, with one exception: the Package.swift manifest file became a symlink linked to the original file hidden in a private git submodule `.gitroyalty` that the general public has no access to (clicking on it will 404). This way SPM (Swift’s dependency manager) would throw an error if someone tried to install it as is, since it requires the Package.swift file to exist properly.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/pszc9f58vpq5x7h4229e.png)

After [publishing a release](https://gitroyalty.com/docs/guides/configure-a-project#publish-a-release) and setting the subscription price, GitRoyalty created a payment page for Disk at a URL that mirrors Disk’s GitHub URL:

[https://gitroyalty.com/saoudrizwan/Disk](https://gitroyalty.com/saoudrizwan/Disk)

Here users can subscribe and install a complete version of Disk with the Package.swift file included just like before. This effectively means dependency managers can’t install Disk from GitHub, but can install it from GitRoyalty *after subscribing*.

Once users set up an Individual or Team subscription, they are given a license key which is used to install the package with their dependency manager. For NPM packages, you would see instructions like:
```
npm i git+https://<license>@gitroyalty.com/user/repo#semver:^2.0.1
```
GitRoyalty provides installation templates for git, JavaScript NPM, iOS CocoaPods, Swift Package Manager, Python pip, Ruby gem, Java Gradle, PHP Composer, Go dep, Elixir Hex, and Rust Cargo.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/cqqgaim0hsgtv9r358m1.gif)

The barrier to subscribe and install a package is quite low, especially after adding a payment method once. Login with GitHub, hit Subscribe, install. All subscriptions come with a 2 week free trial and are charged in aggregate the 1st of every month to keep processing fees low.

### 2. Update README with GitRoyalty’s Subscribe button and badge

Now that I’d finished setting up Disk with GitRoyalty, I needed to let contributors and consumers know of the changes. I posted about it on social media and emailed contributors to create an account on GitRoyalty to claim their portion of subscription proceeds.
GitRoyalty also provides markdown snippets for you to copy & paste into your repository’s README to direct users to your payment page. Here’s how they look in Disk’s README:

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/ts1c647ywqmxgu1pqd3s.png)
*The subscription count and price are dynamically inserted into these SVGs and will always be up to date.*


## The Results
In less than a week Disk got almost 60 subscriptions, generating more money than I’d ever hope to get from donations. I’ve also received several emails from eager developers asking how they’ll earn money if they contribute to the project. As I release more updates to Disk I hope to get more subscribers to sustain development and bring on more contributors to reach project milestones faster.

## Conclusion
I hope my [moderate] success with Disk can show what’s possible for even greater open source projects. One thing is clear — people are willing to pay for something if it has value to them, which most OSS does. There’s just never been a practical incentive to pay before.
It’s my hope that others can use GitRoyalty to begin solving big problems we face in open source like supply/demand imbalance, project abandonment, transitive dependency funding, and maintainer burnout.
Thanks for reading and feel free to reach out to me on Twitter, email, or chat with me live on gitroyalty.com!