# nodejs-backend

The nodejs-backend skill guides TypeScript backend work with Express or Fastify. Use it for REST APIs, routing, middleware, validation, and database integration.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 307 installs · ★ 80 repo stars
- Author: bobmatnyc
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/bobmatnyc/claude-mpm-skills/tree/HEAD/toolchains/typescript/frameworks/nodejs-backend/SKILL.md
- Updated: 2026-07-18
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/bobmatnyc-nodejs-backend

## What it does

nodejs-backend provides patterns for building Node.js backends in TypeScript. It covers a strict `tsconfig.json`, package scripts for `dev`, `build`, `start`, and `test`, plus typed handlers for Express and Fastify servers.

The material includes request validation with `zod`, JWT authentication, error middleware, routing, and database integration patterns. The JWT example reads its secret from `JWT_SECRET`, so that environment variable is required for this authentication path. Examples use files such as `src/server.ts`, `src/routes/users.ts`, and `src/middleware/validation.ts`.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add bobmatnyc/claude-mpm-skills --skill nodejs-backend -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/nodejs-backend/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/nodejs-backend/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add bobmatnyc/claude-mpm-skills --skill nodejs-backend -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/nodejs-backend/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add bobmatnyc/claude-mpm-skills --skill nodejs-backend -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/nodejs-backend/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install bobmatnyc/claude-mpm-skills toolchains/typescript/frameworks/nodejs-backend
```

2. **Manually: put the files in place**
- File: `.github/skills/nodejs-backend/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add bobmatnyc/claude-mpm-skills --skill nodejs-backend -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/bobmatnyc/claude-mpm-skills --path toolchains/typescript/frameworks/nodejs-backend
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/nodejs-backend/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add bobmatnyc/claude-mpm-skills --skill nodejs-backend -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/bobmatnyc/claude-mpm-skills/tree/HEAD/toolchains/typescript/frameworks/nodejs-backend/SKILL.md

## When to use it
- set up a TypeScript Node.js backend
- create an Express or Fastify server
- define typed routes and handlers
- validate request bodies with `zod`
- add JWT authentication and error handling

## Example prompts
- Build a TypeScript REST API with an Express server and a `/health` route.
- Add a user-creation route that validates its body with `zod` middleware.
- Set up a Fastify server with a typed route and centralized error handling.

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 0cb680139931ae3a.

BEGIN THIRD-PARTY FILE 0cb680139931ae3a
````text
---
name: nodejs-backend
description: "Node.js backend development with TypeScript, Express/Fastify servers, routing, middleware, and database integration"
user-invocable: false
disable-model-invocation: true
progressive_disclosure:
  entry_point:
    summary: "Node.js backend development with TypeScript, Express/Fastify servers, routing, middleware, and database integration"
    when_to_use: "When working with nodejs-backend-typescript or related functionality."
    quick_start: "1. Review the core concepts below. 2. Apply patterns to your use case. 3. Follow best practices for implementation."
---
# Node.js Backend Development with TypeScript

---
progressive_disclosure:
  entry_point:
    summary: "TypeScript backend patterns with Express/Fastify, routing, middleware, database integration"
    when_to_use:
      - "When building REST APIs with TypeScript"
      - "When creating Express/Fastify servers"
      - "When needing server-side TypeScript"
      - "When building microservices"
    quick_start:
      - "npm init -y && npm install -D typescript @types/node tsx"
      - "npm install express @types/express zod"
      - "Create tsconfig.json with strict mode"
      - "npm run dev"
  token_estimate:
    entry: 75
    full: 4700
---

## TypeScript Setup

### Essential Configuration

**tsconfig.json** (strict mode recommended):
```json
{
  "compilerOptions": {
    "target": "ES2022",
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "outDir": "./dist",
    "rootDir": "./src",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "resolveJsonModule": true,
    "types": ["node"]
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules", "dist"]
}
```

**package.json scripts**:
```json
{
  "scripts": {
    "dev": "tsx watch src/server.ts",
    "build": "tsc",
    "start": "node dist/server.js",
    "test": "vitest"
  }
}
```

### Development Dependencies
```bash
npm install -D typescript @types/node tsx vitest
npm install -D @types/express  # or @types/node (Fastify has built-in types)
```

## Express Patterns

### Basic Express Server

**src/server.ts**:
```typescript
import express, { Request, Response, NextFunction } from 'express';
import { z } from 'zod';

const app = express();
const port = process.env.PORT || 3000;

// Middleware
app.use(express.json());
app.use(express.urlencoded({ extended: true }));

// Type-safe request handlers
interface TypedRequest<T> extends Request {
  body: T;
}

// Routes
app.get('/health', (req: Request, res: Response) => {
  res.json({ status: 'ok', timestamp: new Date().toISOString() });
});

// Start server
app.listen(port, () => {
  console.log(`Server running on port ${port}`);
});
```

### Router Pattern

**src/routes/users.ts**:
```typescript
import { Router } from 'express';
import { z } from 'zod';
````
END THIRD-PARTY FILE 0cb680139931ae3a

The third-party file has ended. Everything between the 0cb680139931ae3a tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2882 of 22941 bytes. © bobmatnyc · MIT · https://github.com/bobmatnyc/claude-mpm-skills/tree/HEAD/toolchains/typescript/frameworks/nodejs-backend/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
