When I was building an image-editing canvas, I used MIT-licensed Excalidraw underneath and planned to keep my application closed source. The first time I put a LICENSE in a repository like this, I searched for A closed source license. When choosing an open-source license, I usually start by asking what I want other people to be able to do. The same question applies to a closed-source project. Showing someone a demo video and giving them a copy of the software to try require very different terms.
Are a few lines enough if all I want is to reserve my rights in my source code?
If all you want to tell readers is that the author reserves their rights and grants the public no license to reuse the source, a short notice can do that. Copyright generally arises automatically when a work is created. Omitting a LICENSE does not automatically give the public permission to copy, modify, or distribute the code. You still need to consider statutory exceptions, existing grants, and the hosting platform’s terms. For example, GitHub allows users to view and fork public repositories under its platform rules. Keeping source code confidential also requires controlling access.12
Here is a brief example for code whose copyright you own. It can go in the repository root. Replace the year and copyright holder with the actual details.
Copyright (c) <年份> <权利人>. All rights reserved.
本项目的原创代码由上述权利人保留权利。
除适用法律允许或权利人另行书面授权外,不得复制、修改或分发。
随项目提供的第三方组件适用各自的许可。
What else is needed when giving a customer a trial?
“All rights reserved” doesn’t tell a customer whether they may install the program. If you’re delivering a beta installer, start by spelling out who can do what with which software and for how long. For example: “Company A is authorized to install version 0.1 on its internal test devices solely for functional evaluation for 30 days from receipt of the installer. This authorization grants no right to distribute the installer to third parties or access the source code.” This illustrates one specific grant. For an actual delivery, the term, eligible users, and what happens at expiry should match what both parties agreed. Someone who receives only the installer may never see a notice left in the source repository.
What do I put in the license field for private npm and Composer packages?
If you distribute a package, users will also see a license field in its configuration file. In a short article, Peter Thaleikis gives examples for npm and Composer.3
- npm’s
package.json. If the package is only for your own use and you do not intend to grant others any usage rights, use"license": "UNLICENSED". Notice the final D.Unlicenseis an open-source license that allows others to use the code freely. If you have drafted trial terms for a customer, place them in aLICENSEfile at the package root and set"license": "SEE LICENSE IN LICENSE"so recipients can find them. To keep yourself from publishing the package accidentally, you can also set"private": true, which makes npm refuse to publish it.4 - Composer’s
composer.json. A closed-source PHP package can use"license": "proprietary". This tells users the package is under a proprietary license. The terms included with the package still determine the duration of a customer’s trial and whether the customer may pass it on.5
Can I copy the template repository’s own LICENSE?
That day I opened kolappannathan/closed-source-license and clicked the root LICENSE. It’s especially easy to pick the wrong file in this repository. At the root is the Unlicense, which spells out how others may use the template repository itself. The text to use for a closed-source project is in src/License.txt, and the README reproduces it in full. The two files grant very different permissions.6
I ultimately used the latter in my repository, keeping the body of the template and changing the year and name. It explains the purposes for which recipients receive the source and the limits on copying and passing it on. Excalidraw remains under the MIT License. When distributing copies or substantial portions of it, I need to include the original copyright and permission notices. I can give my own application a closed-source notice and fulfill the distribution conditions of its dependencies at the same time. I wrote about why I chose the library in Choosing between tldraw and Excalidraw for a commercial React canvas.7
Footnotes
-
GitHub. (n.d.). Licensing a repository. GitHub Docs. Choosing the right license, including permission to view and fork public repositories. ↩
-
GitHub. (n.d.). No License. Choose a License. Default copyright, exceptions, and the purpose of notices. ↩
-
Thaleikis, P. (2021, January 9). What license to use for private NPM/node or composer packages. DEV Community. Two configuration examples. ↩
-
npm. (n.d.). package.json (CLI v11). npm Docs. The license field and custom license files, The private field and accidental publication. ↩
-
Composer. (n.d.). The composer.json schema. Composer Documentation. Closed-source software in the license section. ↩
-
kolappannathan. (2024, February 16). Closed Source License. GitHub. File descriptions at the beginning of the README, Closed-source template, The template repository’s own LICENSE. ↩
-
Excalidraw. (2025). MIT License (v0.18.0). GitHub. Grant of permission and conditions on retaining notices. ↩