Skip to content
Back to skills

Backend Mean

ASecurity

Node.js + Express + MongoDB backend development for MEAN stack apps. Use when implementing server code: models, routes, controllers, middleware, config, and database connections.

  • 3 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added May 26, 2026
developmentgonodeexpressapidatabasebackendsecurity

Works with

  • api

Security analysis

A100/100

Pro scans all 7 files and shows the line behind each finding

Scanned May 27, 2026

npx -y skills add endorphin-ai/claude-code-teams --skill backend-mean --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Backend Mean?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Backend Mean
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/endorphin-ai-backend-mean/badge)](https://www.skillsdirectory.com/skills/endorphin-ai-backend-mean)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: backend-mean
description: "Node.js + Express + MongoDB backend development for MEAN stack apps. Use when implementing server code: models, routes, controllers, middleware, config, and database connections."
---

# Backend Mean

## Purpose

Implement Node.js + Express + MongoDB backends for MEAN stack applications. Translate database schemas and API contracts from architects into working server code: Mongoose models, Express routes, controllers, middleware, authentication, validation, and error handling.

## Key Patterns

### Project Structure
- server/config/ — DB connection, env validation, CORS config
- server/models/ — Mongoose model files
- server/routes/ — Express router files with index.js mount
- server/controllers/ — Business logic handlers
- server/middleware/ — auth.js, validate.js, errorHandler.js, asyncHandler.js
- server/utils/ — ApiError.js, ApiResponse.js, validators/

### Model Pattern
- Mongoose schema with fields, types, validators, required, enum, match
- timestamps: true on every schema
- toJSON transform removing __v and converting _id to id
- Pre-save middleware for password hashing (bcrypt, 12 rounds)
- Instance methods: comparePassword for auth
- select: false on password field

### Controller Pattern
- Every handler wrapped with asyncHandler (no try/catch needed)
- ApiError class for throwing errors with status codes
- All list endpoints: pagination with page, limit, total, pages
- Standard response: { success: true, data: {...} }
- Promise.all for parallel queries (count + find)

### Auth Pattern
- JWT signed with { id: user._id }, expiry 7d
- protect middleware: extract token from Authorization header, verify, attach user to req
- authorize middleware: check req.user.role against allowed roles
- Refresh token: separate longer-lived token (30d)

### Error Handler Pattern
- Global error middleware as last Express middleware
- Handles: Mongoose ValidationError (422), CastError (400), duplicate key 11000 (409)
- Stack trace only in development mode

## Conventions

- async/await everywhere with asyncHandler wrapper
- Custom ApiError class — throw instead of res.status().json()
- Environment variables in .env — validate on startup
- Passwords: bcryptjs with 12 salt rounds, select: false, never return in responses
- Use express-rate-limit on auth routes
- Use helmet for security headers, cors for cross-origin, morgan for logging
- NEVER return stack traces in production
- NEVER hardcode secrets

## Knowledge Strategy

- **Patterns to capture:** Working controller patterns, middleware chains, auth implementations
- **Examples to collect:** Complete server setup files, model definitions, route files
- **Update permission:** Agents may freely add/update files in `references/`. Changes to `SKILL.md` or `scripts/` require user approval.

Files in this skill

  • DRY_RUN.md2.3 KB
  • FORMAT.md2.7 KB
  • SKILL.md2.8 KB
  • VOICE.md1.8 KB
  • workflows/bugfix.md681 B
  • workflows/feature.md828 B
  • workflows/review.md634 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.