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 🙏

© 2024 – Pkg Stats / Ryan Hefner

fastify-redis-boilerplate

v1.0.1

Published

a fastify redis boilerplate

Downloads

10

Readme

nyan asd

Another fastify + redis boilerplate. The scope of this project is to offer a real fastify + redis use case (Redis it is used as main database).


npm nstall

npm i fastify-redis-boilerplate
./node_modules/.bin/build
npm install

myan asd

Requirements

  • nodejs lts
  • docker
  • fastify
  • redis

Preliminary step

  • fork the repo

Usage with Docker

Start
docker-compose -f docker-compose.debug.yml build
docker-compose -f docker-compose.debug.yml up
  • Builds, (re)creates, starts, and attaches to containers for a service.
Stop
docker-compose -f docker-compose.debug.yml down
  • Stops containers and removes containers, networks, volumes, and images created by up.
Tests
docker-compose -f docker-compose.tests.yml build
docker-compose -f docker-compose.tests.yml up --abort-on-container-exit --exit-code-from tests
Prod
docker build -t nyan-asd:latest .
Benchmark
docker-compose -f docker-compose.benchmarks.yml build
docker-compose -f docker-compose.benchmarks.yml up --abort-on-container-exit --exit-code-from benchmarks
  • by default benchmarks point to '0.0.0.0:3001'
Note on benchmarking

The configuration (tests/benchmarks/config.json)

{
  "tests" : [
    {
      "server" : "http://0.0.0.0:3001",
      "threads": 100,
      "duration": "10s",
      "connections": 100,
      "paths": [
        "/v1/reviews?accomodation=96e83a90-48da-4e81-9d06-7f1b76e5364e",
        ...
      ],
      "requirements": {
        "latencyAvg": 130,
        ...
        "latency99": 150
      }
    }
  ]
}

requirements:

  • latencyAvg
  • latencyStdev
  • latencyMax
  • latency50
  • latency75
  • latency90
  • latency99
  • requestsPerSec
  • non2xx3xx
Delete all containers
docker rm $(docker ps -a -q)
Delete all images
docker rmi $(docker images -q)
Delete all the volumes
docker volumes prune

Local Usage

Install
npm install
Debug

Run in debug mode with watch and debug capabilities

npm run debug
Start

Run in server mode without any extra tool or capability

npm start
Benchmark
npm run benchmark
Test

Run all the tests suite and the linter

npm test

alternatively you may want yo tag your test

it('Return status 404 @asd-307', (done) => {
  ...

and then use the --grep option

npm test -- --grep="asd-307"

also

npm test -- --grep="asd-307|unit"

Endpoints

Reviews

curl http://0.0.0.0:3001/v1/reviews\?accomodation=96e83a90-48da-4e81-9d06-7f1b76e5364e&limit=1

Result

{
   "collection":[
      {
         "key":"e54b1d94-5590-4410-9d4e-76b3ea1f2ce5",
         "accomodation":"96e83a90-48da-4e81-9d06-7f1b76e5364e",
         "along":"COUPLE",
         "travel":1470009600000,
         "submission":1472550180580,
         "general":10,
         "user":"Claus Duus Pedersen",
         "locale":"en",
         "texts":{
            "en":"Friendly staff - nice restaurants and Sporting Bar"
         },
         "titles":{
            "en":"Great camping site"
         },
         "aspects":{
            "location":10,
            "service":0,
            "priceQuality":9,
            "food":0,
            "room":0,
            "childFriendly":9,
            "interior":0,
            "size":0,
            "activities":0,
            "restaurants":0,
            "sanitaryState":0,
            "accessibility":0,
            "nightlife":0,
            "culture":0,
            "surrounding":0,
            "atmosphere":0,
            "noviceSkiArea":0,
            "advancedSkiArea":0,
            "apresSki":0,
            "beach":0,
            "entertainment":0,
            "environmental":0,
            "pool":10,
            "terrace":0
         },
         "scores":{
            "weight":0.7,
            "general":7,
            "aspects":{
               "location":7,
               "service":0,
               "priceQuality":6.3,
               "food":0,
               "room":0,
               "childFriendly":6.3,
               "interior":0,
               "size":0,
               "activities":0,
               "restaurants":0,
               "sanitaryState":0,
               "accessibility":0,
               "nightlife":0,
               "culture":0,
               "surrounding":0,
               "atmosphere":0,
               "noviceSkiArea":0,
               "advancedSkiArea":0,
               "apresSki":0,
               "beach":0,
               "entertainment":0,
               "environmental":0,
               "pool":7,
               "terrace":0
            }
         }
      }
   ],
   "scores":{
      "general":10,
      "aspects":{
         "location":{
            "general":10,
            "COUPLE":10
         },
         "service":{
            "general":0,
            "COUPLE":0
         },
         "priceQuality":{
            "general":9,
            "COUPLE":9
         },
         "food":{
            "general":0,
            "COUPLE":0
         },
         "room":{
            "general":0,
            "COUPLE":0
         },
         "childFriendly":{
            "general":9,
            "COUPLE":9
         },
         "interior":{
            "general":0,
            "COUPLE":0
         },
         "size":{
            "general":0,
            "COUPLE":0
         },
         "activities":{
            "general":0,
            "COUPLE":0
         },
         "restaurants":{
            "general":0,
            "COUPLE":0
         },
         "sanitaryState":{
            "general":0,
            "COUPLE":0
         },
         "accessibility":{
            "general":0,
            "COUPLE":0
         },
         "nightlife":{
            "general":0,
            "COUPLE":0
         },
         "culture":{
            "general":0,
            "COUPLE":0
         },
         "surrounding":{
            "general":0,
            "COUPLE":0
         },
         "atmosphere":{
            "general":0,
            "COUPLE":0
         },
         "noviceSkiArea":{
            "general":0,
            "COUPLE":0
         },
         "advancedSkiArea":{
            "general":0,
            "COUPLE":0
         },
         "apresSki":{
            "general":0,
            "COUPLE":0
         },
         "beach":{
            "general":0,
            "COUPLE":0
         },
         "entertainment":{
            "general":0,
            "COUPLE":0
         },
         "environmental":{
            "general":0,
            "COUPLE":0
         },
         "pool":{
            "general":10,
            "COUPLE":10
         },
         "terrace":{
            "general":0,
            "COUPLE":0
         }
      },
      "COUPLE":10
   }
}

Documentation

Check swagger.yml