How kevinfinalboss/aurora works
Project Type and Purpose
• This is a standalone backend service: a Discord bot built on Node.js (discord.js) with support for shards, a database, AWS Parameter Store, scheduled tasks, and multiple external APIs (Riot, DDragon, Pterodactyl).
• It is not a traditional “full-stack” web app but rather a message-driven microservice that interacts bi-directionally with the Discord gateway and various third-party services.
File Structure Analysis
• Top level:
• index.js (entry point)
• Dockerfile & docker-compose.yml (deployment)
• package.json (dependencies)
• bot/discord/structures:
• client.js (initializes Discord.Client, shard manager, event router)
• configuration (reads config from JSON or AWS Parameter Store)
• database (connects to DB, defines repository + migrations)
• events (client & guild event handlers)
• commands & slashcommands (prefix-based and slash command handlers, grouped by domain: admin, info, music, ptero, quotation, utils, vlr)
• functions (utilities: logger, cache cleaning, wrappers for Riot & DDragon APIs)
• music, ptero, schedules (third-party integrations & cron jobs)
Key Behaviors from README
• Sharding: multiple connections to Discord gateway when >2,500 servers
• Hot-reload: dynamic reloading of commands/events without downtime
• Permissions & developer/guild-only flags per command
• Optional DB integration toggled via config
Main Components
a. Discord Bot Service
• Discord.Client + Shard Manager
• Command Handler (prefix + slash)
• Event Dispatcher
• Scheduler
• Configuration Loader (JSON & AWS Parameter Store)
• Database Layer (Connector + Repositories + Migrations)
• Utility Modules (Logger, CacheCleaner, RiotAPI, DDragonAPI, PteroClient)
b. External Systems
• Discord Gateway API
• AWS Parameter Store
• Database (e.g., MongoDB, Postgres)
• Riot Games APIs & Data Dragon
• Pterodactyl API
c. Deployment
• Docker Container
• docker-compose orchestration
Relationships & Data Flow
• At startup, Configuration Loader fetches env vars & secrets (local JSON or AWS).
• Bot Service initializes shards (Shard Manager) and connects to Discord Gateway.
• On Gateway events, Event Dispatcher routes to appropriate handler modules.
• Command Handler interprets prefix/slash commands, applies permission checks, then invokes business logic.
• Business logic may:
• Read/write from Database via Repositories
• Call external APIs (Riot, DDragon, Pterodactyl) via utility clients
• Schedule future jobs or quotes
• All actions are logged via Logger module.
Architectural Patterns & Principles
• Event-Driven Architecture: everything triggered by Discord Gateway events or cron schedules.
• Modular Handler Pattern: one directory per feature domain; each module exports metadata + run method.
• Dependency Injection (config toggles DB, shards).
• Single Responsibility: split config, commands, events, database, and external integrations.
• Hot-swap Reloaders: dynamic require/uncache for commands and events.