This is a question every developer struggles with, and I'm a bit late, but it never hurts to let an actual lawyer chime in on the topic.
For adding new team members, you may want to consider a "collaboration agreement".
If you're just hiring freelancers, you'll probably want a work-for-hire agreement.
If you're concerned about enforcement, try not to hire outside of Berne Convention signatory countries and make sure your contract's choice of law and jurisdiction rules are local to you. But if you don't have tens of thousands or hundreds of thousands to spend on legal enforcement, this is going to be difficult in any situation, regardless of where the freelancer is located.
There are both technical and legal ways to protect your code more extensively than through the letter of an agreement, as well:
1. DRM and other copyright protection software that prohibits copying and/or constrains access;
2. Use of escrow accounts for code and payment;
3. Strict liquidated damages provisions in the event of breach of confidentiality/non-disclosure (this is a specified monetary penalty if they breach-- if you want to be REALLY anal you can require they post a bond into an escrow account, but no one would sign that);
4. Strict liquidated damages provisions in your non-compete/non-solicitation clauses.
5. MAKE SURE THEY HAVE INSURANCE (PLI/E&O, preferably with a Cyber liability rider to cover data breaches), and make sure you are a named beneficiary on their policy.
6. Make sure YOU have insurance, as well.
Companies with more money are in a better position to protect their IP because, frankly, protecting IP is expensive. You have to play the cost/benefit game in determining how much you want to spend to protect it. And the best advise I can give anyone on this topic-- don't hire anyone unless you know their reputation and background. Only work with known professionals when possible.
The second best advise is to contact a lawyer to determine what you should and should not disclose, and methods of disclosure that may be better suited to protecting your IP.
Best of luck!
Mona