Get the FREE Ultimate OpenClaw Setup Guide →

node-backend

npx machina-cli add skill shahtuyakov/claude-setup/node-backend --openclaw
Files (1)
SKILL.md
2.9 KB

Node.js Backend

Patterns and best practices for Node.js backend development with TypeScript.

Framework Selection

FrameworkBest ForUse When
ExpressSimple APIs, flexibilityQuick setup, full control needed
NestJSEnterprise, structuredLarge teams, Angular-like structure
FastifyPerformance criticalHigh throughput, schema validation
HonoEdge, lightweightCloudflare Workers, minimal overhead

Reference Files

TopicLoadUse When
Project structurereferences/project-structure.mdSetting up new project or organizing code
Express patternsreferences/express-patterns.mdBuilding with Express
NestJS patternsreferences/nestjs-patterns.mdBuilding with NestJS
Auth implementationreferences/auth-patterns.mdImplementing authentication
Error handlingreferences/error-handling.mdSetting up error handling
Validationreferences/validation.mdInput validation patterns

Quick Start Patterns

Express Basic Setup

import express from 'express';
import cors from 'cors';
import helmet from 'helmet';
import { errorHandler } from './middleware/errorHandler';
import { routes } from './routes';

const app = express();

app.use(helmet());
app.use(cors());
app.use(express.json());

app.use('/api', routes);
app.use(errorHandler);

export { app };

NestJS Module Pattern

@Module({
  imports: [TypeOrmModule.forFeature([User])],
  controllers: [UsersController],
  providers: [UsersService],
  exports: [UsersService],
})
export class UsersModule {}

TypeScript Configuration

{
  "compilerOptions": {
    "target": "ES2022",
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "outDir": "./dist",
    "rootDir": "./src",
    "declaration": true
  }
}

Essential Packages

PackagePurpose
typescriptType safety
zodRuntime validation
bcryptPassword hashing
jsonwebtokenJWT handling
helmetSecurity headers
corsCORS handling
winston / pinoLogging
prisma / drizzleDatabase ORM

Code Quality Rules

  1. Always use TypeScript - strict mode enabled
  2. Validate all inputs - use Zod or class-validator
  3. Handle all errors - never swallow exceptions
  4. Use async/await - no callback hell
  5. Environment variables - use dotenv, never hardcode secrets
  6. Logging - structured logs with correlation IDs

Source

git clone https://github.com/shahtuyakov/claude-setup/blob/main/skills/node-backend/SKILL.mdView on GitHub

Overview

This skill covers Node.js backend development patterns using TypeScript across Express, NestJS, Fastify, and Hono. It provides project structure, code patterns, and best practices for building robust APIs, authentication flows, middleware, services, and server-side logic.

How This Skill Works

The guide presents framework-specific starter templates (Express, NestJS) and framework-agnostic references (project structure, auth, error handling, validation). It also enumerates essential TypeScript configuration, package choices, and coding standards used to enforce quality.

When to Use It

  • Building quick APIs with Express for flexibility and speed
  • Developing enterprise-grade backends with NestJS and strong structure
  • Optimizing performance for high-throughput services with Fastify
  • Deploying edge or lightweight apps with Hono on Cloudflare Workers
  • Creating a well-structured project using reference files, auth patterns, and code quality rules

Quick Start

  1. Step 1: Choose a framework (Express, NestJS, Fastify, or Hono) based on API needs.
  2. Step 2: Install essential packages (typescript, zod, bcrypt, jsonwebtoken, helmet, cors) and configure tsconfig.
  3. Step 3: Create a basic app using the corresponding quick start pattern (Express Basic Setup or NestJS Module Pattern) and wire in middleware, routes, and error handling.

Best Practices

  • Use TypeScript with strict mode
  • Validate all inputs with Zod or class-validator
  • Handle all errors; never swallow exceptions
  • Prefer async/await; avoid callback hell
  • Manage secrets via dotenv; never hardcode

Example Use Cases

  • Express Basic Setup: helmet, cors, json parsing, errorHandler, and routes
  • NestJS Module Pattern: UsersModule wired with TypeOrmModule and service/controllers
  • TypeScript Configuration: ES2022 target, NodeNext module resolution, strict mode
  • Reference Files usage: project-structure.md, express-patterns.md, auth-patterns.md
  • Auth implementation patterns using bcrypt and jsonwebtoken for JWT-based auth

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers