Fastify plugin that generates RESTful CRUD routes from Mongoose models. Current version 5.1.1, actively maintained. It auto-creates routes for list, search, details, create, modify, delete, and insert-many operations. Supports pagination, OpenAPI documentation, request validation via JSON Schema, and TypeScript definitions. Compared to alternatives like fastify-restify or mongoose-rest-store, this integrates tightly with Fastify and Mongoose and provides built-in search and populate capabilities.
npm install fastify-mongoose-restNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Create a Fastify app with CRUD routes for a Mongoose Cat model using fastify-mongoose-rest.
Use fastify.route(rest.list) for all route registrations.
Set logResponses: false if you do not want to log response bodies.
Ensure the model is created and exported before calling FastifyMongooseRest.
Check that the model is correctly imported and is a Mongoose Model instance.
Use import FastifyMongooseRest from 'fastify-mongoose-rest'.
Upgrade Fastify to version 4.x+ and ensure the plugin is imported correctly.