I wonder - is it possible to sign a contract with a freelancer for a regular contract job securely?
I mean how can I justify that all the work he has done will be given to my company and nobody else will get any line of code intended for my company including freelance developer himself?
Are there any special terms used in a contract or maybe there are other methods to secure this kind of relationship?
Is it possible to build a kind of trustful relationship with a remote employee?
Depending on the content of the contract, you can get such an agreement. A normal contract would specify that the whole of the code belongs to the hiring company. However, you can specify that no part of the code can be reused elsewhere. I have signed such agreements in the past, and while I don't like the clause, I just charge a little extra for that factor.
Put another way, I'm not out looking to take code from clients and make money off it. I'm out to reduce my own workload. So if I develop a neat utility class as part of a project for one client, I would want to be able to reuse that utility in my next project that needs it. This isn't taking proprietary ideas or anything like that, just saving me from rewriting the same class again.
From the client's perspective, reusing code like that shouldn't make a difference (and in fact, when I discussed the issue with one client, we modified the clause to allow me to reuse code that was not based off any proprietary information given to me by the client). If you really want to make sure nothing gets reused, add in the clause, but be prepared for some questions about it.
If you don't trust someone to keep your interests in mind, you shouldn't work with them, regardless of what's in the contract.
It's like an NDA. It doesn't stop people from talking about stuff. It's just some hook you could theoretically use to sue someone, which you won't.
Make it clear (and yes in writing) that all work is work for hire and is completely owned by you. That's a perfectly reasonable demand when you're paying someone else for their time.
I don't know anything about law or business practices in Russia; I am qualified to write only from the U.S. perspective.
One would enter into an agreement that includes (a) assignment of all rights, including intellectual property rights, to the client (please see Why “Work Made for Hire” is a Term Made for Confusion ) and (b) confidentiality obligations.
For the contractual provisions to have the greatest effect, the contractor will need to believe that you have the will and the means to enforce them in court.
Disclaimer: This post does not constitute legal advice and does not establish an attorney-client relationship.