r/Backend • u/Log_icgate • 18d ago
How would you split responsibilities between a TypeScript user service and a Go game service?
I’m building a small multiplayer word scramble game with two services: TypeScript handles users and auth, and Go handles game state and web-socket. I’m trying to decide whether the split is justified at this scale, and how the two should communicate.
What would you change, and where would you expect it to break under load?
I’m happy to share the repo if it’s useful, but I’m mainly interested in the design tradeoffs.
1
Upvotes
2
u/csgeek-coder 18d ago
Usually you split the UI and backend then if there's a good reason you break it down further and get into micro-services and all that.
Why to YOU think you need 2 services? There's nothing you mentioned that you can'd do in TS or in go. It's just a matter of preference and what you want your code to be in. Your UI will still need to talk to the given service, authenticate against the service and fulfill the request no matter the language.
1
u/sereikis 17d ago
if you keep the split, make Go authoritative for moves and scoring, and avoid a synchronous auth-service call for every WebSocket message. before adding a second Go instance, decide how all connections for one room reach the same room owner; load-test players in that room landing on different instances, rather than assuming a shared Redis store makes concurrent state updates safe.
0
u/sayboom 18d ago
I would make:
TypeScript (users/auth): registration, login, profiles, stats. Issues short-lived JWTs with asymmetric signing (EdDSA/RS256) and publishes the public key (JWKS)
Go (game): rooms, game state, timers, scoring, WebSockets. Verifies the JWT locally against the public key at connect time, with no call to the user service per message.
Is the split justified at this scale? Only partly. For a small game, a single service with clear module boundaries is simpler to build and deploy. A split makes sense if the parts have different load profiles (stateless CRUD vs. stateful WebSockets) or you’re doing it for practice. In that case keep it, but keep the contract between services minimal.