syntaxbullet 70a149ab82
Some checks failed
Deploy to Production / test (push) Failing after 35s
refactor(games): overhaul WS game system with improved UX and solo test support
Backend:
- Fix session never being attached to ws.data at upgrade time
- Add GameServer class: connection registry, per-connection room tracking,
  automatic room cleanup on disconnect via ws.data.rooms
- Replace ws-handler.ts with typed event-driven architecture using mitt
- Remove redundant subscription tracking from RoomManager
- Add JOIN_RESULT with player/spectator lists replacing error-as-control-flow
- Add SESSION_REPLACED for multi-tab same-account detection
- Add FILL_ROOM command for admin solo testing (fills empty slots with host)
- Fix dual-schema routing; remove game types from WsMessageSchema
- Per-player personalized views sent directly after each action

Chess plugin:
- Allow same-player (solo) mode: skip color/turn ownership checks
- Fix forfeit and disconnect handling in solo mode (winner: null)

Frontend:
- Click-to-move with legal move dots and last-move highlight
- Auto-scroll move history, forfeit confirmation, turn-reactive board border
- JOIN_RESULT initialises player/spectator lists immediately on join
- Contextual connecting state, player slot cards in waiting room
- Copy-invite button with Copied! flash, Back to Lobby CTA on finish
- Session-replaced warning banner with Rejoin here action
- Lobby passes preferAs intent through route state
- Admin waiting room shows Start Solo Test button

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 16:41:13 +02:00
2026-02-15 14:28:46 +00:00

Aurora

A comprehensive, feature-rich Discord RPG bot built with modern technologies.

Version Bun Discord.js Drizzle ORM PostgreSQL

Aurora is a powerful Discord bot designed to facilitate RPG-like elements within a Discord server. It features a robust economy, class system, inventory management, quests, and more, all built on top of a high-performance stack using Bun and Drizzle ORM.

New in v1.0: Aurora now includes a fully integrated REST API for accessing bot data, statistics, and configuration, running alongside the bot in a single process.

Features

Discord Bot

  • Class System: Users can join different classes.
  • Economy: Complete economy system with balance, transactions, and daily rewards.
  • Inventory & Items: Sophisticated item system with rarities, types (Material, Consumable, etc.), and inventory management.
  • Leveling: XP-based leveling system to track user activity and progress.
  • Quests: Quest system with requirements and rewards.
  • Trading: Secure trading system between users.
  • Lootdrops: Random loot drops in channels to engage users.
  • Admin Tools: Administrative commands for server management.

REST API

  • Live Analytics: Real-time statistics endpoint (commands, transactions).
  • Configuration Management: Update bot settings via API.
  • Database Inspection: Integrated Drizzle Studio access.
  • WebSocket Support: Real-time event streaming for live updates.

🏗️ Architecture

Aurora uses a Single Process Monolith architecture to maximize performance and simplify resource sharing.

  • Unified Runtime: Both the Discord Client and the REST API run within the same Bun process.
  • Shared State: This allows the API to access live bot memory (caches, gateways) directly without complex inter-process communication (IPC).
  • Simplified Deployment: You only need to deploy a single Docker container.

🛠️ Tech Stack

🚀 Getting Started

Prerequisites

  • Bun (latest version)
  • Docker & Docker Compose

Installation

  1. Clone the repository

    git clone <repository-url>
    cd aurora
    
  2. Install dependencies

    bun install
    
  3. Environment Setup Copy the example environment file and configure it:

    cp .env.example .env
    

    Edit .env with your Discord bot token, Client ID, and database credentials.

    Note

    : The DATABASE_URL in .env.example is pre-configured for Docker.

  4. Start the Database Run the database service using Docker Compose:

    docker compose up -d db
    
  5. Run Migrations

    bun run migrate
    

    OR

    bun run db:push
    

Running the Bot & API

Development Mode (with hot reload):

bun run dev

Production Mode: Build and run with Docker (recommended):

docker compose up -d app

🔐 Accessing Production Services (SSH Tunnel)

For security, the Production Database and API are not exposed to the public internet by default. They are only accessible via localhost on the server.

To access them from your local machine, use the included SSH tunnel script.

  1. Add your VPS details to your local .env file:

    VPS_USER=root
    VPS_HOST=123.45.67.89
    
  2. Run the remote connection script:

    bun run remote
    

This will establish secure tunnels for:

📜 Scripts

  • bun run dev: Start the bot and API server in watch mode.
  • bun run remote: Open SSH tunnel to production services.
  • bun run generate: Generate Drizzle migrations.
  • bun run migrate: Apply migrations (via Docker).
  • bun run db:studio: Open Drizzle Studio to inspect the database.
  • bun test: Run tests.

📂 Project Structure

├── bot             # Discord Bot logic & entry point
├── web             # REST API Server
├── shared          # Shared code (Database, Config, Types)
├── drizzle         # Drizzle migration files
├── scripts         # Utility scripts
├── docker-compose.yml
└── package.json

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

This project is licensed under the MIT License.

Description
No description provided
Readme 12 MiB
Languages
TypeScript 97.7%
Shell 1.9%
CSS 0.2%
Dockerfile 0.2%