Syntic
← All skills
EngineeringFreeCommunityv1.0.0

Backend Developer

Use when building Node.js backend APIs with Express, Fastify, middleware patterns, and performance optimization.

About this skill

Use when building Node.js backend APIs with Express, Fastify, middleware patterns, and performance optimization.

SKILL.md

backend-developer.SKILL.md

Place it in your Syntic skills folder. For Syntic Code, install in your local skills directory, review the contents and run it in a controlled environment first.

SKILL.md
---
name: Backend Developer
description: Use when building Node.js backend APIs with Express, Fastify, middleware patterns, and performance optimization.
category: Engineering
version: 1.0.0
tools: []
---

# Backend Developer

Build reliable, performant server applications prioritizing correctness, observability, and maintainable architecture over clever abstractions.

## Core Principles

- Every endpoint handles errors gracefully; unhandled promise rejections crash servers
- Validate all input at boundary using Zod, Joi, or built-in JSON Schema validation
- Keep controllers thin; extract business logic into service functions
- Prefer Fastify for new projects: 2-3x throughput over Express, better schema validation, built-in Pino logging

## Framework Selection

- Use Express 5+ when large middleware ecosystem or team familiarity matters
- Use Fastify 5+ when performance, schema validation, TypeScript support matter
- Use Hono for edge APIs or Cloudflare Workers
- Never mix frameworks in one service

## Project Structure

```
src/
  routes/         # Route definitions, input validation
  services/       # Business logic, pure functions
  repositories/   # Database access, query builders
  middleware/     # Auth, rate limiting, error handling
  plugins/        # Fastify plugins or middleware factories
  config/         # Configuration with envalid
  types/          # TypeScript interfaces, Zod schemas
```

## Middleware and Hooks

- Express: apply error handling last
- Fastify: use onRequest for auth, preValidation for checks, onError for centralized handling
- Request ID propagation using crypto.randomUUID() in first middleware
- helmet for security headers, cors with explicit origins, compression

## Database Access

- Use Prisma for type-safe ORM or Drizzle for SQL-first
- Repository functions only; controllers never import database client
- Connection pooling with PgBouncer; pool size = (CPU cores * 2) + 1
- Parameterized queries always; never interpolate user input

## Error Handling

- Base AppError class with statusCode, code, isOperational
- Throw operational errors (validation, not found, conflict)
- Log programmer errors and crash; let process manager restart
- Return structured errors: { error: { code: "...", message: "..." } }

## Performance

- Enable HTTP keep-alive; server.keepAliveTimeout higher than load balancer
- Streaming responses with node:stream/promises for large payloads
- Redis caching with ioredis for Cluster support
- Profile with node --inspect and Chrome DevTools; clinic.js for flamegraphs

## Before Completing

- Run tests: npm test or vitest run
- Run tsc --noEmit for type correctness
- Run lint: npm run lint
- Verify server starts: node dist/server.js or npx tsx src/server.ts

Install

Syntic App

  1. 1Create a dedicated folder for this skill in your local skills library.
  2. 2Place SKILL.md into that folder.
  3. 3Restart Syntic and invoke this skill on matching tasks.

Syntic Code (CLI)

  1. 1Save SKILL.md in your local Syntic Code skills directory.
  2. 2Keep related files in the same skill folder.
  3. 3Run in a safe environment and validate outputs.