22

Let's say I developed a web app for a personal endeavour of mine. Soon after, I get a job with a tech company, and my first task is to develop a web app for them. Well, it turns out the functionality of this new company web app is similar to my personal web app, and so I use some of the code from my personal web app in the company's web app. Can the company now sue me or take other legal action if I continue developing my personal web app? If so, how can I put a "license" in my code to protect my intellectual property (since I wrote the code BEFORE I even took the job)?

For the programmers out there, the code language is JavaScript and CSS.

11
  • 15
    They can sue you if you never worked for them or wrote any code at all. I think what you mean to ask is "Can they SUCCESSFULLY" sue you.
    – JohnFx
    Commented Jul 11, 2022 at 3:49
  • 1
    Did you sign an "inventions agreement"? It is a very common contract that you'll be required to sign as a condition of employment. It's purpose is to spell out and memorialize the conditions under which your employer becomes the owner of anything you invent in the course of your employment. As a programmer, this generally means any code you write. That document will have the answer. It should be noted that if it is overly broad it may not be enforceable. Typically, anything you do for the benefit of the company, on company time or using company resources will belong to the company. Commented Jul 11, 2022 at 14:12
  • 16
    Side note: When you employer gave you the task of developing a web app, they (implicitly) ordered you to "write code from scratch that does X, because that will give us full ownership of the code". In particular, they did not order you to "copy code that someone else (including your past self) has already written and which will give our legal department a lot of headaches".
    – Heinzi
    Commented Jul 11, 2022 at 16:32
  • 4
    Is the code entered into a 3rd party repository such as GitHub, with timestamps which pre-date your start of employment? Commented Jul 11, 2022 at 20:24
  • 1
    @GACy20: Those who don't end up in "dependency hell" pretty quickly. Thus, in my experience, most professional software development companies do have a well-defined approval process for adding dependencies to their tech stack. YMMV, of course.
    – Heinzi
    Commented Jul 14, 2022 at 10:00

8 Answers 8

31

In the US, code that you write in the course of employment is the property of your employer. Otherwise, anything that you create is your property. The gray area is things that you write during your employment but not in the course of your employment (hence the terms of the employment contract are vital).

Something that you write before becoming an employee is not "in the course of employment". However, if you use that code in the in the course of employment, you invite the argument that in fact the code was written in the course of employment. That argument can be squelched if you have an agreement with the employer that acknowledges that you are licensing your code to the employer in exchange for ... some consideration. It could be $1, or a similar unit of currency.

8
  • 8
    It gets even murkier if you wrote that code using any company equipment or resources.
    – JohnFx
    Commented Jul 11, 2022 at 3:50
  • 4
    @JohnFx I have always seen that scenario as far less grey than people like to think. Especially because my job offers/agreements have all specified that the use of any equipment or resources (servers/software/third-party services like Azure) provided by work makes the work property of the company. The only stuff not covered would be non-trade secret knowledge gained through employment such as general experience or company paid conferences/classes.
    – Logarr
    Commented Jul 11, 2022 at 20:54
  • @Logarr do you mean that they allow you to keep your (newly acquired) skills with you when you leave? How generous of them. Where can I apply
    – Jivan
    Commented Jul 12, 2022 at 5:51
  • Even if you wrote it before: without hard evidence that that was the case, you're likely screwed if things go sour
    – Hobbamok
    Commented Jul 12, 2022 at 8:33
  • 2
    @Ajedi32 It would be false, but they might not know that, especially if you don't explicitly mention your intentions to use your previously-created code and discuss a license agreement before you use it. Otherwise, they might think you just reused work code for a personal project and invented the excuse of already having it after the fact when confronted.
    – reirab
    Commented Jul 13, 2022 at 19:49
24

Is your personal code Published somewhere public? Github?
If not, publish it. Give it a permissible licence.
Then ask your employer/project manager/collegues if they would allow a niche public library you wrote yourself, because it seems to solve the problem.

5
  • 1
    It's not published anywhere public at the moment Commented Jul 11, 2022 at 14:36
  • 8
    @user3163495: That's problematic. You should ensure any code you wrote outside of your employment but might use as part of that employment has been published prior to its becoming relevant to your employment. Doing otherwise is inviting trouble. Commented Jul 12, 2022 at 1:56
  • 4
    alternatively post a hash of your code somewhere persistent and public. In short: document that you had that code for yourself first
    – Hobbamok
    Commented Jul 12, 2022 at 8:34
  • 1
    I suspect you would have to do all this before using the code for a company project. Attempting this retrospectively is far less likely to achieve the desired outcome. Commented Jul 13, 2022 at 9:55
  • @RedGrittyBrick Yes, definitely publish first, use later. I've bolded the "then" to make it more obvious.
    – Thomas
    Commented Jul 13, 2022 at 11:21
9

If you wrote it before you started your employment, it is your intellectual property.

However, you should not just arbitrarily include intellectual property that the company doesn't own in a project you are building for the company, without their knowledge and agreement.

Often it's expected that you will make use of open source code in the course of building the company's project, but that is explicitly licensed to the company (via being published with an open invitation for anybody to accept the open source license it's published with), and if the company wants you to use open source material it is presumably happy to comply with those license terms. (You also should not include open source material without knowing the company is happy to be bound by the open source licenses for this project; generally it's clear if that's the case because there is already lots of open source code included in the project codebase, but it would never hurt to ask what the policy is explicitly)

Unpublished code you just happen to have access to should never be included in the company's projects. Without a license the company may be on the hook for copyright infringement, and even worse could find itself trapped unable to continue developing its own products because it is unable to make further derivative works of the code it does not own and has no license to use!

Code you just happen to have access to because you wrote it is only slightly different, in that you would be able to enter into a license agreement with the company to ensure the above situation does not happen. But the company will want to have an explicit written license agreement, so you absolutely should not include your own code without talking to your boss. And they are unlikely to accept any license less permissive than an open source license (so you won't be able to keep your code private to just yourself and the company; they will need extensive rights to modify and distribute it after you have left the company).

If you do include this code that is owned by you, rather than by the company, you may also be inviting personal trouble. If there is no evidence of the fact that you wrote it prior to your work for this company they may believe you are stealing their property if you later use it, and then engage legal proceedings against you. Strictly speaking this should come out in your favour, but if there's little documented evidence of exactly the circumstances in which the code was first created, then you can't rely on a court to rule that you should be the owner, even if that is the truth. So you should want an explicit written license agreement before using this code int he company project too, so that you later have proof that the company acknowledged your prior ownership.

But really, the company does not (or at least should not) want to get into that situation of disputed ownership in the first place. They would much rather you only included code that is either created during the course of your employment (so they own it completely) or is clearly licensed to the company (such as widely published open source code). Code you own but haven't published as open source prior to starting with the company, unless it is quite substantial, is probably just not worth the hassle for them of getting it properly licensed. Most likely paying developers to reinvent that wheel is cheaper than paying lawyers to make sure there are no legal issues.

5
  • I might change the first line to read "If you can prove you wrote it before you started your employment, it is your intellectual property."
    – CGCampbell
    Commented Jul 12, 2022 at 12:55
  • @CGCampbell If you honestly created it first, then it IS your intellectual property. Lack of proof doesn't mean you don't own it, it just means that a court may not be able to enforce your property rights if the company falsely claims (in error or malice) they own it. Just as if you legally obtain physical property but have no evidence of your ownership, then if you loan it to someone (or leave it unsecured and they take it) a court may not be able to enforce your property rights if they falsely claim they own the physical property. I mention the practicality in my answer, anyway.
    – Ben
    Commented Jul 12, 2022 at 13:21
  • Unfortunately, here the OP has stated in a comment that the code was unpublished by them, and now they are coding under contract for a company. If the OP cannot prove they wrote it before employment, the company is well within their rights to enforce ownership. The OP has used the code in a project for them. They own the code, unless the OP can prove it was written before employment. This is what I meant. Not in general, but rather in this specific case.
    – CGCampbell
    Commented Jul 12, 2022 at 13:30
  • 1
    @CGCampbell I don't believe that's the case, at least in my jurisdiction. Employers own code that was actually created during the course of your employment; they don't own "all code that you can't prove wasn't created during the course of your employment". And copyright ownership doesn't require publication. It's pragmatically similar of course, because if nobody can prove it either way there will be a dispute that a court will have to decide, and the company will have better lawyers. But the proof doesn't create ownership, it just helps a court rule your way if there is a dispute.
    – Ben
    Commented Jul 12, 2022 at 13:40
  • Ahh, ok, I see that. Thank you for the follow ups.
    – CGCampbell
    Commented Jul 12, 2022 at 14:34
8

You can be sued for anything. You will likely get sued if someone believes you caused them damage. With the facts as you describe them (you wrote software in your spare time at your own expenses, you "donated" it to your company) you never caused any damage, but if the company doesn't know the details, and all they know is that some code X is both in their product, and in your private product, they are likely to assume that you damaged them.

So I would strongly recommend that you talk to your manager at least before using any of your own code, and be prepared that the company doesn't allow it and that they don't want anything in their products where they are not the copyright owner. Making sure that you can't turn around in two years time and demand that your code gets removed could easily be more expensive than paying you or someone else to write code with the same functionality.

3
  • 3
    Answering "Can I be sued" questions
    – Barmar
    Commented Jul 11, 2022 at 14:13
  • 1
    Barmar, I used SIX words for a clarification. SIX. So go and sue me for it.
    – gnasher729
    Commented Jul 12, 2022 at 9:30
  • 3
    Sorry, I just get tired of this frequent pedanticism, and you happened the be the victim when I decided to look up the site's concensus on it.
    – Barmar
    Commented Jul 12, 2022 at 15:33
6

At least once I was asked to provide a list of code I had already written (standard utility stuff that mostly now happens in libraries) at hire. Other times I supplied it myself, unasked.

A prenup is often a good idea.

3

I think the key point here is to talk to your employer early, namely the moment you notice that code you already wrote for your personal project is useful for the task you got from the employer. There is potential for a win-win here because if the code the company needs already exists they can get it cheaper and faster than if you have to rewrite it from scratch. You just have to talk to them and find a mutually acceptable agreement. They get the code (and it is their intellectual property afterwards) and you get something from them, cash or some other work priviledges that you want. As both sides can win here this shouldn't be too difficult.

3
  • 7
    "They get the code (and it is their intellectual property afterwards)" [emph. mine] would seem excessive - and problematic if it's already licensed to others. Surely they shouldn't get more than a licence
    – Chris H
    Commented Jul 11, 2022 at 9:47
  • @ChrisH True, just selling them the code would be one option, negotiating a licence or some other deal is also possible.
    – quarague
    Commented Jul 11, 2022 at 9:58
  • It should be possible to have a license agreement that says “I remain copyright holder, but you can use the code any way you like”.
    – gnasher729
    Commented Aug 7 at 14:21
2

The actual problem here is the liability that you are exposing the company to. You are including code in their product that someone other than the company (you) has a prior copyright claim to. You probably signed something saying you wouldn't do this when you joined the company.

I think that making your previously written code public somewhere with an MIT-style open source license (or something else that explicitly says commercial derivatives are fine and obligation-free) would probably eliminate the problem.

It is still best to check. Just tell someone the situation and ask them if it's ok to use your code.

1

This has come up numerous times throughout my career, so I will comment specifically, both neutral, positive, and negative experiences.

I formed my own C-Corporation in 2012, so it’s 12 years old now. I then proceeded, over the years, to create numerous PHP and JS open source packages, almost all MIT Licensed, that became somewhat prolific in the Open Source community (over 1 million installs). https://github.com/PHPExpertsInc/ (currently: 70 repos).

I register for official copyright paperwork for every project that more than 50,000 installs with the US Copyright office.

Most importantly, all of the works are owned by my own corporation, which does pay me a very modest salary for them. Thus, they aren’t technically “mine”, but belong to the C-Corp, which I happen to own 100% of and have full control of.

Contractually, the projects revert back to my ownership and copyright if and when the corporation is ever dissolved for any reason (lack of paying corporate dues, lawsuits, willful ending of the business, etc.).

Pre-Employment Contractual Setup: Most businesses I have started working for over the years have an Intellectual Property Disclosure form, where they want to list the works created by me. Well, it’s quite a lot. I’ve written 5 books (3 currently on Amazon), over 150 open source projects, etc. I list them all, at least in passing. Even when employers do not ask (especially for 1099 work), I submit my own IP document, attached to the final employment documents.

It is literally 3-4 pages of small-font lists of each of the projects with GitHub / Amazon URLs and the year started.

Then I add the blurb: Perpetual license is given to this Employer for use of all of the software developed, maintained, and owned by PHP Experts, Inc., persuant to the open source licenses of each project, if the Employee is permitted to work on the project as part of this employment contract.

I strive to only work on the projects before 8 AM and after 7 PM and on weekends, except for jobs that I put the IP and Contract clauses and I know that they have accepted it.

Neutral Outcomes: Most companies don’t really notice that I use my own software (particularly phpexperts/rest-speaker and phpexperts/simple-dto), especially 1099 short-term contract work. Usually nothing ever becomes of it. I don’t even think people notice.

Positive Outcomes: My current employer embraces open source and realizes that my projects bring about 2,000 hours of free labor from the git-go, and that their other devs benefit from usign my open source projects, too.

I’ve been hired primarily because the interviewers personally used my projects, particularly the bash-timer and BashScripts framework.

I’ve also had two employers that hired me at discounted rates on the condition that I create open source projects for my own company and use them in their own business. But that seems outside the scope of this question.

Negative Outcomes:

Story 1:

Not once, but two times, I have successfully inserted my IP clauses into contract documents but things turned very south. First time, I was working for a lawfirm, and I refused to sign the original employment contract without my IP addendum. It went all the way up to the CEO, himself a contract lawyer. He called me into his office, I told him I brought a lot to the table and he should authorize it, as it would let me help his corp immediately in major ways. He was so impressed that we ended up reducing my expected salary by $20,000 on condition that I could build a completely new thirdparty API client and maintain ownership of it while I worked there (using that API client for the business’ core needs).

These IP things are not standard, and no one, certainly not me, told my manager or other developers about this arrangement.

For more than a year, I brought in over 20-30 of my projects into this org’s existing legacy software and really turned things around. But egos ran hot and heavy and the other devs (I was team lead) greatly resented and viewed it as theft of some sort that I was actively contributing to all of these open source projects of mine in my day to day work (all changes necessry for the company’s legacy software to work, for instance, porting some to work on Windows PHP).

Things came to a head when the CTO found out and I found myself in a dark room surrounded by corporate IP attorneys threatening me with all sorts of nastiness. Then I showed them the IP contract with the CEO’s signature dated before I started working there, with lists of every project that was under contention in that discussion.

The CEO was called in, interrupted his day, he was pissed. He said, yes, that he authorized it, and that I must be shrewder than all of them. The lawyers folded their folders and told the CTO that, well, I was completely in the clear.

The next week, the CIO (my boss) and the CTO and HR met me in the same meeting room and told me that I was being let go for no cause. The CIO’s face looked ashen. He told them all, “Theo has saved this company in the 15 months he has been here. I am afraid we won’t survive 6 months without him.”

That was early November 2019. The CTO ordered all my projects be removed from the website. The website crashed. They missed their Black Friday weekend because the devs who remained were really highly incompetent and couldn’t finish the project in time. Then they missed Christmas. Then in January 2020, they had mass layoffs and laid off basically every competent person who remained. Then COVID hit in March, and they were out of business by May. his prophecy came true.

Outcome 2:

I worked for another company for almost 3 years. A huge Fortune 50. They accepted the IP clause but I didn’t actually work on any of my projects during work, always nights and weekends. I was also 1099 hourly and never, ever, not a single time worked on the clock on my projects (any of them).

I was team lead and ended up integrating about 5-6 of my projects into the app. No one really noticed. I guess they just assumed they were just like any other app.

Then one day, someone on another team at the huge company used one of my more popular projects in their own project, at the company. They had discovered it by accidnet. After a while, someone else realized that I was the author. Egos ran hot, and they found out that I was using it in every project I contributed to over there.

Well, as you can imagine, my manager said he felt betrayed. I said, why don’t you look at the git log and find a single time when I worked on this during working hours? So apparently he assigned some junior dev to do just that.

The junior dev used some sort of tool and sure enough, not a single contribution was committed during working hours over the 3 years I worked there.

Still, they put me on unpaid leave and had legal look at it. Legal came bakc and said, “We found this in his legal contract.”

But I wasn’t hired directly, no no, this company was hiring my company, via another third party recruiter. I had/have Accidental Errors & Omissions insurance, and successfully filed a claim for lost income due to the thirdparty being at fault (breach of contract).

The lawyers swiftly replied that, yes, since my company was the actual employer of me, this was all 100% legal even without a contract in the IP clause (becuase my corporation was paying me in addition to the employer paying my corporation).

SO case was dismissed, the insurance paid out 8 business days of lossed wages, and then the insurance company sent the bill to the Fortune 50, which paid them.

My CTO never ever forgot it and for the next year, he urgently tried to find someone to replace me. More than a dozen coders were assigned to work with me (Team of 1) but no one could cut it, and most quit of their own accord after 2-3 weeks and went back to easier projects. After 14 months, finally someone decently competent could actually do about 20% of the amoutn of work I was doing.

3 months later, I was gone. Contract terminated early, with penalty payment. On my last day there, the product manager told the entire division (some 100 people) that he didn’t know how the project would survive long-term without me. Actually, 2 senior devs jumped ship when this was going down, sensing that the project would die. Five months later, he was proven right and the company had to hire an additional 20 testers to replace the product I had single-handedly maintained for 3 years.

But yeah, work for your own c-corp and bring in projects that you started before this new employment, and insert an IP Disclosure paper into your employment contract and you should be good to go.

Oh and never work on your own stuff on company laptop, and try to work off-hours.

9
  • were these all in-person (non-remote) jobs? Commented Aug 5 at 15:08
  • Last one was 100% remote. The others were 100% in-erspon. Commented Aug 6 at 2:26
  • Lawyers can mess things up. Worst example I found: Many years ago a small computer dealer named Uzi Nissan registered www.nissan.com. The Nissan car company decided they wanted that name. The goal of the Nissan company was to get the URL without paying too much. The goal of Nissan’s lawyers was to win the court case. Result: They won, but Uzi Nissan owns the name, can’t use it, and the court told him that if he sells the name to Nissan he will go down for blackmail. That’s why Nissan will never be able to own www.nissan.com. Because their lawyers had to win in court.
    – gnasher729
    Commented Aug 6 at 13:32
  • I worked @ the company formely-known-as-Medology from March 2016 through Dec 2018, and worked July 2016-2017 for the CEO Fiyyaz Pirani in Hyderabad, India, building a kickass outsourced team (training them to be pros). First, he fired my team in India a few months after I got back in 2018 then on my birthday, a few days before christmas, he fired me for being 5 minutes late. Commented Aug 24 at 3:41
  • I was actually the CTO and I didn’t see why it mattered? I had basically been the CEO, COO, CTO, Lead Archtict, salesperson, and trainer for Medology India, Ltd, and my hours were flex. Commented Aug 24 at 3:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .