Do I need to write code separately for both client and server?


Guys I am developing desktop chat application using electron. But i have little confusion, that do I need to write code separately for both client and server?

Please give you valuable suggestion.

Thanks in advance


Depends how you want to architect your app.

Probably yes. A client-server system is probably the safest and easiest (and most easily monetised). And probably an ideal start point, especially if you’re new to it.

Otherwise, you could develop a peer-to-peer app, likely across a single network for now.

It sounds as if you don’t have that much experience with this, so I’d suggest client-server, and I’d recommend you read up on it.


Earlier I have created Node base app in which single resource can be used in render the view and server side integration (like node modules and static files) , because all the code and assets are on the server . Now I am going to develop client in electron so can I do same here or need to do separate architecture for both server and client.



In a client-server system, it doesn’t make sense for the server to exist on the client. If two users are on your system, they’re going to have to access a single server to communicate. It makes for any client-side code to be on the client, to reduce the load required on each request.

Like I say, you could go the peer-to-peer route, but for a client-server structure, your server will have to be on your server. Otherwise, every person is firing up their own server, which probably isn’t what you want.