Technology Use
GearN Server is built on Node.js and TypeScript, with Express for HTTP APIs, Socket.IO for real-time transport, and MongoDB for persistent game data. The stack is intentionally practical: fast to run locally, simple to deploy, and flexible enough for live game operations.
Runtime
Node.js provides the event-driven runtime used by the server. It fits GearN's workload well because game backend traffic is mostly I/O-heavy: API calls, database reads/writes, socket events, file uploads, and external service calls.
- Handles many concurrent requests without spawning a thread per request.
- Works well with async MongoDB, HTTP, mail, push notification, and socket workflows.
- Requires Node.js >= 20.0.0 in the server package.
Language
TypeScript is used across the server codebase to keep request models, response models, entity contracts, and CloudScript workflows explicit.
- Improves maintainability for large API surfaces.
- Reduces runtime mistakes in request conversion and entity mapping.
- Supports CloudScript templates written in TypeScript.
Database
MongoDB stores flexible game data such as players, characters, groups, inventory, store items, content data, leaderboard data, logs, and dashboard settings.
- Good fit for evolving game data schemas.
- Supports separate data and log database connections.
- Used by Socket.IO adapters for cluster-aware real-time delivery.
Transport Layer
GearN exposes both HTTP and socket transports. This lets a game use simple REST-style calls where latency is not critical, and keep a persistent socket connection for real-time events.
| Technology | Used For | Why It Matters |
|---|---|---|
| Express | HTTP API, health check, upload/download routing, dashboard/server endpoints | Simple routing model with proven middleware support. |
| Socket.IO | Authenticated real-time API calls, push events, rooms, online status | Reliable WebSocket-style communication with fallback handling. |
| MsgPack | Compact request/response payloads for HTTP and socket | Reduces payload size compared with plain JSON when enabled. |
| CORS | Allowed origin, methods, headers, and credentials control | Keeps browser-based dashboard and client calls predictable. |
Security And Integration
GearN uses focused libraries for authentication, password hashing, external identity verification, push notification, email, and file upload. These pieces should stay boring and battle-tested.
- jsonwebtoken and jwks-rsa verify token-based authentication and third-party identity flows.
- bcrypt hashes account and admin passwords.
- Firebase Admin sends push notifications to player devices.
- Nodemailer handles email delivery workflows.
- Multer processes file upload requests for content features.
Request Flow
Unity, C#, TypeScript, JavaScript, Java, or Cocos Creator client sends an HTTP or socket request.
Express or Socket.IO receives JSON/MsgPack payloads and passes them through middleware.
Authentication, permission rules, request limits, payload limits, and debug logging are applied.
Request handlers convert input into typed service operations for the target GearN feature.
MongoDB stores and reads entity data, logs, leaderboards, settings, and content records.
The server returns a structured response and can push socket events to one player, a room, or all players.
Production Features
- Cluster settings let multiple GearN nodes cooperate behind a larger deployment.
- Mongo Socket.IO adapter helps socket events work across nodes.
- DDoS settings control request rate, pending request count, upload/download pressure, and payload size.
- Log4js supports console and file logging for operations and debugging.
- Systeminformation provides runtime machine data for dashboard and diagnostics.
Core Dependencies
| Area | Packages | Purpose |
|---|---|---|
| Runtime | node >= 20 typescript | Modern JavaScript runtime and type-safe server development. |
| HTTP | express body-parser cors | REST-style endpoints, middleware, request parsing, and CORS policies. |
| Realtime | socket.io @socket.io/mongo-adapter @socket.io/mongo-emitter | Socket API, rooms, player events, and distributed socket communication. |
| Storage | mongodb | Primary database access for game data, logs, content, and settings. |
| Security | bcrypt jsonwebtoken jwks-rsa node-forge | Password hashing, token signing/verification, public key lookup, and crypto support. |
| Integration | axios firebase-admin nodemailer multer | External HTTP calls, push notifications, email delivery, and file uploads. |
| Operations | log4js systeminformation @msgpack/msgpack | Logging, server diagnostics, and compact binary payload encoding. |