How hydradevx/hypr works
Project type and purpose
• This is a monorepo full-stack application (built with PNPM workspaces + Turbo) comprising:
• A Node.js/TypeScript CLI “selfbot” that connects to Discord as a user account, loads commands & features modularly, and maintains internal state.
• An optional React/Vite Web UI that lets the user control the bot, view logs, edit RPC, etc.
• Purpose: provide a blazing-fast, fully-modular Discord selfbot framework with hot-reloadable config and plugin support.
File structure
• Top-level:
• .github CI & release workflows, lint config, scripts for cross-platform installation, Turbo and PNPM workspace configs.
• packages/selfbot: bot.ts (entry), web.ts (serves/launches Web UI), TSConfig, package.json.
• packages/selfbot/bot:
– commands/… (organized by category: activity, fun, general, moderation, raiding, tools, ui, utility).
– features/… (autoReact, invisibilityCloak).
– managers/… (state managers: afk, autoReact, raid).
– utils/… (config loader & watcher, logger, antiCrash, richPresence, updater, etc.).
• packages/web: React SPA (App.tsx, pages, components, Tailwind, theme hooks, Vite, etc.).
Extract key architecture notes from README
• Modular plugin & command system
• Hot-reloadable config.json
• Optional Web UI for controls & logs
• Discord RPC integration
• Cross-platform, lightning-fast setup
A. External:
• Discord Gateway & REST API (cloud)
• Discord client / user token
B. Core Selfbot (Node.js):
1. Entrypoints
– bot.ts: initializes modules, connects to Discord.
– web.ts: launches local HTTP server / WS for Web UI.
2. Config Manager (utils/config-read + watcher)
– Loads config.json → broadcasts reload events to features/managers.
3. Command Handler (bot/commands)
– Scans command directories → registers each command with Discord event listeners.
4. Feature Modules (bot/features)
– AutoReaction, Invisibility Cloak, etc.
5. State Managers (bot/managers)
– Maintain AFK state, raid status, etc.
6. Utility Modules (bot/utils)
– Logger, antiCrash, updater, richPresence (Discord RPC), usage loader, info loader…
7. Plugin Extension Points
– Hooks in command and feature loader for external plugins.
C. Optional Web UI (React SPA):
• Served by web.ts or static file server
• HTTP / WebSocket API ↔ core selfbot
– Controls endpoints (start/stop features, set prefix, etc.)
– Logs stream for Dashboard/Logs pages
– RPC editor & Settings via read/write config.json
Architectural patterns & design principles
• Monorepo with workspace isolation
• Command Pattern for commands
• Observer/Event-Emitter for config hot-reload & Discord events
• State Management via dedicated managers
• Modular, plugin-friendly directory structure
• MVC-style separation in Web UI (pages, components, theme store)
• Clearly distinguish synchronous (HTTP) vs. asynchronous/event flows (WebSocket, Discord events).