You found some code on GitHub. Can you use it in your own AI app? Just because code is publicly available and free to view doesn't mean you can do absolutely anything with it.

When building an app at an AI hackathon, we don't necessarily write every line of code from scratch.

We might use a convenient library or refer to a sample project published on GitHub. These days, an AI coding assistant might even add a library to a project while we're letting it handle the development, without us noticing right away.

Since I started building apps and web services with AI, I've been using GitHub more and more.

That raised a question for me.

If anyone can view code on GitHub, am I free to use it in my own app?

A project might be just a prototype on hackathon day. But we might keep developing it afterward, or eventually turn it into a paid service. The conditions attached to code we use could matter later.

So I decided to look into three common licenses: MIT, Apache, and GPL.

Public on GitHub Doesn't Mean Free to Copy However You Like

The first distinction to understand is that a public repository and open-source software are not the same thing.

Making a GitHub repository public allows other people to see its code. Under GitHub's terms, people can also view and fork public repositories through GitHub.

But that doesn't automatically grant permission to take the code, incorporate it into your own product, and sell that product.

According to GitHub's documentation, when no license is provided, ordinary copyright law generally applies. The copyright holder retains their rights, so you shouldn't assume that copying, modifying, and redistributing the code is permitted.

Separate permission from the rights holder or an applicable copyright exception could change the situation, of course. But not finding a LICENSE file doesn't mean the code is free for anyone to use however they want.

Where Do You Find the LICENSE File?

A GitHub repository may include a file called LICENSE, LICENSE.md, or LICENSE.txt.

It explains what you're allowed to do with the code and what conditions you need to follow.

You might see identifiers like these:

  • MIT
  • Apache-2.0
  • GPL-3.0
  • AGPL-3.0

These short identifiers are also used by SPDX, a standard system for naming licenses.

One thing to watch out for: a whole repository doesn't necessarily have a single license covering everything. The code and images might be licensed differently. Certain folders or third-party libraries might have their own terms, too.

Even if a README says "Free," you still need to work out exactly what is free, and under what conditions.

The MIT License: Commercial Use Is Allowed, but You Can't Just Remove the Notices

MIT is widely known as a relatively permissive software license.

It broadly allows copying, modification, redistribution, and commercial use. The MIT license itself doesn't prohibit selling an app you build using MIT-licensed code.

However, there's a condition: the copyright notice and permission notice must be included in copies or substantial portions of the software.

For example, if you incorporate MIT-licensed code into an app and distribute that app, you shouldn't simply delete the original copyright notice and license text.

"Free to use" doesn't mean "no copyright."

The MIT license also normally includes a disclaimer of warranties. Being allowed to use code is different from having someone guarantee that it will work correctly.

Apache License 2.0: Commercial Use Is Allowed, but Watch the Changes and NOTICE File

Apache License 2.0 also broadly permits commercial use, modification, and redistribution.

When distributing software under this license, though, you generally need to provide a copy of the license, preserve relevant copyright and attribution notices, and clearly indicate files you've modified, among other conditions.

If the original software includes a NOTICE file, you may also need to carry forward relevant notices in the manner specified by the license.

Apache 2.0 contains explicit provisions about certain patent licenses, too. That's one respect in which its terms are more detailed than MIT's.

At the same time, permission to use the code doesn't automatically give you permission to use the author's or project's trademarks.

Just because a project is well known doesn't mean you can put its logo on your own service.

GPL: Commercial Use Isn't Banned, but Distribution Comes with Stronger Conditions

GPL takes a rather different approach from MIT and Apache.

It's a mistake to think GPL-licensed software cannot be used commercially. GPL permits commercial use, including charging money for distribution.

The major difference concerns what happens when you modify GPL-covered software, or create a program that forms a covered combined work with GPL code, and distribute that work to others.

When the relevant conditions apply, you must make the corresponding source code available under the GPL's terms, along with meeting applicable copyright, license notice, and modification requirements.

That doesn't mean "using one GPL library forces you to publish every unrelated piece of internal company code." The answer depends on how the code is combined, how it's used, and which GPL version applies.

Also, if you modify a GPL program only for your own use or within your organization, that alone generally doesn't create an obligation to publish the modified code to the public.

Whether commercial use is allowed and what you must do when distributing software are two separate questions.

What About Web Apps and SaaS? The Difference Between GPL and AGPL

This one is especially interesting for anyone who wants to keep running a web service after a hackathon.

Imagine a SaaS service where the program runs on a server, and users interact with it through their browsers.

With ordinary GPL, running a program on a server and making its features available over a network generally does not, by itself, amount to distributing a copy of the program.

AGPL-3.0, however, introduces an additional source-code-related condition for people interacting with certain modified versions of the program over a network.

So GPL and AGPL might look almost identical at first glance, but the difference can be significant for web services.

There is another wrinkle: if a web app actually delivers JavaScript or other code to a user's browser, that's a different situation from code running only on a private server. You need to look at what code is being delivered, and how.

How Do the Three Licenses Compare?

License Commercial use Main conditions when redistributing Must you publish your app's entire source code?
MIT Generally allowed Keep copyright and permission notices Not required just because the code uses MIT
Apache-2.0 Generally allowed Retain license and required notices; mark changes; carry forward applicable NOTICE content Not required just because the code uses Apache
GPL-3.0 Generally allowed Distribute under applicable GPL terms and provide corresponding source code, among other conditions Required for covered combined works that are distributed, in applicable circumstances

This table is only a starting point. The specific way you use the code and how different licenses interact can affect the answer. A quick comparison table isn't enough to make a final legal assessment.

"AI Wrote the Code" Doesn't Automatically Make Everything Fine

With AI-assisted development, you might not personally search GitHub at all. AI can suggest both code and libraries.

For instance, you might ask an AI to build a login screen and discover that it added external packages along the way.

But having AI select a library doesn't remove the need to check its license.

And if AI-generated code resembles existing code, the fact that you used AI doesn't automatically resolve questions about where it came from or whether it infringes copyright.

This connects to something I explored in an earlier article: "Who Owns the Copyright to AI-Generated Code?"

The more we build with AI, the more important it becomes to know which parts are our own code and which parts came from elsewhere.

Do I Need to Check Libraries Installed with npm install Too?

Even if you never directly copy code from GitHub, your app might still include third-party libraries.

In apps built with tools like Next.js or React, package.json and lockfiles record dependencies.

Those dependencies include not only packages you chose yourself, but also packages pulled in automatically because another library needs them.

GitHub's Dependency graph can help you inspect package versions, license information, and known vulnerabilities. But seeing information in that tool doesn't, by itself, settle every licensing question.

The goal isn't to memorize every software license. I think it's more useful to be able to find out which external code your app depends on.

From Hackathon Prototype to Business: The Timing of These Checks Changes

This is a little like what I found when writing about trademarks.

On hackathon day, getting a demo working within a short time may be the top priority.

But the terms attached to code don't disappear just because it's a prototype. Even then, it's worth avoiding casual copying from unlicensed repositories and keeping track of the packages you use.

If development continues afterward, you can review dependencies and organize license information more carefully.

When a public release or commercial product becomes realistic, you need to check whether you're distributing code or an app to users, offering software as a service, and whether attribution or source-code availability obligations apply.

And with a team project, you also need to discuss the rights to code written by the team members themselves. Those are separate from the licenses attached to external code.

Software licensing isn't something that suddenly matters only after an app is finished. It's something to check lightly at first, then review more thoroughly as the project grows.

Here's What I'd Check Before Using Code from GitHub

  1. Is there a LICENSE file? If not, don't assume free reuse is allowed.
  2. Which license and version applies: MIT, Apache, GPL, AGPL, or something else?
  3. Do the code, images, fonts, data, and dependencies have different terms?
  4. Do those terms fit the way I plan to copy, modify, use commercially, redistribute, or provide the app as SaaS?
  5. How will I keep the required copyright notices, license text, NOTICE files, and any source-code availability information?
  6. If the answer is unclear, can I use a different library or ask the rights holder before incorporating the code?

I don't think every developer has to become a legal expert. But at least we should know what we're using and where its conditions are written down.

Public Code Still Belongs to Someone

On GitHub, you can see code created by people all over the world.

Being able to learn from it and build new apps is incredibly useful.

But making code public isn't the same as allowing unrestricted reuse.

MIT, Apache, and GPL aren't simply three ways of saying "do whatever you like." Each sets out the conditions under which people can share and reuse code.

I want to keep building apps with AI, and I like the possibility of taking ideas born at hackathons and developing them further.

So when I find useful code, I want to pay attention to the terms under which its creator shared it.

Being able to use code and being able to use it responsibly under its license aren't quite the same thing. Understanding that difference is part of learning to build apps, too.


References

This article is general information based on official materials available as of October 2026, not legal advice about the licensing compliance of any particular project. Before distributing or commercializing software, check the precise license terms for each piece of code and how you intend to use it.