Skip to content
OpenSmartRoute
Skillv1.0.0

fastify-best-practices

Guides development of Fastify Node.js backend servers and REST APIs using TypeScript or JavaScript. Use when building, configuring, or debugging a Fastify application — including defining routes, impl

by ilteoood(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from ilteoood/harness (skills/nodejs-development/fastify/SKILL.md) via skills.sh. Install upstream with npx skills add ilteoood/harness --skill fastify. Copyright stays with the author.

When to use

Use this skill when you need to:

  • Develop backend applications using Fastify
  • Implement Fastify plugins and route handlers
  • Get guidance on Fastify architecture and patterns
  • Use TypeScript with Fastify (strip types)
  • Implement testing with Fastify's inject method
  • Configure validation, serialization, and error handling

Quick Start

A minimal, runnable Fastify server to get started immediately:

import Fastify from 'fastify'

const app = Fastify({ logger: true })

app.get('/health', async (request, reply) => {
  return { status: 'ok' }
})

const start = async () => {
  await app.listen({ port: 3000, host: '0.0.0.0' })
}
start()

Recommended Reading Order for Common Scenarios

  • New to Fastify? Start with plugins.mdroutes.mdschemas.md
  • Adding authentication: plugins.mdhooks.mdauthentication.md
  • Improving performance: schemas.mdserialization.mdperformance.md
  • Setting up testing: routes.mdtesting.md
  • Going to production: logging.mdconfiguration.mddeployment.md

How to use

Read individual rule files for detailed explanations and code examples:

Core Principles

  • Encapsulation: Fastify's plugin system provides automatic encapsulation
  • Schema-first: Define schemas for validation and serialization
  • Performance: Fastify is optimized for speed; use its features correctly
  • Async/await: All handlers and hooks support async functions
  • Minimal dependencies: Prefer Fastify's built-in features and official plugins

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/ilteoood-harness-fastify/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

ilteoood-harness-fastify.ocm.jsonjson
{
  "ocm": "1",
  "id": "ilteoood-harness-fastify",
  "kind": "skill",
  "name": "fastify-best-practices",
  "description": "Guides development of Fastify Node.js backend servers and REST APIs using TypeScript or JavaScript. Use when building, configuring, or debugging a Fastify application — including defining routes, implementing plugins, setting up JSON Schema validation, handling errors, optimising performance, managing authentication, configuring CORS and security headers, integrating databases, working with WebSockets, and deploying to production. Covers the full Fastify request lifecycle (hooks, serialization, logging with Pino) and TypeScript integration via strip types. Trigger terms: Fastify, Node.js server, REST API, API routes, backend framework, fastify.config, server.ts, app.ts.",
  "publisher": "ilteoood",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "coding"
    ],
    "tags": [
      "skill-md",
      "fastify",
      "nodejs",
      "typescript",
      "backend",
      "api",
      "server",
      "http",
      "skills-sh"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Guides development of Fastify Node.js backend servers and REST APIs using TypeScript or JavaScript. Use when building, configuring, or debugging a Fastify application — including defining routes, implementing plugins, setting up JSON Schema validation, handling errors, optimising performance, managing authentication, configuring CORS and security headers, integrating databases, working with WebSockets, and deploying to production. Covers the full Fastify request lifecycle (hooks, serialization, logging with Pino) and TypeScript integration via strip types. Trigger terms: Fastify, Node.js server, REST API, API routes, backend framework, fastify.config, server.ts, app.ts."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "skills.sh",
      "repository": "https://github.com/ilteoood/harness",
      "path": "skills/nodejs-development/fastify/SKILL.md",
      "ref": "HEAD",
      "url": "https://www.skills.sh/ilteoood/harness/fastify-best-practices",
      "key": "ilteoood/harness/skills/nodejs-development/fastify/SKILL.md"
    }
  },
  "instructions": "## When to use\n\nUse this skill when you need to:\n- Develop backend applications using Fastify\n- Implement Fastify plugins and route handlers\n- Get guidance on Fastify architecture and patterns\n- Use TypeScript with Fastify (strip types)\n- Implement testing with Fastify's inject method\n- Configure validation, serialization, and error handling\n\n## Quick Start\n\nA minimal, runnable Fastify server to get started immediately:\n\n```ts\nimport Fastify from 'fastify'\n\nconst app = Fastify({ logger: true })\n\napp.get('/health', async (request, reply) => {\n  return { status: 'ok' }\n})\n\nconst start = async ()",
  "cost": {
    "context_tokens": 737
  }
}

Fetch it by URL: GET /api/v1/registry/ilteoood-harness-fastify/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.