Recommended app stack for rust implementation

Hye guys hope you guys doing well,

I got a rather beginner question to ask, forgive me for it.

I really want to write libp2p with rust but Im not quite sure about the app stack.

In a normal app stack, you got frontend talking to backend through http request. Hence, maybe you will have REACT & RUST as general stack. However in the case of P2P network, how do frontend communicate with the backend? Is it possible for me to write my front end in javascript while my backend in rust?

Thats all from me now, super grateful if anybody can enlighten me on this one!

I think you are still thinking of a standard client/server architecture, P2P does require that you shift your thinking about what the frontend/backend is a little. Each peer is like a server in that other peers can make requests to it but each peer is also like a client where it makes requests to other peers.

LibP2P can do the standard client/server architecture if needed but where it really shines is peer to peer.

So to answer your question you could have a peer written in RUST and another in JS and they both act as both a client and server. If you want to think in the terms of the architecture of a single peer you could have JS as your GUI which communicates with a RUST “server” on the same machine (over a local http server, unix domain sockets or anything else) which then makes requests to the network through LibP2P. This last example isn’t really necessary (unless you are doing something extra) since we have libraries for libp2p in JS but it is an option. You could also write your UI in RUST if you wanted to just stick with RUST.

1 Like

I see, thank you so much for your clarification!