Reputation: 325
I am a new user to github.com and I am trying to create a mobile app that has two parts: client code and server code. The client code will be written in Java for Android, Swift for iOS and C# for Windows Phone. The server side will be written in PHP, HTML, Javascript and CSS.
My question is this: how should I structure the code? Should I put the server code and the client code in different repositories or should I just put them in different folders in the same repository? Also, since there are multiple clients (Android, iOS and Windows) should I put them in different repositories or different folders?
I already know that either one can be done, but I want to know what the standard procedure is and what the advantages/disadvantages are.
There are many possible solutions to this issue. The answer provided by saljuama is the most complete.
After looking at a few projects on github I found that one way to do this is to create separate repositories for the client and the server. If you have multiple client codes (as in my case) you can use the same repository but different makefiles.
I found this way of doing things at https://github.com/CasparCG The server is a different repository than the client. Additionally, the clients share the same src, lib and other folders but the build scripts of each is different. As noted by saljuama this method makes sense when your clients are sharing the same codebase. If your clients do not share the same codebase see saljuama's answer.
This is not the only possible way. You can do it in your own way.
Upvotes: 5
Views: 3232
Reputation: 2956
The topic is quite broad and it might be opinion based, but I'll try to stay as neutral as possible.
According to the 12factor first principle codebase, each application should have its own codebase (or repository). Since client and server are different applications, they shouldn't share the same repo.
One reason of why having both in the same repository is a bad idea, is when using Continous Integration and Continous Delivery systems. Since a repository push is what usually triggers these processes, performing a change on one of the sides would make the CI/CD server to process both sides of the application, when there is no need for it.
The rest of the reasons I can think of, are subject to be categorized as opinion based, so I won't state them.
Update:
To answer to the update on your question, if the different clients have the exact same codebase, if you keep reading about the 12-factor app principles, configuration and builds, then one repo is what you should use.
Upvotes: 5