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.
Hello Peppermit Community,
For our Software architecture class, our team explored the Peppermint Ticket Manager codebase with runtime architecture in mind. In the course of our review, we noticed that there was no built‑in mechanism to observe real‑world runtimes of your API endpoints, ticket‑count operations were spread across multiple calls, and background tasks (like image resizing and email fetching) run without any concurrency controls—all of which can lead to hidden bottlenecks, wasted round trips, and an overburdened event loop.
To address these concerns, we’ve introduced a new performance logging middleware as a Fastify plugin that measures the execution time of each request via onRequest and onResponse hooks to log precise timings for each endpoint Fastify. This observability layer highlights slow endpoints and provides actionable data to guide further optimizations. We’ve also consolidated multiple ticket count queries into a single batched endpoint to reduce network latency and simplify client‑side logic. On the server side, CPU‑intensive tasks are offloaded into an async.queue with controlled concurrency to prevent event‑loop blocking. Email fetching in the IMAP service now uses p-limit to cap concurrent connections at five, avoiding resource saturation during heavy loads. Finally, we’ve integrated @fastify/rate-limit in main.ts to throttle API clients at 100 requests per 15‑minute window, protecting against abuse and smoothing traffic spikes. These runtime‑oriented refactors will help lower latency, stabilize throughput, and give us better visibility into performance bottlenecks.
We’d love to hear the community’s feedback!