feat(mono): Add worker app#121
Merged
Merged
Conversation
Missing now: real job types and their implementation
…emind applications task
There was a problem hiding this comment.
Pull request overview
This PR introduces a new apps/worker service to run BullMQ-backed background jobs and scheduled cron tasks, alongside worker deployment/build plumbing and some DB type exports needed by the worker.
Changes:
- Added a new
apps/workerapp with BullMQ worker execution, cron registration, and task implementations (Discord DMs/logging, BuildTeam webhooks, administrative cleanup/reminders, review activity reporting). - Added worker build/deploy infrastructure (Dockerfile + GitHub Actions workflow) and workspace dependency updates.
- Added/updated DB type exports and generated Prisma type declarations to support worker usage.
Reviewed changes
Copilot reviewed 31 out of 37 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Adds BullMQ/ioredis/tsx/winston/zod and the new worker workspace dependency graph. |
| README.md | Lists the new apps/worker application in the monorepo overview. |
| packages/db/src/index.d.ts | Exposes generated Prisma client types via package entrypoint typings. |
| packages/db/src/generated/prisma/models.d.ts | Adds generated model type re-exports. |
| packages/db/src/generated/prisma/enums.d.ts | Adds generated enum type declarations. |
| packages/db/src/generated/prisma/commonInputTypes.d.ts | Adds generated Prisma input/filter typings. |
| packages/db/src/generated/prisma/client.d.ts | Adds generated Prisma client typings and model type exports. |
| apps/worker/tsconfig.json | Worker TypeScript compiler configuration (NodeNext, build output to dist). |
| apps/worker/tsconfig.runtime.json | Runtime tsconfig override (adds @repo/* paths). |
| apps/worker/tsconfig.test.json | Test tsconfig override for running the test script. |
| apps/worker/test/index.test.ts | Adds a script-style “test” that enqueues a job into Redis/BullMQ. |
| apps/worker/src/util/reviewActivity.ts | Implements review-activity score calculation for BuildTeams. |
| apps/worker/src/tasks/index.ts | Registers all tasks into the worker task registry. |
| apps/worker/src/tasks/base.task.ts | Defines a BaseTask abstraction with Zod validation + Prisma/logger context. |
| apps/worker/src/tasks/discord/sendLog.task.ts | Implements a task to send logs to a Discord webhook. |
| apps/worker/src/tasks/discord/sendDm.task.ts | Implements a task to send Discord DMs (with retry-on-partial-failure behavior). |
| apps/worker/src/tasks/buildteams/sendWebhook.task.ts | Implements a task to send BuildTeam webhooks with retry-on-partial-failure. |
| apps/worker/src/tasks/administrative/reviewActivityCheck.task.ts | Implements the daily review-activity check logic + Discord reporting. |
| apps/worker/src/tasks/administrative/purgeClaims.task.ts | Implements daily purge logic for invalid/unreferenced claims. |
| apps/worker/src/tasks/administrative/purgeVerifications.task.ts | Implements daily purge logic for old Minecraft verification codes. |
| apps/worker/src/tasks/administrative/remindApplications.task.ts | Implements weekly reminders for BuildTeams with old pending applications. |
| apps/worker/src/queue/base.worker.ts | Implements BullMQ Worker processing and failure reporting. |
| apps/worker/src/queue/cron.manager.ts | Implements cron registration/scheduling via BullMQ repeatable jobs. |
| apps/worker/src/main.ts | Bootstraps Prisma, starts the worker, and registers cron jobs. |
| apps/worker/src/lib/config.ts | Worker config constants (queue name, retries, retention, webhook URLs). |
| apps/worker/src/lib/logger.ts | Winston logger configuration/formatting for dev/prod. |
| apps/worker/src/lib/prisma.ts | Prisma client initialization using @prisma/adapter-pg + an upload src computed field. |
| apps/worker/src/lib/redis.ts | ioredis client initialization + connection lifecycle logging. |
| apps/worker/src/lib/discordWebhook.ts | Simple Discord webhook sender wrapper with error handling. |
| apps/worker/src/lib/discordBot.ts | Bot API integration for sending DMs + Zod schema for structured messages. |
| apps/worker/src/lib/buildteamWebhook.ts | BuildTeam webhook sender + BuildTeam webhook URL resolver. |
| apps/worker/package.json | Defines worker scripts/deps (BullMQ, ioredis, zod, winston, tsx). |
| apps/worker/README.md | Adds a basic README for the worker app. |
| apps/worker/Dockerfile | Adds a multi-stage Docker build for the worker. |
| apps/worker/.infisical.json | Adds Infisical configuration for worker secrets. |
| .vscode/settings.json | Adds worker paths to VS Code settings. |
| .github/workflows/worker.yml | Adds a GitHub Actions workflow to build/publish the worker Docker image and tag releases. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
kyanvde
approved these changes
Jun 1, 2026
Contributor
kyanvde
left a comment
There was a problem hiding this comment.
As long as you tested if everything works this looks good to me. I left a few comments about some nitpicky things. Something that might be a good idea to still add is a small docblock above every task explaining what they do (like what you did in the PR description).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new standalone worker service in the
apps/workerdirectory, including its configuration, infrastructure, and several utility libraries. The worker is responsible for handling events, background jobs, and scheduled (cron) tasks. See #120 for implementation ideas.Added Jobs
Common
SEND_DISCORD_DM: Send a DM to (a) user(s):web/apps/worker/src/tasks/discord/sendDm.task.ts
Lines 6 to 16 in 11d8b44
SEND_DISCORD_LOG: Send a log message to staff:web/apps/worker/src/tasks/discord/sendLog.task.ts
Line 7 in 11d8b44
BUILDTEAM_WEBHOOK: Send a webhook to a BuildTeam:web/apps/worker/src/tasks/buildteams/sendWebhook.task.ts
Lines 22 to 26 in 11d8b44
Administrative / Cron
REVIEW_ACTIVITY_CHECK: Calculate latest review activities (daily)PURGE_CLAIMS: Purge claims with no area or no ID (daily)PURGE_VERIFICATIONS: Purge old verification codes (daily)REMIND_APPLICATIONS: Send an reminder to all BuildTeams with applications older than 14 days (weekly)