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

@renatorodrigues/cacheiro

v1.1.0

Published

NX remote cache server

Readme

@renatorodrigues/cacheiro

Core library for the NX remote cache server. Implements the NX 20.8+ custom remote cache specification.

This package provides the server logic and the public API. It is not a runnable application — use @renatorodrigues/cacheiro-runner to run it, or build your own runner on top of the exported API.

Requirements

  • Node.js 22+

API

new Cacheiro(store: CacheiroStore, config: CacheiroConfig)

Creates a server instance. Accepts a CacheiroStore implementation and a CacheiroConfig object. Config is not validated at runtime — only TypeScript types are enforced. Validate before constructing using configSchema.

cacheiro.start(): Promise<FastifyInstance>

Builds the Fastify server and returns the Fastify instance. The server is not yet listening — use the returned instance to add custom routes, hooks, or plugins before calling listen().

cacheiro.listen(): Promise<void>

Binds the server to the configured host and port, then prints the startup banner.

cacheiro.stop(): Promise<void>

Drains open connections and shuts down the server gracefully.

import { Cacheiro } from '@renatorodrigues/cacheiro';
import { FileSystemStore } from '@renatorodrigues/cacheiro-store-fs';

const store = new FileSystemStore({
  cacheDirectory: './cache',
  ttlDays: 7,
  sweepIntervalHours: 24,
});

const cacheiro = new Cacheiro(store, {
  server: { port: 3000, host: '127.0.0.1', bodyLimitMb: 100, banner: true, infobox: true },
  auth: { token: 'my-secret-token' },
});

const server = await cacheiro.start();

// add custom routes, hooks, or plugins here before listen()

await cacheiro.listen();

CacheiroStore

Interface that all store implementations must satisfy. Import it to build a custom store:

import type { CacheiroStore } from '@renatorodrigues/cacheiro';

CacheiroConfig

TypeScript interface describing the server configuration shape. Import it to type your own config loader:

| Field | Type | Required | Default | Description | | --------------------- | --------- | -------- | ------- | ---------------------------------------------------------------------- | | server.port | number | Yes | — | Port to listen on. | | server.host | string | Yes | — | Host to bind to (e.g. "127.0.0.1" or "0.0.0.0"). | | server.bodyLimitMb | number | No | 100 | Maximum request body size in megabytes. | | server.banner | boolean | No | true | Show the large ASCII art banner on startup. Compact header if false. | | server.infobox | boolean | No | true | Show the info box (version, URL, store details) on startup. | | server.tls.certFile | string | No | — | Path to PEM certificate file. Enables HTTPS when set (with keyFile). | | server.tls.keyFile | string | No | — | Path to PEM private key file. | | server.tls.caFile | string | No | — | Path to CA certificate file (optional). | | auth.token | string | Yes | — | Bearer token required on all requests. Auth disabled if empty. |

import type { CacheiroConfig } from '@renatorodrigues/cacheiro';

configSchema

JSON Schema (draft-07) for CacheiroConfig. Exported for runners and custom integrations to validate config before constructing Cacheiro:

import { configSchema } from '@renatorodrigues/cacheiro';
import { Ajv } from 'ajv';

const ajv = new Ajv({ allErrors: true });
const validate = ajv.compile(configSchema);

HTTP API

Defined by swagger.json (OpenAPI 3.0).

| Method | Path | Auth required | Description | | ------ | ----------------- | ------------- | ------------------------------- | | PUT | /v1/cache/:hash | Yes | Upload a task artifact | | GET | /v1/cache/:hash | Yes | Download a task artifact | | GET | /health | No | Health check — returns 200 OK |

/v1/cache/* endpoints require an Authorization: Bearer <token> header when auth.token is set.

Stores

Store packages implement the CacheiroStore interface and are independent of this package. Instantiate the store of your choice and pass it to the Cacheiro constructor.

See @renatorodrigues/cacheiro-types for the full list of available stores and instructions on implementing a custom store.

Development

npm run watch        # tsc --watch (hot rebuild)
npm run build        # compile TypeScript
npm test             # run tests
npm run test:watch   # watch mode
npm run lint         # oxlint
npm run fmt          # oxfmt