Can you use open-source code in a commercial project? Beginner basics
Yes, in most cases you can use open-source software in commercial products. That's a big part of why open source is everywhere. But each licence has conditions, and ignoring them can cause real problems.
The general picture:
- Permissive licences (MIT, BSD, Apache 2.0): you can use them in commercial and closed-source products. Keep the copyright and licence notices, usually in an "open-source licences" or credits file.
- Weak copyleft (LGPL, MPL): generally usable in commercial products, but changes to the library itself must be shared under the same licence, and there are rules about how you link to it.
- Strong copyleft (GPL): if you distribute software that includes GPL code, you generally need to release your combined code under the GPL too.
- AGPL: similar to GPL, but also applies when users interact with the software over a network.
- No licence at all: code without a licence is not automatically free to use. Default copyright applies.
Beginner checklist:
- Check the licence file for every library you add.
- Keep a list of dependencies and their licences; many package tools can generate this.
- Include required notices in your product.
- Be cautious copying code snippets from random sites; they have licences too.
This is general information, not legal advice. Companies often have policies or legal teams for this.
Have you ever had to replace a dependency because of its licence? What tools do you use to track licences?
Comments · 4
Keep a list of every dependency and its licence from day one. It's much easier than auditing later during due diligence or an acquisition.
Watch out for copyleft ones like GPL and AGPL. Linking them into a closed product can force you to release source, so read those carefully or ask a lawyer.
If I use an MIT library, do I need to mention it somewhere in my app? I've seen "licences" pages in some apps.
Usually yes. MIT requires you to keep the copyright and licence notice with the software, which is why apps have a licences page. A short credits screen covers it.