npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

elements-fastify

v0.0.1

Published

Fastify plugin for serving Stoplight Elements API documentation

Readme

elements-fastify 🚀

Fastify Plugin for Stoplight Elements API Documentation - Beautiful, Interactive, and Zero-Config API Documentation for Fastify Apps

Enhance your Fastify applications with stunning, interactive API documentation using Stoplight Elements. This plugin seamlessly integrates with your existing Fastify server to provide a professional documentation experience with minimal setup.

🌟 Features & Benefits

  • ✅ Interactive API Console - Test endpoints directly in the documentation
  • ✅ Zero Configuration - Get started in seconds with minimal setup
  • ✅ Beautiful UI - Modern, responsive design that developers love
  • ✅ OpenAPI 3.x Support - Full compatibility with OpenAPI specifications
  • ✅ Embedded Assets - No external dependencies or CDN requirements
  • ✅ Customizable - Easily configure titles and API spec URLs
  • ✅ SEO Optimized - Built-in meta tags for better search engine indexing

📦 Installation

npm install elements-fastify

🚀 Quick Start

Basic Setup

const fastify = require('fastify')({ logger: true });
const elements = require('elements-fastify');

// Register the elements-fastify plugin
fastify.register(elements, {
  apiDescriptionUrl: '/openapi.json',
  title: 'My API Documentation',  // Optional: custom page title
  path: '/docs'  // Optional: custom path (defaults to '/docs')
});

// Serve your OpenAPI specification
fastify.get('/openapi.json', (request, reply) => {
  reply.sendFile('path/to/your/openapi.json');
});

// Run the server!
fastify.listen({ port: 3000 }, (err, address) => {
  if (err) {
    fastify.log.error(err);
    process.exit(1);
  }
  console.log(`Documentation available at http://localhost:3000/docs`);
});

⚙️ Configuration Options

| Option | Type | Default | Description | | --- | --- | --- | --- | | apiDescriptionUrl | string | Required | URL to your OpenAPI specification (JSON or YAML) | | title | string | 'API Documentation' | Custom title for the documentation page | | path | string | '/docs' | Path to serve the documentation |

💡 How It Works

  1. The plugin serves both the static CSS and JavaScript files from the @stoplight/elements package and generates an HTML page that includes the Stoplight Elements web component
  2. The web component fetches your OpenAPI specification and renders interactive documentation
  3. Developers can browse endpoints, test APIs directly in-browser, and understand your API quickly

📄 Example OpenAPI Specification

Place your OpenAPI specification file in your project and serve it with Fastify:

fastify.get('/openapi.json', (request, reply) => {
  reply.sendFile('public/openapi.json');
});

🔍 Keywords

Stoplight Elements, Fastify plugin, API documentation, OpenAPI documentation, Swagger alternative, Redoc alternative, interactive API docs, REST API documentation, developer portal, API explorer, Fastify.js documentation, API reference, documentation generator, API visualization, OpenAPI 3.0, OpenAPI 3.1

📄 License

MIT