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

@t8/serve

v0.2.0

Published

Simple static file server + bundler, primarily for demo apps and tests, manual or automated

Downloads

102

Readme

T8 Serve

Simple static file server + bundler, primarily for demo apps and tests, manual or automated

Use cases:

  • Use the CLI-based server to launch a demo or test app with a single CLI command.
  • Use the code-based setup to launch an own server from multiple tests, each with its own app.

CLI

npx @t8/serve <app_dir> [...optional flags]

Flag            Usage

--bundle, -b    -b [input_path [[output_path] [output_dir]]]
                Defaults:
                - input_path: "index.ts" (relative to <app_dir>)
                - ouput_path: "index.js" (relative to <app_dir>/<output_dir>)
                - output_dir: "dist"

--url, -u       -u [<host>:]<port>
                Default: "localhost:3000"

--spa, -s       -s
                Enables the SPA mode by handling all unmatched paths as "/".

--dirs          --dirs assets public
                To serve files from the listed subdirectories of <app_dir>.
                By default, files are served from <app_dir>.

--watch         --watch
                To rebuild the bundled code if the source code changes.

--minify        --minify
                To minify the bundled code.
// package.json
"scripts": {
  "play": "npx @t8/serve playground -s -b"
}
/playground
  - index.css
  - index.html
      contains <script src="/dist/index.js"></script>
      contains <link rel="stylesheet" href="/index.css">
  - index.ts
npm run play
// playwright.config.ts
...
use: {
  baseURL: "http://localhost:3000",
},
webServer: {
  command: "npm run play",
  url: "http://localhost:3000",
},
// package.json
"scripts": {
  "play": "npx @t8/serve playground -s -b src/index.tsx"
}
/playground
  - src
    - App.tsx
    - index.css
    - index.tsx // imports "./App.tsx", "./index.css"
  - index.html
      contains <script src="/dist/index.js"></script>
      contains <link rel="stylesheet" href="/dist/index.css">
npm run play
// playwright.config.ts
...
use: {
  baseURL: "http://localhost:3000",
},
webServer: {
  command: "npm run play",
  url: "http://localhost:3000",
},
/app
  - src
    - index.ts
  - index.css
  - index.html
      contains <script src="dist/index.js"></script>
      contains <link rel="stylesheet" href="index.css">
// /app/package.json
{
  "name": "app",
  "scripts": {
    "start": "npx @t8/serve . -u 80 -b src/index.ts --watch"
  }
}
npm start

Code

import { serve } from "@t8/serve";

// Start
let server = await serve({
  host: "localhost", // default
  port: 3000, // default
  path: "app",
  bundle: true, // or input path, or { input, output, dir }
  spa: true,
});

// Stop
server.close();
/playground
  - index.css
  - index.html
      contains <script src="/dist/index.js"></script>
      contains <link rel="stylesheet" href="/index.css">
  - index.ts
// x.test.ts
import { test } from "@playwright/test";
import { type Server, serve } from "@t8/serve";

let server: Server;

test.beforeAll(async () => {
  server = await serve({
    path: "playground",
    bundle: true,
    spa: true,
  });
});

test.afterAll(() => {
  server.close();
});
/tests/x
  - src
    - App.tsx
    - index.css
    - index.tsx // imports "./App.tsx", "./index.css"
  - index.html
      contains <script src="/dist/index.js"></script>
      contains <link rel="stylesheet" href="/dist/index.css">
  - index.ts
  - index.test.ts
// tests/x/index.test.ts
import { test } from "@playwright/test";
import { type Server, serve } from "@t8/serve";

let server: Server;

test.beforeAll(async () => {
  server = await serve({
    path: "tests/x",
    bundle: "src/index.tsx",
    spa: true,
  });
});

test.afterAll(() => {
  server.close();
});
import { serve } from "@t8/serve";

let server = await serve({
  // ... Rest of the config
  // Optional custom request handler, e.g. for simple APIs or API mocks
  onRequest(req, res) {
    if (req.url === "/items") {
      res.writeHead(200, { "content-type": "application/json" });
      res.end(JSON.stringify(["apple", "lemon", "cherry"]));
    }
  },
});