How ssilve1989/ulti-project works
Project type and purpose
• This is a backend “monolithic” service built on NestJS that implements a Discord bot.
• It handles slash‐command interactions, persists data to Firebase (Firestore), integrates with external APIs (Discord Gateway/REST, Google Sheets, FFLogs GraphQL), runs scheduled jobs via cron, and reports to Sentry.
File structure
• src/app.module.ts wires together all NestJS modules.
• Major top‐level directories under src are:
– discord: Gateway connection, decorators, service for interacting with Discord.
– slash-commands: All slash command definitions, handlers, subcommands modularized by feature (signup, blacklist, lookup, status, settings, turboprog, etc.).
– firebase: Firestore collections, models, module.
– sheets: Google Sheets integration (config, service, utils, turbo-prog sheets).
– fflogs: GraphQL schema & SDK, module for FFLogs queries.
– jobs: Cron‐triggered background jobs (invite-cleaner, clear-checker, sheet-cleaner).
– role-manager, sentry: cross-cutting modules for authorization and monitoring.
• Configuration and infra files: Dockerfile, fly.toml (deployment), GitHub Actions workflows (CI, release, docker-image), tsconfig, schema.graphql, codegen.ts.
README
• (Empty in this case, but file names and config imply GraphQL code generation, NestJS CLI, pnpm, Husky for pre-commit, Vitest for tests.)
Main components and interactions
a. Internal components (all inside one NestJS application):
• Core NestJS application
• DiscordModule/Service – connects to Discord Gateway & REST
• SlashCommandsModule – dispatches incoming interactions to feature modules
• Feature modules: SignupModule, BlacklistModule, LookupModule, SettingsModule, StatusModule, TurboProgModule, FinalPush, RemoveRole, Retire
• FirebaseModule – Firestore data persistence for signups, settings, blacklist
• SheetsModule – read/write to Google Sheets (spreadsheet, turbo-prog)
• FFLogsModule – GraphQL client to FFLogs API
• JobsModule – scheduled tasks for housekeeping
• RoleManagerModule – role-based authorization
• SentryModule – error/tracing reporting
• AppSagas – orchestrates long-running flows/events
b. External services:
• Discord API (Gateway & REST)
• Firebase Firestore
• Google Sheets API
• FFLogs GraphQL API
• Sentry
c. Data flow:
1. Discord user invokes slash command → Discord Gateway/REST posts interaction to your NestJS HTTP controller (DiscordModule)
2. Router delegates to SlashCommandsService → specific command handler
3. Handler may read/write Firestore via FirebaseModule, call Google Sheets via SheetsModule, or fetch from FFLogsModule
4. Handlers emit domain events → AppSagas picks up events → triggers follow-on actions (e.g., assign roles, send approval messages)
5. Cron jobs in JobsModule periodically run housekeeping tasks that also interact with Firebase and Discord (via DiscordService)
6. All exceptions/traces reported to Sentry
Architectural patterns and design principles
• Modular Monolith – each feature in its own NestJS module
• CQRS/Events – command handlers and event handlers with sagas
• Dependency Injection – NestJS providers & modules
• Hexagonal/Onion hints – separation of external services behind modules (Firebase, Sheets, FFLogs)
– Label modules with key technologies (e.g., “FirebaseModule (Firestore)”, “SheetsModule (Google Sheets API)”).
– Ensure it captures scheduling (JobsModule) and event orchestration (AppSagas).