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

fst-fastify

v0.0.7

Published

![Alt Fastify](https://www.fastify.io/images/fastify-logo-menu.d13f8da7a965c800.png 'Fastify')

Readme

Fastify runtime

Alt Fastify

Current Library is a wrapper around fastify

Main Features

Fastify service default configuration

  • Logging (TBD)
  • Metrics (TBD)
  • Event Loop Health (TBD)
  • Basic endpoints:
    • healthcheck under /api/health
    • swagger under /docs
  • Default plugins set:
    • Swagger
    • Registered Routes Logging

Plugin autodiscovery

Library do perform plugins autodiscovery under the src/server/plugins The following example describe fastify-sensible plugin registration Proper export default is important

import fp from 'fastify-plugin'
import sensible, { SensibleOptions } from 'fastify-sensible'
import { FastifyInstance } from 'fastify'

/**
 * This plugins adds some utilities to handle http errors
 *
 * @see https://github.com/fastify/fastify-sensible
 */
export default fp<SensibleOptions>(async (fastify: FastifyInstance) => {
  await fastify.register(sensible, {
    errorHandler: false
  })
})

RouteOptions - Primarily Fastapi Interface. Importing it gives you types definition. Detailed documentation can be found here export default route - is important to perform autodiscovery

RestAPI routes autodiscovery

Library do perform routes autodiscovery under the src/server/api and src/server/webhook paths

iac
└── ...
src
└── server
    └── api
        └── health
            └── get.ts
        └── carriers
            └── {carrierId}
                └── put.ts
            └── get.ts
    └── webhook
        └── test
            └── patch.ts
├── index.ts
├── ...
└── ...

With the example above, the next routes will be added

/GET api/health
/GET api/carriers/
/PUT api/carriers/{carrierId}

/PATCH webhook/test

Route definition example:

import { RouteOptions } from 'fst-fastify'

const route: RouteOptions = {
  handler: async function (request, reply) {
    reply.send({ status: 'ok' })
  }
}
export default route

RouteOptions - Primarily Fastapi Interface. Importing it gives you types definition. Detailed documentation can be found here export default route - is important to perform autodiscovery

Jobs autodiscovery

Jobs are autoloaded from the src/server/jobs folder

Example:

import { CronOptions } from 'fst-fastify'

const job: CronOptions = {
  cronTime: '0 0 0 * * * ',
  onTick: (server) => {
    // Do something
  }
}

export default job

Preparation to work

Before start working with the tool you need to generate a personalised gitlab token and add it to your system. Guideline can be found below

Install

npm i -D fst-fastify

Configuration

Add it to your index.ts in order to run application

import { start } from 'fst-fastify'

start()

Testing

Test Example using jest

import { app } from 'fst-fastify'

describe('Basic endpoints test', () => {
  it('Health check for service', async () => {
    let server = await app
    const response = await server.inject({
      method: 'GET',
      url: '/api/health'
    })

    expect(response.statusCode).toBe(200)
    expect(JSON.parse(response.body)).toStrictEqual({
      status: 'ok'
    })
  })

  it('Test swagger file initiallisation', async () => {
    let server = await app
    const response = await server.inject({
      method: 'GET',
      url: '/docs'
    })

    expect(response.statusCode).toBe(302)
    expect(response.headers.location).toStrictEqual('./docs/static/index.html')
  })
})