Project Structure
This page maps the folder layout of both the backend and frontend codebases.
Backend Source (backend/src/)
src/
├── index.ts # Main entry point - creates Manager, attaches anti-crash
├── manager.ts # Manager class - extends discord.js Client
├── @types/ # TypeScript type definitions
│ ├── Config.ts # Config interface (maps config.yml)
│ ├── Button.ts # Player button types
│ ├── Cluster.ts # Cluster/shard types
│ ├── Emoji.ts # Emoji configuration types
│ ├── Interaction.ts # Interaction types
│ └── Lavalink.ts # Lavalink connection types
├── @guild-helpers/ # Guild-level helper systems
│ ├── AssistanceHandler.ts # Helpdesk/ticket assistance automation
│ ├── ModLogHandler.ts # Moderation log event dispatcher
│ ├── StatisticsHandler.ts # User/guild statistics tracking
│ └── Modlog/ # Individual modlog event handlers
├── autofix/ # Lavalink auto-recovery
│ ├── AutoFixLavalink.ts # Automatic Lavalink failover
│ ├── CheckLavalinkServer.ts
│ └── GetLavalinkServer.ts
├── buttons/ # Player button interactions
│ └── Autoplay.ts, Loop.ts, Pause.ts, Skip.ts, Stop.ts, etc.
├── commands/ # Slash command categories
│ ├── Admin/ # Blacklist, Helpdesk, Maintenance, Premium, Tickets
│ ├── Filter/ # 26 audio filter commands
│ ├── Games/ # 12+ game commands including Music Trivia
│ ├── Info/ # About, Help, Stats, Privacy, Terms
│ ├── Music/ # 25 music commands (Play, Queue, Skip, Loop, etc.)
│ ├── Playlist/ # Playlist CRUD + Import + SaveQueue
│ └── Settings/ # 24/7, DJ Role, Language, Prefix, Setup, etc.
├── database/ # Database abstraction layer
│ ├── index.ts # DatabaseService - selects driver based on config
│ ├── @types.ts # DatabaseTable type (all table references)
│ ├── handler.ts # Post-connection handler (cleanup, migrations)
│ ├── keyChecker.ts # Validates database config keys at startup
│ ├── driver/ # Database driver implementations
│ │ ├── json.ts # JSON file driver
│ │ ├── mongodb.ts # MongoDB driver
│ │ ├── mysql.ts # MySQL driver
│ │ └── postgres.ts # PostgreSQL driver
│ ├── schema/ # TypeScript interfaces defining data models
│ └── setup/ # Database initialization
│ ├── table.ts # Registers all database tables
│ ├── setup.ts # Initial setup routines
│ ├── premium.ts # Premium expiry cleanup
│ └── lavalink.ts # Lavalink node persistence
├── events/ # Discord.js event handlers
│ ├── client/ # Client events (ready, error, etc.)
│ ├── guild/ # Guild events (join, leave, update)
│ ├── node/ # Lavalink node events (connect, disconnect, error)
│ ├── player/ # Music player events (trackStart, trackEnd, etc.)
│ ├── shard/ # Shard events (ready, disconnect, resume)
│ ├── track/ # Track events (resolve, error)
│ └── websocket/ # WebSocket events
├── gamecord/ # Game engine type declarations
├── handlers/ # Module loaders
│ ├── index.ts # Master handler - loads all sub-handlers
│ ├── loadCheck.ts # Lavalink autofix checker
│ ├── loadCommand.ts # Command and button loader
│ ├── loadEvents.ts # Event listener loader
│ ├── loadPlayer.ts # Player event loader
│ ├── Commands/ # Command-specific middleware
│ └── Player/ # Player-specific middleware
├── languages/ # Localization files (22 languages)
│ ├── en/ # English
│ ├── id/ # Indonesian
│ ├── ja/ # Japanese
│ └── ... # ar, cs, de, es, fr, he, hi, it, ko, nl, pl, pt, ru, th, tr, uk, vi, zh-CN, zh-TW
├── mewslink/ # Custom Lavalink client (Mewslink)
│ ├── Mewslink.ts # Main Mewslink class
│ ├── main.ts # MewslinkPlayer class
│ ├── metadata.ts # Version metadata
│ ├── Manager/ # Node and player management
│ ├── Node/ # Node connection handling
│ ├── Player/ # Player state management
│ ├── Plugin/ # Lavalink plugins
│ ├── Drivers/ # Lavalink protocol drivers
│ ├── Library/ # Discord.js library adapter
│ └── Utilities/ # Mewslink utilities
├── patreon/ # Patreon webhook event handler
├── services/ # Business logic services
│ ├── ConfigDataService.ts # Parses config.yml into typed config object
│ ├── DeployService.ts # Slash command deployment
│ ├── LoggerService.ts # Winston-based logging with daily rotation
│ ├── ManifestService.ts # Reads package.json metadata
│ ├── PatreonService.ts # Patreon pledge management
│ ├── KofiService.ts # Ko-fi donation management
│ ├── TopggService.ts # Top.gg vote tracking
│ ├── MysqlBackup.ts # Scheduled MySQL database backups
│ ├── TempVoiceService.ts # Temporary voice channel management
│ ├── FilterMenuService.ts # Audio filter select menu builder
│ ├── MusicTriviaService.ts# Music trivia game logic
│ ├── MusicTriviaSongBank.ts # Curated song bank (600+ tracks)
│ ├── SpotifyTopChartService.ts # Spotify top chart data
│ └── ...
├── shard/ # Sharding system
│ ├── index.ts # Shard entry point
│ ├── ClusterManager.ts # Cluster orchestration
│ ├── ClusterHealthReporter.ts
│ ├── bootloader.ts # Worker bootstrap
│ └── worker.ts # Worker process
├── structures/ # Core abstractions
│ ├── Command.ts # Base command class
│ ├── CommandHandler.ts # Command execution router
│ ├── Collection.ts # Extended Collection
│ ├── Localization.ts # i18n wrapper
│ ├── Mewslink.ts # Mewslink initializer
│ ├── Page.ts # Embed pagination
│ ├── PageQueue.ts # Queue pagination
│ └── QuickDatabasePlus.ts # Enhanced QuickDB wrapper with cache
├── utilities/ # Shared utility functions
│ ├── ConvertTime.ts # Time conversion helpers
│ ├── FormatDuration.ts # Duration formatting
│ ├── ProgressBar.ts # Track progress bar renderer
│ ├── RadioStations.ts # Radio station list
│ ├── ScrobbleToLastFM.ts # Last.fm scrobble utility
│ ├── SpotifygetAccessToken.ts # Spotify token refresh
│ ├── TopArtist.ts # Listening stats aggregation
│ ├── TopTrack.ts # Track stats aggregation
│ ├── BroadcastConfig.ts # Broadcast tips configuration
│ ├── NormalizeTrackMetadata.ts # Track metadata normalization
│ └── ...
└── web/ # Web server layer
├── RestAPI.ts # Fastify REST API server
├── WebServer.ts # Express server for webhooks
├── player.ts # Player REST routes
├── websocket.ts # WebSocket route for real-time player state
├── dashboard/ # Dashboard backend
│ ├── DashboardPlugin.ts # Fastify plugin - OAuth2, sessions, CORS, Socket.IO
│ ├── DiscordOAuth.ts # Discord OAuth2 helper
│ ├── SpotifyOAuthService.ts # Spotify OAuth2 flow
│ ├── UserProfileService.ts # User profile CRUD
│ ├── LikedSongsService.ts # Liked songs CRUD
│ ├── BotWsService.ts # Bot-to-dashboard WebSocket bridge
│ ├── SocketBridge.ts # Socket.IO bridge for real-time events
│ ├── AiChatService.ts # Gemini AI chat integration
│ ├── AiChatHistoryDb.ts # AI chat history database
│ └── SessionLoginService.ts # Session persistence
└── route/ # Individual REST route handlers
├── getCommands.ts
├── getTopServers.ts
├── getGlobalStats.ts
├── getUserStats.ts
├── getGuildStats.ts
├── getUserPlaylists.ts
├── getUserPremium.ts
├── guildSettings.ts
├── externalServices.ts
├── resolveDashboardAccess.ts
├── adminLegacyPremium.ts
├── adminBotProfile.ts
├── adminHelpdesk.ts
├── premiumClaim.ts
└── ...Frontend (frontend/)
frontend/
├── package.json # Dependencies: React, Radix UI, TailwindCSS, Vite
├── vite.config.ts # Vite build configuration
├── tailwind.config.ts # TailwindCSS configuration
├── tsconfig.json # TypeScript configuration
├── .env.example # Environment variable template
├── index.html # HTML entry point
├── public/ # Static assets
└── src/
├── App.tsx # Root component - routes, providers
├── main.tsx # Vite entry point
├── config/
│ ├── links.ts # External link definitions (invite, support, patreon, etc.)
│ └── team.json # Team member data
├── hooks/
│ ├── useAuth.tsx # Authentication context and provider
│ ├── usePlayer.ts # Player state management hook
│ ├── useSocket.ts # Socket.IO connection hook
│ ├── useLikedSongs.ts # Liked songs data hook
│ ├── useTrackColor.ts # Album art color extraction
│ └── use-mobile.tsx # Mobile detection hook
├── components/
│ ├── ui/ # Radix UI primitives (button, dialog, toast, etc.)
│ ├── dashboard/ # Dashboard-specific components
│ ├── BackgroundMusicPlayer.tsx
│ └── SmoothScroll.tsx
├── pages/
│ ├── Index.tsx # Landing page
│ ├── Commands.tsx # Commands list page
│ ├── Premium.tsx # Premium info page
│ ├── Login.tsx # Login page
│ ├── Dashboard.tsx # Server selector
│ ├── PlayerPage.tsx # Guild dashboard / player
│ ├── Profile.tsx # User profile
│ ├── GlobalStats.tsx # Global statistics
│ ├── SystemStatus.tsx # System status
│ ├── AdminDashboard.tsx # Admin panel
│ ├── Team.tsx # Team page
│ ├── InviteCallback.tsx # Bot invite callback
│ ├── PrivacyPolicy.tsx
│ ├── TermsOfService.tsx
│ ├── RefundPolicy.tsx
│ └── NotFound.tsx
└── lib/
├── config.ts # Runtime configuration (reads VITE_ env vars)
└── utils.ts # Shared utility functionsFrontend Routes
| Path | Component | Description |
|---|---|---|
/ | Index | Landing page |
/commands | Commands | Bot commands list |
/premium | Premium | Premium information |
/login | Login | Discord OAuth2 login |
/servers | Dashboard | Server selector |
/dashboard/:guildId/:view? | PlayerPage | Guild dashboard with player |
/profile | Profile | User profile and stats |
/global-stats | GlobalStats | Global bot statistics |
/systemstatus | SystemStatus | System status page |
/admin | AdminDashboard | Admin panel |
/team | Team | Team members |
/invite-callback | InviteCallback | Post-invite redirect |
/privacy | PrivacyPolicy | Privacy policy |
/termsofservice | TermsOfService | Terms of service |
/refundpolicy | RefundPolicy | Refund policy |
/player/:guildId | Redirect | Legacy redirect to /dashboard/:guildId |