fastify

fastify is a cursor rule for Cursor from blockmatic/basilic. It costs 0 tokens per session (578 once invoked), scanned A, original, MIT.

A set of rules for developing backend services with Fastify, a TypeScript- and JavaScript-based web framework for building servers.

In plain words
What is it for?
Use it when creating, changing, or reviewing Fastify server code.
Why use it?
It gives backend work a consistent set of project-specific patterns and standards.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when creating, changing, or reviewing Fastify server code.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/blockmatic/basilic/fastify
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/blockmatic/basilic

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for fastify

README.md
[![agentmods](https://agentmods.dev/badge/rules/blockmatic/basilic/fastify/github.svg)](https://agentmods.dev/rules/blockmatic/basilic/fastify)
Your own site
<a href="https://agentmods.dev/rules/blockmatic/basilic/fastify"><img src="https://agentmods.dev/badge/rules/blockmatic/basilic/fastify/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for fastify

Your own site · 80×15
<a href="https://agentmods.dev/rules/blockmatic/basilic/fastify"><img src="https://agentmods.dev/badge/rules/blockmatic/basilic/fastify.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 578 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.00578
Opus 5.5 $0.00000 $0.00231
Sonnet 5.5 $0.00000 $0.00116
Haiku 4.5 $0.00000 $0.00058

Measured 1mo ago against content hash fdebd65fc7c0, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

fastify scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/backend/fastify.mdc · 33 lines

What it actually says

  • CRITICAL: Never edit @repo/db SQL migrations or OpenAPI schema files directly.

    • All DB changes MUST follow the Drizzle standard migration flow: update schema TypeScript (packages/db/src/schema/tables/*.ts), then pnpm --filter @repo/db db:generate—never touch generated migration SQL files.
    • OpenAPI schemas are autogenerated from API route code. Never modify generated OpenAPI files manually; always update the route schemas instead.
  • Each endpoint in its own file. Structure mirrors URL path: routes/{domain}/{group}/{action}.ts. Examples: routes/auth/magiclink/request.ts, routes/auth/magiclink/verify.ts

  • Keep handler code lean inside the route definition to leverage typescript inference (typebox schema based)

  • Collocate route definition, handler and typebox schema

  • Keep routes focused/single-purpose, use route grouping, thin handlers

  • Use @sinclair/typebox route schemas

  • Avoid unnecessary validations - Fastify already validates inputs based on route schemas

  • Pass logger: request.log to @repo/error for Fastify's Pino logger with request context.

  • Routes can throw - global handler catches/formats

  • Prefer the app error catalog in the global error handler; @fastify/sensible is optional and not registered by default

Testing

  • Use fastify.inject() for integration testing
  • Vitest ESM-native, tests TypeScript source directly (not built output)
  • CRITICAL: pglite does NOT support concurrent writers reliably. Vitest parallelizes. Control worker boundaries and DB lifecycle strictly.
  • Group entry pattern: routes/{domain}/{group}/{group}.spec.ts is the only Vitest-discovered file per group. Owns Fastify + DB lifecycle. Imports route-level test modules
  • Route-level tests: routes/{domain}/{group}/{endpoint}.test.ts contains pure test definitions (describe/it). No Fastify bootstrapping, no DB setup/teardown. Executes in same worker as importing .spec.ts
  • Vitest config: include: ['**/*.spec.ts'] only. Never include *.test.ts in include patterns, handle pglite db instantiation and teardown removal per worker.
  • Naming: *.spec.ts = test entrypoints/worker boundary, *.test.ts = imported test modules. Do not mix .e2e-spec.ts, .spec.ts, .test.ts arbitrarily
  • Parallelism: Vitest runs test files in parallel, not describe() blocks or imports. Imported files execute in same worker. DB initialized once per group entry file
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed fdebd65fc7c0
  2. 2mo ago Changed · -548 tokens per session 14214f06d572
  3. 2mo ago First seen · 33 lines · 548 tokens per session scan A b28e603bffef

Subscribe to this mod's changes

fastify is a cursor rule published in the GitHub repository blockmatic/basilic (90 stars, last pushed 22d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 578 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

fastify compared with cursor rules from other repositories

fastify next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
fastifyblockmatic/basilicCursor rule9022d agoMITA0Cursor
trigger.basicagentset-ai/agentsetCursor rule2.1k9d agoMITA1,354Cursor
handle-rate-limiting-responsesPaulJPhilp/EffectPatternsCursor rule8064mo agoMITA1,598Cursor
control-repetition-with-schedulePaulJPhilp/EffectPatternsCursor rule8064mo agoMITA520Cursor
define-a-type-safe-configuration-schemaPaulJPhilp/EffectPatternsCursor rule8064mo agoMITA267Cursor
hatch3r-scalabilityhatch3r/hatch3rCursor rule261mo agoMITA0Cursor
pn-rust-backendperniemann/pnCoreCursor rule05d agoMITA0Cursor