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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@sleekify/sleekify-fastify

v1.2.6

Published

A TypeScript decorator driven approach for developing Fastify web applications.

Readme

Sleekify Fastify Integration

This project's goal is to simplify the development of REST web services in NodeJS by bringing the best of the Java API for RESTful Web Services (JAX-RS) to TypeScript. This is possible since TypeScript decorators may be used in a manner similar to Java annotations. This project allows you to apply decorators to your resource classes to identify your REST resources and associate them with OpenAPI definitions. This allows you to maintain your API documentation alongside your code using typed definitions. If you ever had to maintain a large OpenAPI specification by hand, this should grab your attention. Your API documentation will both match the OpenAPI specification's schema and be generated from your code.

Versions

| Sleekify | Fastify | Node.js | OpenAPI Specification | | -------- | ------- | ------- | --------------------- | | 1.0.0+ | 5.0.0+ | 20 | 3.1.1 |

Getting Started

  1. First, install Sleekify and the Fastify integration

    npm install @sleekify/sleekify
    npm install @sleekify/sleekify-fastify
  2. Create REST resources using the provided decorators src/v1/users.ts

    import { type FastifyReply, type FastifyRequest } from 'fastify';
    import { DELETE, GET, Path, POST, PUT, Schema } from '@sleekify/sleekify';
    
    @Path('/v1/users')
    export class UsersResource {
      @POST()
      async createOne (request: FastifyRequest, reply: FastifyReply) {
        // TODO: your create user code here
      }
    
      @GET()
      async getMany (request: FastifyRequest, reply: FastifyReply) {
        // TODO: your query users code here
      }
    }
    
    @Path({
      path: '/v1/users/{id}',
      parameters: [
        {
          $ref: '#/components/parameters/id'
        }
      ]
    })
    @Schema({
      $ref: '#/components/schemas/user'
    })
    export class UsersIdResource {
      @GET()
      async getOne (request: FastifyRequest, reply: FastifyReply) {
        // TODO: your read user code here
      }
       
      @PUT()
      async updateOne (request: FastifyRequest, reply: FastifyReply) {
        // TODO: your update user code here
      }
       
      @DELETE()
      async deleteOne (request: FastifyRequest, reply: FastifyReply) {
        // TODO: your delete user code here
      }
    }
  3. Create your base OpenAPI specification src/openapi.ts

    import { OpenAPIObject } from '@sleekify/sleekify';
       
    export const specification: OpenAPIObject = {
      openapi: '3.1.1',
      info: {
        title: 'Test API',
        version: '1.0.0'
      },
      components: {
        parameters: {
          id: {
            description: 'The identifier of the resource',
            name: 'id',
            in: 'path',
            required: true,
            schema: {
            $ref: '#/components/schemas/id'
          }
        },
        schemas: {
          id: {
            description: 'The id path parameter schema',
            type: ['integer']
          },
          user: {
            type: ['object'],
            properties: {
              id: {
                type: ['number']
              },
              name: {
                type: ['string']
              }
            }
          }
        }
      }
    };
  4. Register your OpenAPI specification and resources with Fastify src/index.ts

    import Fastify from 'fastify';
    import { Annotation, Path } from '@sleekify/sleekify';
    import { Sleekify } from '@sleekify/sleekify-fastify';
    import { specification } from './openapi';
       
    const fastify = Fastify({
      logger: true
    });
       
    async function run () {
      // 1. Find all of your resource classes
      const classList = await Annotation.getClassesAnnotatedWith('./v1', Path);
      // 2. Create a Sleekify instance
      const sleekify = new Sleekify(specification, classList);
       
      // 3. Register Sleekify with Fastify
      await fastify.register(sleekify.getPlugin());
       
      fastify.listen({ port: 3000 }, function (error) {
        if (error != null) {
          fastify.log.error(error);
          process.exit(1);
        }
      });
    }
       
    void run();

API Documentation

For more information on the provided decorators, OpenAPI types, and web application errors see the Sleekify API Reference.