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

@dstrml/sol

v1.2.0

Published

Full-stack React microframework for fast-movers ๐ŸŒž

Readme

Turn your Vite app into a full-stack project Add API endpoints to your Vite app Write server-side code right inside your Vite app Turn your Vite app into a full-stack project with a single command

Features

  • File-based API routing ๐Ÿšฆ - Creating an API endpoint is as simple as creating a file and a handler.
  • Lightweight ๐Ÿชถ - Zero dependencies. Core runtime is only ~200 LOC.
  • Supercharged productivity ๐Ÿ“ˆ - Build and ship quicker. No need to juggle multiple projects or monorepos.
  • Terrific DX ๐Ÿคฉ - All-round HMR. Rich context API. First-class TypeScript support.

Quick Start

Make sure you have Bun 1.3 or above installed.

  1. Add Sol to your project.
bun add @dstrml/sol
  1. Change the dev and build scripts in your package.json to use Sol.
"dev": "sol dev -w",
"build": "sol build"
  1. Start the dev server.
bun run dev

Table of Contents

Creating API Routes

API routes are created by adding handlers to files under the server/api/ directory. Following HTTP methods are supported.

  • GET
  • POST
  • PUT
  • DELETE
  • PATCH
  • OPTIONS
  • HEAD

Files that don't export any valid handlers are simply ignored.

Basic Route

Create server/api/hello.ts or server/api/hello/index.ts:

// GET /api/hello
export function GET(c: Context) {
	// Return a json response
	return c.json({
		message: 'Hello from API!',
		timestamp: new Date().toISOString()
	});
}

// POST /api/hello
export async function POST(c: Context) {
	const body = await c.req.json();
	return c.json({
		message: 'Received your message',
		data: body
	});
}

Then, call them on the client-side like this:

// App.tsx
function App() {
	useEffect(() => {
		fetch('/api/hello')
			.then((r) => r.json())
			.then(console.log);
	}, []);

	// ...
}

Dynamic Routes

Create server/api/users/[id].ts:

// GET /api/users/[id]
export function GET(c: Context) {
	const { id } = c.req.params;
	return c.json({
		id,
		name: `User ${id}`
	});
}

Request

Requests in Sol are instances of SolRequest, which is a wrapper around BunRequest.

Request properties

// GET /api/users/[id]/posts
export function GET(c: Context) {
	// '/api/users/[id]/posts'
	const routePath = c.req.routePath;

	// '/api/users/3/posts'
	const pathname = c.req.pathname;

	// 'http://localhost:6978/api/users/3/posts?limit=10'
	const url = c.req.url;

	// Get path params
	const { id } = c.req.params;

	// Get querystring params
	const limit = c.req.query('limit');

	// Get the value of a request header
	const contentType = c.req.header('Content-Type');

	// Get the value of a cookie
	const cookieValue = c.req.cookie('cookie-name');
}

Request body

export function POST(c: Context) {
	// Get a parsed request body
	const jsonBody = await c.req.json(); // As JSON
	const txtBody = await c.req.text(); // As text
	const arrBufBody = await c.req.arrayBuffer(); // As `ArrayBuffer`
	const blobBody = await c.req.blob(); // As `Blob`
	const formDataBody = await c.req.formData(); // As `FormData`
}

Raw

The underlying BunRequest object can be accessed at Context.req.raw.

Build for Production

Apps can be built for production using the sol build command. This outputs a build under dist/, which can be served using bun run dist/server.js.

The app is served on http://localhost:3000 by default. You can specify a different port in the run command (example: bun run dist/server.js -p 5000)

License

Distributed under the MIT License. See LICENSE for more information.