๐Ÿ“œ Alin Li ยท Chapter 13

Open Source Licenses
Explained for Humans

Licenses are the rules of sharing. They're not scary โ€” they're your superpower! Learn which one to use, what they allow, and why they matter.

What Are Licenses? ๐Ÿ“– Help Me Choose ๐Ÿงญ
๐Ÿ“– THE BASICS

What Is a Software License?

Think of it as the rules that come with sharing your creation.

๐Ÿฐ The Cake Analogy

Imagine you bake an amazing cake and want to share the recipe. A license is like a little note you attach that says what others can do with it:

๐Ÿ”’
No License

"I'm not sharing the recipe. You can only eat the cake I give you."

๐Ÿ“‹
MIT License

"Here's the recipe! Do whatever you want โ€” just mention I made it."

๐Ÿ”„
GPL License

"Here's the recipe! If you change it, you MUST share your version too!"

๐Ÿ›ก๏ธ
Apache License

"Here's the recipe! Use it freely, and I promise not to sue you."

โš ๏ธ Why Licenses Matter

Without a license, your code is NOT open source โ€” even if it's on GitHub! By default, copyright law means "all rights reserved." A license is what officially gives people permission to use, modify, and share your work. No license = no one can legally use your code.

โš–๏ธ THE BIG FIVE

The Most Important Open Source Licenses

These 5 licenses cover 95% of all open-source projects.

๐Ÿ“˜

MIT License

The most popular license in the world โ€” simple and free!

In plain English: "Do whatever you want with my code. Just keep my name on it. I'm not responsible if something breaks."

The MIT License is the simplest and most permissive open-source license. It's just 170 words long! It lets anyone use, copy, modify, merge, publish, distribute, and even sell your code โ€” as long as they include your original copyright notice.

โœ… Use commercially
โœ… Modify freely
โœ… Distribute
โœ… Use in closed-source projects
โŒ No warranty
โšก Must include license text
Who uses MIT?

React (Meta), VS Code (Microsoft), jQuery, Ruby on Rails, Node.js, Bootstrap, Electron, and thousands more. It's the #1 most popular license on GitHub!

// The entire MIT License is just this:
Copyright (c) [year] [your name]

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software... to deal in the Software
without restriction... subject to the following conditions:

The above copyright notice shall be included in all copies.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
๐Ÿ“•

GPL (GNU General Public License)

The "share-alike" license โ€” keep it free, forever!

In plain English: "Use my code freely. But if you change it and share it, you MUST share YOUR code under GPL too. No one can make it closed-source."

Created by Richard Stallman, the GPL is the "copyleft" license. Its key rule: if you use GPL code in your project and distribute it, your entire project must also be GPL. This ensures the code stays free forever โ€” no company can take it, close it, and sell it.

โœ… Use commercially
โœ… Modify freely
โœ… Distribute
โŒ Can NOT make it closed-source
โšก Must share your changes under GPL
โšก Must include source code
Who uses GPL?

Linux kernel, WordPress, GIMP, Blender, GCC, Bash, and many core free software projects. If it's part of the GNU project, it's GPL!

โš ๏ธ The "viral" effect: If you use GPL code in your app, your WHOLE app must become GPL. This is why some companies avoid GPL โ€” they don't want to open their code. But this is exactly what GPL was designed to do: keep software free forever.

๐Ÿ“—

Apache License 2.0

Like MIT, but with patent protection built in!

In plain English: "Use my code freely, even in commercial products. Plus, I promise not to sue you over any patents in this code. If someone changes it, they must note what they changed."

Apache 2.0 is similar to MIT but adds two important things: patent protection (the author grants you a license to use any patents in the code) and change documentation (modified files must say they were changed).

โœ… Use commercially
โœ… Modify freely
โœ… Use in closed-source
โœ… Patent protection
โšก Must include license + NOTICE file
โšก Must note changes to files
Who uses Apache 2.0?

Android (Google), Kubernetes, TensorFlow, Swift (Apple), Apache HTTP Server, Kafka, Hadoop. Preferred by big companies because of the patent clause!

๐Ÿ“˜

BSD License (2-clause & 3-clause)

The original academic freedom license

In plain English: "Do what you want. Keep my copyright notice. Don't use my name to promote your version." Very similar to MIT but from the academic world (Berkeley).

BSD came from the University of California, Berkeley. The 2-clause version is almost identical to MIT. The 3-clause adds a "no endorsement" rule: you can't say "Berkeley approves this" unless they actually do.

โœ… Use commercially
โœ… Modify freely
โœ… Use in closed-source
โšก Keep copyright notice
โšก No endorsement (3-clause)
Who uses BSD?

FreeBSD, OpenBSD, NetBSD operating systems, Nginx, PostgreSQL (similar), and many university research projects. macOS and PlayStation OS are based on BSD!

๐Ÿ“™

Creative Commons (CC)

Not for code โ€” for everything else! Art, music, writing, teaching.

In plain English: "Creative Commons is for non-code content: images, music, videos, documents, teaching materials. You choose the rules using simple building blocks!"

CC licenses use a mix-and-match system with 4 building blocks:

๐Ÿ‘ค
BY (Attribution)
Must give credit
๐Ÿ”„
SA (Share-Alike)
Same license for remixes
๐Ÿšซ
NC (Non-Commercial)
No making money
๐Ÿ”’
ND (No Derivatives)
No changes allowed

The most open CC license is CC0 (public domain โ€” no restrictions at all!) and CC BY (just give credit). Wikipedia uses CC BY-SA.

Who uses CC?

Wikipedia (CC BY-SA), Khan Academy, Flickr photos, MIT OpenCourseWare, many YouTube creators, and this Alin Li course! CC is the standard for open educational resources.

๐Ÿ“Š SIDE BY SIDE

License Comparison Table

See all licenses at a glance!

Feature MIT GPL v3 Apache 2.0 BSD
Commercial useโœ… Yesโœ… Yesโœ… Yesโœ… Yes
Modify & distributeโœ… Yesโœ… Yesโœ… Yesโœ… Yes
Use in closed-sourceโœ… YesโŒ No!โœ… Yesโœ… Yes
Must share changesโŒ Noโš ๏ธ YES!โŒ NoโŒ No
Patent protectionโŒ Noโœ… Yesโœ… YesโŒ No
Keep copyright noticeโœ… Yesโœ… Yesโœ… Yesโœ… Yes
Note changesโŒ Noโœ… Yesโœ… YesโŒ No
ComplexitySimpleComplexMediumSimple
Length~170 words~5,600 words~4,200 words~200 words
Best for...Maximum freedomKeeping code free foreverEnterprise + patentsAcademic projects
๐Ÿงญ INTERACTIVE

Which License Should YOU Use?

Answer 3 questions and we'll recommend the perfect license!

๐Ÿงญ License Chooser

1๏ธโƒฃ Can companies use your code in closed-source (proprietary) products?
2๏ธโƒฃ Do you want patent protection?
3๏ธโƒฃ How simple do you want the license to be?
๐Ÿ› ๏ธ HOW-TO

How to Add a License to Your Project

It takes literally 2 minutes!

1

Go to choosealicense.com

GitHub's tool makes it easy to pick the right license with a comparison.

2

Create a LICENSE file

In the root of your project, create a file named LICENSE or LICENSE.md

3

Paste the license text

Copy the full license text and replace [year] and [author] with your information.

4

Done! You're open source! ๐ŸŽ‰

GitHub will automatically detect your license and show a badge on your repo. On GitHub, you can even add a license when creating a new repo โ€” just select it from the dropdown!

๐Ÿง  TEST YOURSELF

License Quiz!

Let's see if you understood the licenses!

1. If code has NO license on GitHub, can you use it?

2. Which license forces you to share your changes under the same license?

3. Which license gives you patent protection?

4. What does "copyleft" mean?

5. Which license is best for a school project you want everyone to use freely?

6. Creative Commons licenses are best for...