I have written a web app for a client. In our contract we have it explicity written that we retain rights to all of the code within the app. Is it legal to repurpose that code for a similar app that we would change and then sell to future customers?
Your contract explicitly states that you retain rights to all code, but what kind of license did you provide your client? If it's an exclusive license, I don't think you can reuse the code until the license expires, unless you didn't grant worldwide rights under the license and the new use is in a region not covered by the license.