How underctrl-io/welcomer-bot works
Main Components
• API Component:
• Built with Express, using TypeScript.
• Manages authentication (JWT) and makes use of MongoDB (with Mongoose) for persistent data and Redis (via ioredis) for caching.
• Contains middleware, models, utility functions (like the Discord API helper), and is structured with clear separation (e.g., routes, lib, and middleware directories).
• Bot Component:
• Uses Discord.js and CommandKit.
• Handles event listeners (like guildMemberAdd and ready) and processes commands (organized under commands/ folders).
• Makes HTTP requests to the API (using Axios) for operations that require backend support.
• Dashboard Component:
• A React-based frontend built with Vite, styled using Tailwind CSS and DaisyUI.
• Implements state management (Jotai) and data fetching (TanStack Query), and uses React Router for client-side routing.
• Provides a user-friendly interface for configuration and management, interfacing with the API via HTTP (Axios).
Displaying Relationships and Interactions
• The Dashboard sending REST API requests to the API.
• The Bot interacting with the API to fetch or update information.
• Possibly token-based or session-based authentication in the API, impacting both the Bot and Dashboard interactions.
• Communication channels (HTTP/HTTPS for Dashboard and Bot) and show that both use Axios for making network requests.
Important Architectural Patterns & Design Principles
• Component Separation: Each major section (API, Bot, Dashboard) is decoupled so each can be developed and deployed independently.
• Modular Structure: Within the API, separate modules (routes, middleware, models, utilities) indicate a modular architecture.
• Use of Standard Technologies: Emphasize use of Express, Mongoose, ioredis, Discord.js, React, and Vite as the backbone frameworks/libraries.
• Full-Stack Integration: The design should highlight that while each service is independent, they all converge to serve the Discord bot’s functionality and developer’s needs.
Final Touches
• To capture the overarching flow that begins with user or bot events, proceeding through the API, and reflected in the Dashboard.