How solaris-games/solaris works
Main Components
• Client Application – Built using Vue.js and PixiJS.
• Contains game logic, UI components (views, dialogs, menus, game components), and assets.
• Uses event buses and socket channels for interactive, real-time functionalities.
• Server (Backend API) – Powered by Node.js with Express and MongoDB.
• Handles API endpoints, game logic, user authentication, state management, and routing.
• Organizes code around controllers, middleware, and services (e.g., game, player, guild, diplomacy, etc.).
• Includes job schedulers that run automated tasks (e.g., game ticks, cleanup, official game checks).
• Hosts socket handlers and emitters to manage real-time communication.
• Common Library – Shared code between client and server.
• Includes shared types, API controllers, socket utilities, and other business logic.
• Database – MongoDB with Mongoose providing persistent storage for players, games, and in-game events.
• Auxiliary Services – Deployment components (Docker compose and PM2), configuration files, and migration scripts.
Out Relationships and Data Flow
• The Client communicates with the Server via:
• RESTful API calls (using endpoints defined in the server’s Express application).
• Real-time communications (via websockets – client socket emitters/handlers and corresponding server counterparts).
• The Server interacts with:
• The MongoDB database for reading and writing persistent game and user data.
• Scheduled job services that trigger periodic game updates (game tick, cleanup jobs).
• The “Common” layer sits between client and server, encapsulating shared types and utilities that ensure API consistency.
• Docker and PM2 are used for deployment and continuous development cycles, so you might also show how the development and deployment pipeline interacts with the overall system.
Architectural Patterns and Design Principles
• Separation of Concerns – The client, server, and common libraries are clearly separated.
• Layered Architecture – Presentation (client UI), business logic (server controllers/services), and data-layer (MongoDB).
• Event-Driven Communication – Both the client and server make use of event buses and socket channels to manage real-time events (e.g., game state changes, chat, diplomacy events).
• Modular Design – Individual modules for game logic, account management, configuration, and scheduled tasks (as evidenced by directories like “views”, “api/controllers”, “services”, and “jobs”).
Detail Technologies and Frameworks
• Client: Vue.js for UI components and PixiJS for rendering graphics.
• Server: Node.js, Express, and Mongoose/MongoDB for database handling.
• Real-time Communication: Websockets for in-game events and notifications.
• Build/Dev Tools: Docker (docker-compose), PM2, and the automated development scripts mentioned in the README.
• Additional libraries: Utility scripts (e.g., helpers for game, diplomacy, and socket interactions).