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

rayze

v0.2.0-beta.8

Published

Rayze is a web framework for easy use base on fastify

Readme

Rayze

Rayze is a web framework for easy use base on fastify

Convention over configuration

Use

1. init

bun init

2. install

bun install rayze

3. run

Add script in package.json

  "scripts": {
    "dev": "rayze",
    "pkg": "rayze build"
  },

4. tsconfig.json

{
  "compilerOptions": {
    // Enable latest features
    "target": "ESNext",
    "module": "ESNext",
    "moduleDetection": "force",
    "jsx": "react-jsx",

    // Bundler mode
    "moduleResolution": "bundler",
    "allowImportingTsExtensions": true,
    "verbatimModuleSyntax": true,
    "noEmit": true,

    // Best practices
    "strict": true,
    "skipLibCheck": true,
    "noFallthroughCasesInSwitch": true,

    // Some stricter flags (disabled by default)
    "noUnusedLocals": false,
    "noUnusedParameters": false,
    "noPropertyAccessFromIndexSignature": false,

    // typeorm
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "strictPropertyInitialization": false
  }
}

Route

1. create route

- src
  - routes
    - hello.ts

And hello.ts will auto gen http://localhost:8080/hello

import { Route } from 'rayze'

export default {
  handler: async (req) => {
    console.log(req.query())
    return 'hello rayze!'
    // return { xxx: yyy }  // or json
  },
} as Route

2. custom url

import { Route } from 'rayze'

export default {
  method: 'POST',
  url: '/user/:id',
  handler: async (req, reply) => {
    req.param()
    reply.status(500)
    return ''
  },
} as Route

Orm

rayze use typeorm

1. config

touch .env

DB_TYPE=postgres
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=postgres
DB_USERNAME=postgres
DB_PASSWORD=123456
DB_SYNCHRONIZE=true

2. install drive

bun install pg

3. create model

- src
  - models
    - user.ts

And user.ts

import { Column, Entity, Model } from 'rayze'

@Entity({ name: 'user' })
export class User extends Model {
  @Column({ name: 'nickname' })
  nickname: string

  @Column({ name: 'username', nullable: true })
  username?: string
}

4. use orm

const { manager } = this.orm // this is the fastify instant

const find = await manager.findOneBy(User, { id: 1 })

Hook

1. add hook file

you can add anything what you like of startup.ts

-src
  - hooks
    - startup.ts

And startup.ts

export default {
  async onReady() {
    this.orm.xxx // code your startup
  },
  async onRequest(req, reply) {
    this.log.info('income') // this is the fastify instance
  },
  // or anything fastify hook
} as Hook

all the fastify hooks, and ext preReady application hook that run before onReady.

KeyValue Cache

By default, in-memory caching is used.

When the REDIS_URL environment variable is set, Redis will be used.

this.cache.get('key')
this.cache.set('key', anyValue, expireMsNum)

Deploy

1. build single file

bun pkg
./dist/app

2. build as docker

touch Dockerfile and run docker build -t appName:version .

FROM oven/bun:alpine as builder
WORKDIR /workspace
COPY package.json ./
RUN bun install
COPY ./ ./
RUN bun pkg

FROM alpine
RUN apk --no-cache add libstdc++
WORKDIR /workspace
ENV MODE=production \
    PORT=8080
HEALTHCHECK --interval=5s --timeout=3s --retries=5 --start-period=5s \
    CMD wget --spider http://127.0.0.1:$PORT/rayze/health || exit 1
COPY --from=builder /workspace/dist/app /workspace/app
EXPOSE $PORT
ENTRYPOINT ["./app"]

3. build as docker with js

Touch Dockerfile

FROM oven/bun:1.2-alpine AS builder
WORKDIR /workspace
ENV MODE=production \
  PORT=8080
EXPOSE $PORT
HEALTHCHECK --interval=5s --timeout=3s --retries=5 --start-period=5s \
  CMD wget --spider http://127.0.0.1:$PORT/rayze/health || exit 1
COPY dist/app.js ./
COPY dist/app.js.map ./
ENTRYPOINT ["/bin/sh", "-c", "bun app.js"]

And run

bun pkg -j true
docker build -t appName:version .

Dev

Install local

package.json

{
  "dependencies": {
    "rayze": "file:../rayze"
  }
}