###Define an interface and clearly divide responsibility###
Define an interface and clearly divide responsibility
Like most web projects, yours has a clearly separated front- and backend (probably more so after the frontend rewrite), with a specific interface inbetween. Explain that you're willing to give him the interface he's asking for (REST API), but that the backend code - any part of it - is off limits. Hammer out the functionality of that interface together, but treat the code that connects to it as a black box - on both sides.
In any project that involves more than one developer, it is good practice to code against well defined interfaces. This way you isolate your code against implementation level changes and allow for parts of the project to be modified or replaced without affecting the rest. It also allows developers to work together on a project without having to know, understand or agree on all of the code and technologies involved.
Insist on writing down a specification (can be simple) for this interface, and insist that changes in this document have to go through both of you.
This approach serves three purposes:
- It should help you work together more effectively by clearly stating responsibilities and expectations. Whenever he brings up an implementation detail on the backend, point out that it's not in the scope of your discussion.
- You can use it as a basis for discussing shared concerns like gameplay.
- If you end up going separate ways (and he takes his code with him) or a few years down the line you notice your tech stack really doesn't scale well enough, you're left with separate, functional codebases and can replace parts as needed. Which you can worry about when it actually becomes a concern instead of wasting time arguing over it now.
If he's willing to agree to these terms, I believe there's a good chance you can be very productive together. If he still insists of a complete rewrite, your best course of action is probably to end the cooperation there.