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

@farming-labs/mini-dev

v0.0.7

Published

A minimal dev server with HMR for TypeScript/JS/CSS

Readme

mini-dev

A minimal dev server with HMR (Hot Module Replacement) for TypeScript, TSX, CSS, and HTML.

Features

  • Zero config — Works out of the box
  • Config file — Optional mini-dev.config.ts or mini-dev.config.js
  • public/ directory — Static assets (favicon, images, robots.txt) served at /
  • 404 page — Custom 404 with a list of visitable paths when a route is not found
  • Proxy — Forward paths (e.g. /api) to another server so frontend and backend can run separately
  • Previewmini-dev preview to serve static build output (e.g. ./dist) without HMR
  • Env — Load .env / .env.local and expose prefixed vars to the client (e.g. PUBLIC_*) for security
  • TypeScript/TSX — On-the-fly transpilation via esbuild
  • HMR — Hot module replacement without full page reload
  • Simple API — Programmatic and CLI usage

Install

pnpm add @farming-labs/mini-dev

Quick Start

CLI

npx @farming-labs/mini-dev
# Server at http://localhost:3000

# Custom port and root
npx @farming-labs/mini-dev -p 5173 -r ./my-app

# Custom label (default: MINI-DEV)
npx @farming-labs/mini-dev -l MY-APP

# Open browser on start
npx @farming-labs/mini-dev -o

# Expose to network (access from other devices)
npx @farming-labs/mini-dev --host

# Serve under a subpath (e.g. https://example.com/app/)
npx @farming-labs/mini-dev --base /app/

# Silent mode (no logs; auto-enabled when CI=true)
npx @farming-labs/mini-dev -s

# Preview: serve static build (default: ./dist on port 4173)
npx @farming-labs/mini-dev preview
npx @farming-labs/mini-dev preview -r ./dist -p 4173

Programmatic API

import { createDevServer } from '@farming-labs/mini-dev';

const { url, stop } = await createDevServer({ port: 3000 });
console.log('Running at', url);
// await stop(); // when done

DevServer Class

import { DevServer } from '@farming-labs/mini-dev';

const server = new DevServer({
  root: './src',
  port: 3000,
  host: '0.0.0.0',
  verbose: true,
  label: 'MY-APP', // optional, defaults to MINI-DEV
});

const { port, url } = await server.start();
// await server.stop();

Preview server

import { createPreviewServer } from '@farming-labs/mini-dev';

const { url, stop } = await createPreviewServer({ root: './dist', port: 4173 });
console.log('Preview at', url);
// await stop();

Config

Optional config file in project root (mini-dev.config.ts or mini-dev.config.js):

// mini-dev.config.ts
import type { DevServerOptions } from '@farming-labs/mini-dev';

export default {
  port: 5173,
  open: true,
  label: 'MY-APP',
  // base: '/app/',  // serve at https://example.com/app/
  // proxy: { '/api': 'http://localhost:8080' },  // forward /api to backend
  // env: { prefix: 'PUBLIC_' },  // expose PUBLIC_* from .env to client (default); set env: false to disable
} satisfies Partial<DevServerOptions>;

CLI options override config.

Static assets (public/)

Place files in a public/ folder at the project root; they are served at /:

  • public/favicon.ico/favicon.ico
  • public/robots.txt/robots.txt
  • public/images/logo.png/images/logo.png

If public/ does not exist, it is ignored.

Env (.env)

With env: {} or env: { prefix: 'PUBLIC_' } (default prefix), the server loads .env and .env.local from the project root and serves them at /@env (only variables whose names start with the prefix). Set env: false to disable. Use env: { prefix: 'VITE_' } to match Vite’s convention.

To use env in the browser, load the payload and use the getEnv() util. Add a script tag before your app so the object is available: <script src="/@env"></script> (or with base, e.g. <script src="/app/@env"></script>). Then in your app:

import { getEnv } from '@farming-labs/mini-dev/client';

interface Env {
  PUBLIC_API_URL?: string;
  PUBLIC_APP_NAME?: string;
}

const env = getEnv<Env>();
env.PUBLIC_API_URL;   // string | undefined
env.PUBLIC_APP_NAME; // string | undefined

The dev server does not inject the env script automatically; you add it when you need it.

Example

See the example directory:

cd example
pnpm dev

Then open http://localhost:3000/app/ (the example uses base: '/app/'). Edit App.tsx or style.css and save — changes apply via HMR without a full reload. The example uses a local env.ts helper so it works without relying on package resolution; in your own app you can use import { getEnv } from '@farming-labs/mini-dev/client' when the package is installed.

API Reference

See docs/API.md for full API documentation.

Development

pnpm install
pnpm build
pnpm test