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

@boostkit/contracts

v0.0.3

Published

Framework-level TypeScript contracts for HTTP, routing, middleware, and server adapters.

Downloads

856

Readme

@boostkit/contracts

Framework-level TypeScript contracts for HTTP, routing, middleware, and server adapters.

This package is type-only — it contains no runtime code. All @boostkit/* packages depend on it as the shared type language for HTTP primitives.

Installation

pnpm add @boostkit/contracts

Prefer import type in application code to guarantee zero runtime cost.


AppRequest

Normalised incoming HTTP request passed to route handlers and middleware.

import type { AppRequest } from '@boostkit/contracts'

| Field | Type | Description | |---|---|---| | method | string | HTTP method in uppercase ('GET', 'POST', etc.). | | url | string | Full request URL including query string. | | path | string | URL pathname without query string. | | params | Record<string, string> | Route parameters (e.g. /users/:id{ id: '1' }). | | query | Record<string, string> | Parsed query string parameters. | | headers | Record<string, string> | Lowercased request headers. | | body | unknown | Parsed request body. JSON bodies are parsed by the server adapter. | | raw | unknown | The raw underlying request object from the server adapter. Cast as needed. |


AppResponse

Response builder passed alongside AppRequest.

import type { AppResponse } from '@boostkit/contracts'

| Method | Signature | Description | |---|---|---| | status | (code: number) => AppResponse | Sets the HTTP status code. Returns this for chaining. | | header | (key: string, value: string) => AppResponse | Appends a response header. Returns this for chaining. | | json | (data: unknown) => void | Serialises data as JSON and sends the response. | | send | (body: string) => void | Sends a plain text response. | | redirect | (url: string, code?: number) => void | Issues an HTTP redirect. Defaults to 302. | | raw | unknown | The raw underlying response object from the server adapter. |


RouteHandler and MiddlewareHandler

import type { RouteHandler, MiddlewareHandler } from '@boostkit/contracts'

// Route handler — receives req and res
const handler: RouteHandler = async (req, res) => {
  res.json({ id: req.params['id'] })
}

// Middleware — receives req, res, and next
const auth: MiddlewareHandler = async (req, res, next) => {
  if (!req.headers['authorization']) {
    return res.status(401).json({ message: 'Unauthorized' })
  }
  await next()
}
type RouteHandler = (
  req: AppRequest,
  res: AppResponse,
) => unknown | Promise<unknown>

type MiddlewareHandler = (
  req: AppRequest,
  res: AppResponse,
  next: () => Promise<void>,
) => unknown | Promise<unknown>

HttpMethod

type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'ALL'

'ALL' is a BoostKit-specific wildcard used by the router to match any HTTP method.


RouteDefinition

interface RouteDefinition {
  method:     HttpMethod
  path:       string
  handler:    RouteHandler
  middleware: MiddlewareHandler[]
}

ServerAdapter and ServerAdapterProvider

Implemented by server adapter packages (e.g. @boostkit/server-hono). You do not implement these directly in application code.

interface ServerAdapter {
  registerRoute(route: RouteDefinition): void
  applyMiddleware(middleware: MiddlewareHandler): void
  listen(port: number, callback?: () => void): void
  getNativeServer(): unknown
}

interface ServerAdapterProvider {
  type: string
  create(): ServerAdapter
  createApp(): unknown
  createFetchHandler(setup?: (adapter: ServerAdapter) => void): Promise<FetchHandler>
}

type FetchHandler = (
  request: Request,
  env?:    unknown,
  ctx?:    unknown,
) => Promise<Response>

Notes

  • No runtime code — sideEffects: false, fully tree-shakable.
  • All types are re-exported from @boostkit/core for convenience.
  • Server adapters map their native request/response objects to AppRequest/AppResponse. The raw field provides escape-hatch access to adapter-specific APIs.