NestJS + PostgreSQL + Redis + BullMQ
Enterprise backend architecture guidelines for NestJS modular design, PostgreSQL connection pooling, Redis BullMQ background jobs, and DTO validation.
- Formats
- 4 files
- AGENTS.md
- 57 lines
- CLAUDE.md
- 16 lines
- Languages
- TypeScript
- Updated
- Sep 2026
- Used by
- 4 projects
Writes .claude/skills/nestjs-postgres-redis/SKILL.md
$ curl -s --create-dirs -o .claude/skills/nestjs-postgres-redis/SKILL.md https://stackitfast.com/rules/nestjs-postgres-redis/SKILL.mdRule files
Works with Cursor · Claude Code · Windsurf · AGY
Architecture notes
Architecture Overview
Production conventions for scalable, enterprise-grade backend microservices and APIs with NestJS, PostgreSQL, Redis, and BullMQ.
Verified Real-World Adoption
This architecture is deployed in high-concurrency production platforms including Twenty CRM, ToolJet, Novu, AFFiNE, and Logto.
Key Architectural Nuances
- Redis Memory Policy Safety: Requires
noevictionpolicy to protect BullMQ queue integrity. - Dedicated Worker Topologies: Decouples HTTP request-response latency from asynchronous queue processing.
Frequently asked questions
Does this AGENTS.md work with Cursor, Claude Code, and Windsurf?
Yes — AGENTS.md is the open, cross-tool standard read by Cursor, Claude Code, Windsurf, and 30+ other agents. A dedicated .mdc file is also included for Cursor's native .cursor/rules format.
Why must Redis use the noeviction policy for BullMQ?
BullMQ stores job state, delayed-job timers, and queue metadata as Redis keys, and treats that data as durable. If Redis is allowed to evict keys under memory pressure using an LRU or LFU policy, it can silently delete in-flight or delayed jobs along with your cache entries, causing jobs to vanish with no error.
Why run BullMQ workers in a separate process from the API server?
A long-running or CPU-heavy job executing inside the same Node.js process as your HTTP API blocks the single-threaded event loop, causing unrelated API requests to stall. Running workers as dedicated processes isolates job execution from request latency and lets you scale API replicas and worker replicas independently.
Used in production
Explore all stacksOrca
1Agent CLIs stay the user's own. Orca adds the orchestration layer around them: isolated git worktrees, a PTY daemon that outlives the UI, and a relay for mobile steering. It can support new agents without bundling them.
Cal.com
1Splitting the tRPC-based web app from an independently versioned NestJS Platform API lets Cal.com serve both its own product and third-party developers from one monorepo, while Turborepo and per-integration app-store packages keep dozens of calendar/payment providers buildable and testable in isolation.
Fast Jev Compaction
Two Jev Noul questions per tool call, gated by a threshold in code, prune a transcript without rewriting it, and a thin hook adapter falls back to Claude Code's built-in summary whenever Jev fails or saves too little.
Open Code Review
A single static Go binary keeps the review engine fast and easy to distribute through npm, CI and IDE plugins. Putting deterministic diff/context analysis before a narrow LLM loop keeps reviews precise and cheap in tokens compared with general-purpose agents.