How to choose a license for your first open-source project
Putting code on a public repository without a license doesn't make it open source. By default, copyright law means others can't legally reuse it. Adding a license is a simple step that makes your intentions clear.
Ask yourself what you want
- "Anyone can use it for anything, just keep my name on it." A permissive license like MIT or BSD. Short, simple, very popular.
- "Permissive, but with clearer patent terms." Apache 2.0 is permissive and includes an explicit patent grant, which some companies prefer.
- "If people distribute modified versions, they must share their changes under the same terms." A copyleft license like GPL. The LGPL or MPL are weaker copyleft options often used for libraries.
- "Even if people run it as a web service, they must share changes." The AGPL extends copyleft to network use.
Practical tips
- Check your dependencies. Their licenses may affect what you can choose.
- Match the ecosystem. Many communities lean toward particular licenses, which makes adoption easier.
- Add a LICENSE file at the root of the repository. Hosting sites can generate one from templates.
- Don't write your own license. Custom licenses create confusion and legal uncertainty.
- For non-code content like docs or art, Creative Commons licenses are common.
This is general information, not legal advice. For business-critical projects, consult someone qualified.
Which license did you choose for your first project, and why? Did you ever change your mind later?
Comments · 4
MIT or Apache 2.0 for most small projects. Apache adds a patent grant, which matters more than people expect.
What happens if I add a license later after people already forked it? Does it apply retroactively?
Not retroactively for old copies. Anyone who already forked it without a license is in a gray area, so add one early.
choosealicense.com will walk you through it in a minute. Don't skip adding a LICENSE file.