Node.js + Express + MongoDB
Production guidelines for Express REST APIs, Mongoose schema design, and MongoDB indexing/transaction discipline.
- Formats
- 4 files
- AGENTS.md
- 37 lines
- CLAUDE.md
- 15 lines
- Languages
- TypeScript
- Updated
- Sep 2026
- Used by
- 4 projects
Writes .claude/skills/node-express-mongodb/SKILL.md
$ curl -s --create-dirs -o .claude/skills/node-express-mongodb/SKILL.md https://stackitfast.com/rules/node-express-mongodb/SKILL.mdRule files
Works with Cursor · Claude Code · Windsurf · AGY
Architecture notes
Architecture Overview
Standardized production guidelines for Node.js, Express, and MongoDB via Mongoose — the default choice when a project’s data is naturally document-shaped (chat messages, notification payloads, flexible per-tenant configuration) rather than relational.
Verified Real-World Adoption
LibreChat (multi-model AI chat workspace) and Novu (notification infrastructure) both run Node.js/TypeScript + MongoDB in production, and Rocket.Chat uses the same combination for its real-time team communications platform.
Key Architectural Nuances
- Schemas Matter Even on a Schemaless Database: Mongoose schemas plus a Zod boundary layer are what actually prevent the “any shape of document can end up in this collection” failure mode that gives MongoDB its reputation for bugs.
- Indexes Are Opt-In, Not Automatic: Unlike a well-tuned PostgreSQL setup that at least logs slow queries, MongoDB will silently full-scan an unindexed filter forever — index discipline has to be deliberate, not reactive.
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.
Does MongoDB actually support transactions?
Yes, since MongoDB 4.0, multi-document ACID transactions are supported on replica sets (including a single-node replica set in development). The common misconception that MongoDB can't do transactions dates to pre-4.0 versions; as of any current deployment, if an operation needs to atomically touch more than one document or collection, a session-based transaction is the correct tool, not application-level compensating logic.
When should a field be embedded versus referenced with an ObjectId?
Embed when the data is always fetched together with its parent and has a bounded size (a user's address, a project's settings). Reference when the data is queried independently of its parent, grows without a practical bound (comments, activity logs), or is shared across multiple parent documents. Getting this wrong in the embed direction is how documents hit the 16MB size limit.
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.
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.
Rocket.Chat
Combining full on-premises MongoDB ownership with real-time WebSockets gives enterprise organizations secure, private communication without third-party surveillance.