How zultimapg3d/toro-webserver works
Main Components
• Deno Web Server – The core of the system is built in Deno and starts from entry points like main.ts and server.ts.
• API Route Modules – Routes are split into several groups:
• “bexide” (handling account login, masterData, friend operations, presents, purchases, user data, etc.)
• “line” (handling authentication, logging, and coin synchronization)
• “neptune” (for login services like guest login, policy agreements, and version information)
• “assetbundleRouter” and others for serving asset bundles.
• Database & Migrations – Files like db.ts and the migrations directory indicate persistent data storage and SQL-based schema management.
• Protocol Communication – The protobuf folder contains .proto files and generated TypeScript files that define the structure of data for communication between the server and clients.
• Static and Asset Management – The assets and player_data directories hold game asset bundles and persistent player data.
• Configuration and Infrastructure – Files like config.json, config.ts, and Docker-related files (Dockerfile, .dockerignore) provide setup, runtime configurations, and containerization support.
Relationships and Interactions
• Clients (game or restoration modifications) connect to the server over HTTP (with endpoints defined in the various “routes” directories).
• Requests are routed to the proper module (e.g., bexide for account, friend, and purchase-related requests, line for logging and coin modifications, neptune for login operations) where business logic is applied.
• The server uses protocol buffers for nicely structured data exchange where applicable (indicated by the protobuf folder).
• For persistent data, the server interacts with the database using utilities in db.ts and the SQL scripts in “migrations.”
• The assets are served statically and are partitioned by platform (Android assets, etc.), ensuring game clients get the correct asset bundles.
Architectural Patterns and Design Principles
• Modular API Design – Each “routes” sub-directory encapsulates a separate aspect of the game API reflecting clear separation of concerns.
• Layered Architecture – You have an entry layer (HTTP server), a routing/business logic layer, a data access layer (database and player_data persistence), and an external asset management layer.
• Protocol Buffers for Data Contracts – This abstraction improves maintainability and ensures consistency in data structures across components.
• Containerization – Docker support encapsulates the environment, making deployment more consistent.