Skip to content

Web/API server - #2

Merged
TotoCodeFR merged 11 commits into
mainfrom
feat/web
Sep 9, 2026
Merged

TotoCodeFR merged 11 commits into
mainfrom
feat/web

Conversation

@TotoCodeFR

@TotoCodeFR TotoCodeFR commented Sep 4, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds an API server using Fastify (no real web frontend) as well as a WebSocket server. It also supports a database with Drizzle ORM using a PostgreSQL-compatible database and Sentry for error logging. There is also a simple but modular architecture in order to easily add a new API or WebSocket message type(?).

Why

This is mainly for cross-game session state, which will come sometime. I had tried an alternative (documented here) using TeleportData, but the Return to "{place}" button in the Roblox client (which is the most seamless/UX-friendly way of going back to Spawnpad) doesn't yet return the previous data.

Changes

  • all the web server/websocket/whatever changes
  • add a log when the server starts up, because it was hard to know if the server was started
  • automatically expire tokens when they reach their expiration time + close the clients with that token
  • max token limit per-user
  • document the database part

Problems that won't be addressed/known problems

Pretty much anyone who knows just a little about the API can edit someone else's session. All you really need to know is their user ID and then it's 2 requests from there. I don't really know what I can do to prevent this, especially when you have an open-source system like this, that doesn't require Roblox Open Cloud OAuth.

Tested (manually)

  • /api/v1/auth/roblox with a user ID works and returns a valid token, database also registers that token
  • WebSocket server over an authenticated token works
  • Missing field(s)/no authentication/invalid token errors
  • (NOT TESTED) Graceful shutdown

What's next

  • Automatically expire tokens over their expiration time as well as closing previous clients using that token (793e2b6)
  • Add a max token limit per-user (most likely 3) (6db6043)
    • Probably discard oldest token if limit is reached
    • Don't use a 1 token per-user limit, as weird leave/joins may break this

uses fastify, right now it's just an API and nothing more. has a
websocket server too, and makes it easy to add new APIs and API versions
as well as websocket message types. also has optional sentry for error
handling and drizzle + any postgresql compatible database for production
since it has yet to be a part of the source code, most people who serve
on rojo will get an error
@TotoCodeFR
TotoCodeFR marked this pull request as ready for review September 9, 2026 19:41
@TotoCodeFR
TotoCodeFR merged commit b0bb914 into main Sep 9, 2026
2 checks passed
@TotoCodeFR
TotoCodeFR deleted the feat/web branch September 9, 2026 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant