Skip to content
Back to skills

Express Api Mean

ASecurity

Express.js API architecture for MEAN stack apps. Use when designing REST endpoints, middleware chains, authentication flows, error handling contracts, and request/response schemas.

  • 3 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added May 26, 2026
developmentexpressapibackendsecurity

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 express-api-mean --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Express Api Mean?

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

Security grade badge for Express Api Mean
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/endorphin-ai-express-api-mean/badge)](https://www.skillsdirectory.com/skills/endorphin-ai-express-api-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: express-api-mean
description: "Express.js API architecture for MEAN stack apps. Use when designing REST endpoints, middleware chains, authentication flows, error handling contracts, and request/response schemas."
---

# Express Api Mean

## Purpose

Design REST API architectures for MEAN stack applications using Express.js. Produce endpoint contracts, middleware chains, authentication flows, error handling patterns, and request/response schemas that backend developers implement directly.

## Key Patterns

### REST Endpoint Design
- Resource-based URLs: /api/users, /api/posts, /api/posts/:id/comments
- HTTP methods: GET (read), POST (create), PUT (full update), PATCH (partial update), DELETE (remove)
- Consistent success response: `{ success: true, data: {...}, pagination: {...} }`
- Consistent error response: `{ success: false, error: { code, message, details } }`

### Middleware Architecture
Request flow: CORS -> Body Parser -> Rate Limiter -> Auth -> Validation -> Controller -> Response
- Global middleware: CORS, body-parser, morgan (logging), helmet (security headers), compression
- Route middleware: auth (JWT verify), validate (Joi/express-validator), authorize (role check)
- Error middleware: Global error handler as last middleware

### Authentication Flow (JWT)
1. POST /api/auth/register -> hash password -> save user -> return JWT
2. POST /api/auth/login -> verify credentials -> return JWT + refresh token
3. POST /api/auth/refresh -> verify refresh token -> return new JWT
4. Protected routes: Authorization: Bearer <token> header -> verify middleware

### Controller Pattern
- Use asyncHandler wrapper to avoid try/catch boilerplate
- Use ApiError class for consistent error throwing
- All list endpoints include pagination (page, limit, total, pages)
- Sort by -createdAt by default (newest first)

## Conventions

- All routes prefixed with /api/
- Use plural nouns for resources: /users not /user
- Nested resources max 2 levels: /posts/:id/comments
- HTTP status codes: 200 (OK), 201 (Created), 400 (Bad Request), 401 (Unauthorized), 403 (Forbidden), 404 (Not Found), 409 (Conflict), 422 (Validation), 500 (Server Error)
- Validate request body with Joi or express-validator
- Pagination on all list endpoints (default: page=1, limit=20)
- Use express-rate-limit on auth routes (max 10 attempts per 15 min)
- Use helmet for security headers

## Knowledge Strategy

- **Patterns to capture:** Endpoint designs that worked well, middleware chains for common scenarios, auth patterns
- **Examples to collect:** Complete route files, controller patterns, middleware implementations
- **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 KB
  • FORMAT.md4.2 KB
  • SKILL.md2.7 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.