fastify-papr

Register typed Papr models in Fastify with type augmentation and MongoDB validation error handling.

4|1|Updated Aug 7, 2022
One-click install
npx skills add https://github.com/inaiat/fastify-papr --skill fastify-papr
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fastify-papr
Source: https://github.com/inaiat/fastify-papr/tree/main/skill
Command: npx skills add https://github.com/inaiat/fastify-papr --skill fastify-papr

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill helps developers integrate @inaiat/fastify-papr into Fastify services, enabling typed Papr models, type augmentation for FastifyPapr, and robust handling of MongoDB schema validation errors.

Core Features & Use Cases

  • Type-safe model registration: Register Papr models with asCollection and access them via fastify.papr, supporting single-database and multi-database setups.
  • Type augmentation patterns: Declare and augment the FastifyPapr interface to reflect your app's model surface and connection structure.
  • Validation error handling: Use MongoDB validation helpers such as isMongoServerError and extractValidationErrors to return structured error details.
  • Runtime and packaging guidance: Follow the ESM-only runtime constraints and recommended dependency layout for reliable operation.

Quick Start

Install the plugin, register fastify-mongodb first, then register @inaiat/fastify-papr with your Db and asCollection models.

Frequently Asked Questions about fastify-papr

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I register typed Papr models in a Fastify service?

Typed Papr model registration in Fastify involves registering @fastify/mongodb first, then registering @inaiat/fastify-papr with your database and asCollection models to access them via fastify.papr.

Can I use Fastify Papr integration with multiple MongoDB databases?

Fastify Papr integration supports multi-database setups by registering typed Papr models across multiple databases, using type augmentation patterns to declare the FastifyPapr interface and reflect your app's connection structure.

What runtime requirements are needed for fastify-papr?

Fastify-papr requires an ESM-only runtime environment with Node 22.12+, Fastify 5.8+, and MongoDB driver 7+. You must install fastify, @fastify/mongodb, mongodb, papr, and @inaiat/fastify-papr as dependencies.

How do I handle MongoDB schema validation errors in Fastify?

To handle MongoDB schema validation errors in Fastify, use built-in validation helpers like isMongoServerError and extractValidationErrors to catch issues and return structured error details from your Papr models.

What is the best way to add type augmentation for FastifyPapr?

The best way to add type augmentation for FastifyPapr is to declare and augment the FastifyPapr interface, ensuring TypeScript correctly reflects your application's specific model surface and database connection structure.