@agentdoor/fastify adapter provides full plugin support with request decorators.
Installation
Quick Start
Complete Example
Here’s a full Fastify app with agent authentication:index.ts
How It Works
TheagentdoorPlugin automatically:
- Decorates requests: Adds
request.agentandrequest.isAgent - Mounts discovery:
GET /.well-known/agentdoor.json - Mounts registration:
POST /agentdoor/register(with JSON schema validation)POST /agentdoor/register/verify
- Mounts auth:
POST /agentdoor/auth - Adds auth hook:
onRequesthook validatesAuthorizationheaders on protected routes
Advanced Configuration
Protected Paths
Customize which paths require agent authentication:Passthrough Mode
Allow unauthenticated requests:Base Path
Mount AgentDoor routes under a custom prefix:Request Lifecycle Hooks
AgentDoor integrates seamlessly with Fastify’s hook system:Request Decorators
AgentDoor decorates Fastify requests with agent context:JSON Schema Validation
AgentDoor routes include built-in JSON schema validation:API Reference
agentdoorPlugin(app, options)
Fastify plugin that mounts all AgentDoor routes and decorators.
Options:
scopes(required): Scope definitionsprotectedPaths: Path prefixes requiring auth (default:["/api"])passthrough: Allow unauthenticated requests (default:false)basePath: Base path for AgentDoor routes (default:"")pricing: Price per scoperateLimit: Default rate limit configx402: X402 payment config
- Display name:
"agentdoor" - Encapsulation: Disabled (decorators visible to sibling routes)
TypeScript Support
FastifyRequest:
Fastify’s plugin system ensures AgentDoor decorators and hooks are available to all routes registered after the plugin.