I've open-sourced several projects. Each time, the hardest decision wasn't what to build - it was how to license it. This post is about the licensing mistakes I made, the decisions that worked, and how I think about open source licensing now.
The Default Trap: MIT for Everything
When I first started publishing code, I slapped MIT on everything. It's the default choice. It's permissive. GitHub suggests it. What could go wrong?
What went wrong: someone took code from one of my projects, built a commercial product on top of it, and sold it. Legally, they were within their rights. The MIT license explicitly allows this. But it felt wrong - I'd spent months on that code, and someone was profiting from it without contributing anything back.
This isn't a criticism of MIT. It's the right license for many situations. But it's not the right license if you care about how your code is used commercially.
Choosing CC BY-NC-SA
For several of my projects, I switched to Creative Commons Attribution-NonCommercial-ShareAlike (CC BY-NC-SA). This license allows:
- Sharing and adapting - anyone can use, modify, and redistribute
- Attribution - they must credit the original author
- NonCommercial - they can't use it for commercial purposes without permission
- ShareAlike - derivatives must use the same license
The NonCommercial clause was the key. It lets individuals, students, and hobbyists use the code freely while requiring commercial users to get a separate license.
The Dual Licensing Model
The natural extension of CC BY-NC-SA is dual licensing:
- Open source license (CC BY-NC-SA) for non-commercial use
- Commercial license for businesses that want to use the code in commercial products
This model is well-established in the industry - MySQL, Qt, and many others use variations of it. The open source version drives adoption and community. The commercial license generates revenue.
At HMD Developments, we use this model for several internal tools we've published. The open source version is full-featured. The commercial license adds support, priority bug fixes, and the legal right to use it in commercial products.
Lessons I Learned
1. Choose Your License Before Writing Code
The license affects your contributor agreements, your partnership options, and your exit strategy. Deciding after the fact - especially if you have contributors - creates legal complexity.
2. CC Licenses Aren't Ideal for Software
This is a nuance I learned too late. Creative Commons explicitly states that their licenses aren't designed for software - they're designed for creative works. For software, they recommend using licenses like GPL, LGPL, or AGPL instead.
CC BY-NC-SA works for my use case because my projects include significant creative content alongside code. But for pure software, a purpose-built software license is better.
3. AGPL for SaaS Protection
If your open source project could be deployed as a service (SaaS), consider AGPL. It requires that anyone who runs a modified version of your software as a service must also open-source their modifications. This prevents the "cloud loophole" where companies take open source code, run it as a service, and contribute nothing back.
4. CLA Matters for Future Flexibility
A Contributor License Agreement (CLA) ensures that you retain the ability to change the license in the future. Without a CLA, every contributor retains copyright over their contributions, and changing the license requires unanimous consent from all contributors.
The Human Side
Open source licensing isn't just legal - it's philosophical. Every license represents a set of values:
- MIT/BSD: Maximum freedom. Build whatever you want.
- GPL/AGPL: Freedom with responsibility. If you benefit, share back.
- CC BY-NC-SA: Freedom for the community. Commerce requires partnership.
There's no universally right answer. But there is a personally right answer - and it depends on what you're trying to achieve with your code.
I open-source code because I believe in knowledge sharing. But I also run a business. Dual licensing lets me do both without feeling like I'm giving away the store.
Choosing a license? Start by asking: "If a company uses this code to make money, how do I want that to work?" Your answer will guide the rest.