You can sell code you originally built for a client only if you own the rights to it, or the client has agreed in writing that you may reuse it. Once ownership is clear, the work is mostly subtraction and generalization: remove everything that identifies or belongs to the client, replace their specific business rules with settings, and package the result so a stranger can install it. Done well, one paid project becomes a product that keeps earning.
This is one path into the broader process covered in our guide on how to sell your web app or SaaS source code. Here we focus on the part that is unique to agency and freelance work: the legal check, the cleanup and the productization decisions.
A note before you start: this article gives general information about contracts and intellectual property, not legal advice. Rules differ by country and by contract. Ask a qualified lawyer to review your agreements before you sell anything derived from client work.
Step 1: Find out who owns the code
Ownership of commissioned software depends on your contract and on local law. In some countries, work done by an independent contractor stays with the contractor unless there is a written assignment; in others, the default can differ, and employment changes everything. The U.S. Copyright Office explains one version of these rules in its circular on works made for hire. Do not assume; read your agreement.
| What your contract says | What it usually means for reuse | What to do |
|---|---|---|
| Full IP assignment to the client | The client owns the code you delivered | Ask for a written license or release to reuse it, or rebuild the product independently |
| Client gets a license; you keep ownership | You can usually reuse it, subject to confidentiality | Check confidentiality and non-compete clauses, then proceed |
| Pre-existing IP clause (your tools and libraries stay yours) | Your reusable components remain yours; client-specific work may not | Separate what you brought from what you built for them |
| No written contract | Unclear and risky | Get a written agreement or release before selling |
| You were an employee | The employer very likely owns it | Do not sell it without explicit written permission |
Asking the client for permission
Many clients agree to reuse if you ask clearly and early. They often care about three things: that their data and branding are not included, that competitors cannot identify them, and sometimes that they get something in return. Useful offers include a discount on future work, free updates of the product, or a period during which you will not sell to direct competitors in their region. Put the result in writing and keep it with your project files.
For future projects, negotiate this up front. A contract that assigns the client everything specific to their business while you keep your reusable framework and modules is common and fair, and it saves an awkward conversation later.
What if the client says no?
A refusal does not mean you can never sell software in that category. It means you cannot sell that code. Your knowledge of the industry, the workflow and the problems users face is yours, and it is often the most valuable thing you gained from the project. Options include:
- Rebuild from scratch in a new repository, without copying files, designs or text from the client project. Write the new version from your own notes on the problem, not from the delivered code.
- Build on your own pre-existing components that your contract kept as yours, and write the client-specific parts again in a general way.
- Change the scope. Target a different audience or a different part of the workflow, so the product is clearly not a copy of what you delivered.
Keep dated notes of how and when you built the new version. If ownership is ever questioned, a clear record that the product was developed independently is valuable. A lawyer can tell you what level of separation is advisable in your situation.
Step 2: Check every dependency's license
Client projects often include packages, themes and assets that were licensed for that one project. Selling the code redistributes them, which may not be allowed.
- Paid UI themes, icon packs, fonts and components. Many are licensed per end product. Check whether redistribution in a product for sale is permitted; often it is not.
- Open-source packages. Permissive licenses such as MIT and BSD usually allow redistribution with attribution. Copyleft licenses such as the GPL have conditions that can affect how you license your product. The SPDX license list gives the official identifier and text for each license.
- Stock photos and illustrations bought by or for the client. Replace them.
- Client-provided code. Anything the client's own developers wrote belongs to them. Remove it.
- API wrappers for services the client pays for. These may include terms that restrict reuse; keep the integration generic and let buyers bring their own account.
Keep a simple file in the repository listing third-party packages and their licenses. Reviewers and buyers both appreciate it, and it makes questions easy to answer.
Step 3: Remove everything that belongs to the client
Treat this as a security task, not a cosmetic one. The safest approach is to start a new repository and copy the code in, rather than publishing the old one. Git history keeps old commits, deleted files and secrets long after you have removed them from the current version.
- Secrets: API keys, passwords, tokens, private keys, server addresses. Assume anything ever committed is compromised and ask the client to rotate it. The OWASP Secrets Management Cheat Sheet covers good practice.
- Data: database dumps, seeders built from real records, uploaded files, logs, exported spreadsheets, test fixtures copied from production.
- Branding: names, logos, colors, domain names, email addresses, phone numbers, legal text, invoice templates.
- Identifying details in code: comments, variable names, class names, database table prefixes and commit messages that mention the client or their staff.
- Proprietary business logic: pricing formulas, scoring rules or workflows that are the client's competitive advantage. Even if you technically own the code, selling their secret sauce damages the relationship.
- Screenshots and documentation written during the project.
Search the whole codebase for the client's name, domain, and the names of their staff. Then search again for partial matches and abbreviations. It is easy to miss a hard-coded email in a notification class.
Step 4: Turn client decisions into settings
A client project answers questions for one business. A product lets each buyer answer those questions for themselves. Go through the app and find every place where a decision was hard-coded.
| Client-specific | Product version |
|---|---|
| Currency fixed to one currency, tax rate in code | Currency, tax rates and number formats in settings |
| Three fixed roles matching the client's team | Roles and permissions configurable from the admin panel |
| Email text written in the client's voice | Editable email templates with placeholders |
| Integration with the client's accounting tool only | Optional integration module, or a clean export plus a documented API |
| One language | Translation files for all interface text |
| Custom fields for their industry | A custom fields feature, or sensible general fields |
| Installed by you on their server | A web installer that a buyer can run alone |
Do not try to make the product handle every business. Decide on a clear audience, such as "small cleaning companies" or "agencies with client portals", and generalize for that audience. Buyers searching in a specific category convert better than buyers looking at a vague "multi-purpose" tool.
Single-company or multi-tenant?
Most client projects are built for one organization, so the natural first product is a self-hosted, single-company app. Converting to multi-tenant SaaS is a bigger change involving data isolation, subscription billing and a super-admin panel. If you want to go there, read multi-tenant SaaS architecture explained first, and consider launching the single-company version before attempting it.
Step 5: Bring the code up to product quality
Client projects often carry shortcuts that were fine for one server you controlled: hard-coded paths, missing validation, an admin panel only you used. Strangers will run your code on servers you have never seen, so raise the bar.
- Update dependencies and the framework to supported versions. Buyers check this.
- Review security basics: authorization on every route, validation on every input, safe file uploads, no debug output in production.
- Add tests for the main workflows, so you can ship updates without fear.
- Write an installer that checks requirements and creates the first admin user.
- Add a license step to the installer; see license keys and domain activation.
- Follow the marketplace's standards. AppTrovo publishes its code standards and submission guidelines, and every product is reviewed with automated checks plus a manual review before it is listed.
Step 6: Give it a new identity
The product needs a name, a logo and a description that have nothing to do with the client. Choose a name that is easy to spell, does not include another company's trademark, and describes or hints at the category. Before committing, search for the name in your target markets and in trademark databases; the USPTO trademark basics page explains why this matters in the United States. Then create fresh screenshots from demo data, not from the client's system.
Step 7: Validate demand before polishing everything
A project that solved one client's problem does not guarantee a market. Before spending weeks on polish, check:
- Search demand: do people search for this kind of software by category name?
- Existing products: are there other self-hosted options, and what do buyers complain about in their reviews?
- Your edge: industry knowledge from the client project is often your best advantage. You know the real workflow, not a guess.
Then prepare the launch materials: a live demo seeded with fictional data, documentation and a listing. Pricing is covered in how to price source code.
Client project to product: a checklist
- Contract reviewed; written permission or ownership confirmed.
- Third-party licenses checked; non-redistributable assets replaced.
- New repository with no client history.
- Secrets removed and rotated; no real data, logs or uploads.
- Client branding and identifying names removed from code, comments and docs.
- Client-specific business logic removed or generalized.
- Hard-coded decisions turned into settings for a defined audience.
- Dependencies updated, security basics reviewed, tests added.
- Installer and license step working on a clean server.
- New name, logo, screenshots and demo data.
When you are ready, you can list it on AppTrovo. You keep 90% of each sale, and there is no exclusivity, so you can also sell the product on your own site or offer it to future clients.
Frequently asked questions
Can I legally sell code I wrote for a client?
It depends on your contract and the law in your country. If you assigned the intellectual property to the client, you generally need their written permission. If you kept ownership and gave the client a license, you can often reuse it, subject to confidentiality terms. Have a lawyer review the agreement before you sell.
Do I have to tell the client I am selling a product based on their project?
Even when you are not legally required to, telling them is usually the right choice and protects the relationship. Explain that their data, branding and confidential business logic are removed, and get any agreement in writing.
Is it enough to delete the client's files from the latest commit?
No. Git history keeps deleted files and old secrets. Start a new repository from a cleaned copy of the code, and rotate any credentials that were ever committed.
How much do I need to change before the project counts as a product?
Enough that a business in your target audience can install it, configure it for their own needs through settings, and use it without your help. That usually means an installer, settings for anything that was hard-coded, translations, documentation and fictional demo data.
Can I reuse my own framework and modules across client projects and products?
Yes, if your contracts keep those reusable parts as your pre-existing intellectual property. Many developers add a clause that separates their general-purpose tools from client-specific deliverables, which makes future products much simpler.