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

@voltx/server

v0.4.7

Published

VoltX Server — Hono-based HTTP server with file-based routing, SSE streaming, and static file serving

Readme


The HTTP layer of the VoltX framework. Built on Hono with file-based page routing, file-based API routing, React SSR (streaming), CORS, logging, error handling, and static file serving.

Installation

npm install @voltx/server

Quick Start

// server.ts
import { Hono } from "hono";
import { registerSSR } from "@voltx/server";
import { registerRoutes } from "voltx/api";

const app = new Hono();

// Auto-discover and mount all API routes from api/ directory
registerRoutes(app);

// SSR — renders React on the server, hydrates on the client
registerSSR(app, null, {
  title: "My App",
  entryServer: "src/entry-server.tsx",
  entryClient: "src/entry-client.tsx",
  css: "src/globals.css",
});

export default app;
// vite.config.ts
import { defineConfig } from "vite";
import devServer from "@hono/vite-dev-server";
import react from "@vitejs/plugin-react";
import tailwindcss from "@tailwindcss/vite";
import { voltxRouter, voltxAPI } from "@voltx/server";

export default defineConfig({
  plugins: [
    react(),
    tailwindcss(),
    voltxRouter(),   // File-based page routing → voltx/router
    voltxAPI(),      // File-based API routing → voltx/api
    devServer({ entry: "server.ts" }),
  ],
});

Vite Plugins

voltxRouter() — File-Based Page Routing

Auto-discovers React components in src/pages/ and provides the voltx/router virtual module.

src/pages/index.tsx         → /
src/pages/about.tsx         → /about
src/pages/blog/index.tsx    → /blog
src/pages/blog/[slug].tsx   → /blog/:slug (dynamic route)
// Use in entry-client.tsx and entry-server.tsx
import { VoltxRoutes, Link, useNavigate, useParams } from "voltx/router";

// VoltxRoutes renders the matched page component
// Link, NavLink, useNavigate, useParams, useLocation, useSearchParams
// are re-exported from react-router — no separate install needed

Options

voltxRouter({
  pagesDir: "src/pages",  // default: "src/pages"
})

voltxAPI() — File-Based API Routing

Auto-discovers API route files in api/ and provides the voltx/api virtual module.

api/index.ts              → /api
api/users.ts              → /api/users
api/users/[id].ts         → /api/users/:id
api/[...slug].ts          → /api/* (catch-all)

Each file exports named HTTP method handlers:

// api/users.ts
import type { Context } from "@voltx/server";

export function GET(c: Context) {
  return c.json([{ id: 1, name: "Alice" }]);
}

export async function POST(c: Context) {
  const body = await c.req.json();
  return c.json({ created: true }, 201);
}

Supported methods: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS.

Routes are sorted automatically: static first, dynamic (:param) second, catch-all (*) last. HMR support means new files are picked up instantly in dev mode.

Options

voltxAPI({
  apiDir: "api",  // default: "api"
})

Usage in server.ts

import { registerRoutes } from "voltx/api";

// Mounts all discovered API handlers on the Hono app
const registered = registerRoutes(app);
// → [{ method: "GET", path: "/api" }, { method: "POST", path: "/api/users" }, ...]

Server-Side Rendering

registerSSR() provides streaming React SSR with zero config:

  • Dev mode — works with @hono/vite-dev-server for HMR
  • Production — reads the Vite client manifest for hashed asset paths, serves pre-built SSR bundle
  • Streaming — uses renderToReadableStream for fast TTFB
  • CSS injection — injects your global CSS in dev mode to prevent FOUC
  • Public env — injects window.__VOLTX_ENV__ for VITE_* variables
import { registerSSR } from "@voltx/server";

registerSSR(app, viteInstance, {
  title: "My App",
  entryServer: "src/entry-server.tsx",
  entryClient: "src/entry-client.tsx",
  css: "src/globals.css",
});

| Option | Type | Description | |--------|------|-------------| | title | string | HTML <title> | | entryServer | string | Path to SSR entry (exports render()) | | entryClient | string | Path to client hydration entry | | css | string | Path to global CSS file (prevents FOUC in dev) |

Features

  • Vite pluginsvoltxRouter() and voltxAPI() for Next.js-style file-based routing
  • Virtual modulesvoltx/router and voltx/api for clean imports
  • React SSR — streaming server-side rendering with registerSSR()
  • NavigationLink, NavLink, useNavigate, useParams from voltx/router
  • Dynamic routes[param] and [...slug] catch-all for both pages and API
  • HMR — new pages and API files are picked up instantly in dev mode
  • Built-in middleware — CORS, request logging, error handling
  • Static file servingpublic/ directory (favicon, robots.txt, manifest)
  • Full Hono access — use any Hono middleware or plugin

Part of VoltX

This package is part of the VoltX framework. See the monorepo for full documentation.

License

MIT — Made by the Promptly AI Team