[Vuejs]-Building scalable SPAs using websockets, how complex is it?

0πŸ‘

βœ…

Is it possible to create a monolithic application server for frontend and backend? Will that be a good choice?

That choice is fine; start simple and you can break into microservices in the future. Unless this is for a large production system!

If you use something like express you can serve the Vue.js files using express.static, API endpoints using express.Router() instances, and the ws or socket.io module attached to express instance for websockets.

Now my application will need to show real-time updates, I’ll have to
use websocket connection between my browser and frontend server which
further will need websocket/webhook connection with my backend server

This isn’t the case. You can have your frontend (the app running in a browser) connect directly to the backend via websocket if you wish, no need to proxy via a frontend server. For session management look into JWT tokens.

0πŸ‘

You can go for socket.io library in Nodejs. It’s simple and easy to use, The scalability and session can be handled by introducing Redis,

check https://socket.io/docs/using-multiple-nodes/

Leave a comment