20

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.

10
  • 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
    Jul 11 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. Jul 11 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
    Jul 11 at 16:32
  • You shouldn't be in a hurry to use code from your side projects at work. If its previously published and widely acknowledged then its not that crazy, but otherwise not a good idea. Managers can get paranoid and possessive often, why give them ammunition. Jul 11 at 17:50
  • 4
    Is the code entered into a 3rd party repository such as GitHub, with timestamps which pre-date your start of employment? Jul 11 at 20:24

7 Answers 7

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
    Jul 11 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
    Jul 11 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
    Jul 12 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
    Jul 12 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
    Jul 13 at 19:49
22

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 Jul 11 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. Jul 12 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
    Jul 12 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. Jul 13 at 9:55
  • @RedGrittyBrick Yes, definitely publish first, use later. I've bolded the "then" to make it more obvious.
    – Thomas
    Jul 13 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
    Jul 12 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
    Jul 12 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
    Jul 12 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
    Jul 12 at 13:40
  • Ahh, ok, I see that. Thank you for the follow ups.
    – CGCampbell
    Jul 12 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
  • 1
    Barmar, I used SIX words for a clarification. SIX. So go and sue me for it.
    – gnasher729
    Jul 12 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
    Jul 12 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.

2
  • 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
    Jul 11 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
    Jul 11 at 9:58
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.