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

@lastshotlabs/slingshot-runtime-bun

v0.0.2

Published

Bun-native runtime implementation for Slingshot

Readme


title: Human Guide description: Human-maintained guidance for @lastshotlabs/slingshot-runtime-bun

@lastshotlabs/slingshot-runtime-bun is the Bun-native runtime implementation for Slingshot. Pass the return value of bunRuntime() to defineApp({ runtime }) in your app.config.ts.

What It Provides

  • passwordBun.password.hash() / Bun.password.verify() (argon2id by default)
  • sqlitebun:sqlite Database opened in WAL mode with create: true
  • serverBun.serve HTTP server with WebSocket upgrade support
  • fsBun.write and Bun.file for async binary and text file I/O
  • globBun.Glob for file pattern scanning

Minimum Setup

import { defineApp } from '@lastshotlabs/slingshot';
import { bunRuntime } from '@lastshotlabs/slingshot-runtime-bun';

export default defineApp({
  runtime: bunRuntime(),
  port: 3000,
});

In practice, Bun is auto-detected — you only pass bunRuntime() explicitly if you need to customize behavior or override the auto-detection.

Operational Notes

  • readFile() uses Bun.file(path).exists() before reading. Missing files return null; errors on files that do exist (e.g. permission denied) propagate as exceptions.
  • fs.readFile() uses the same exists() check and returns null for missing binary files.
  • password.hash() defaults to argon2id. The hash output is self-describing and includes the algorithm identifier, so it is forward-compatible if the algorithm default changes.
  • SQLite databases are opened in WAL mode. Set up your application's migration step before any reads or writes. The runtime does not run migrations itself.
  • WebSocket upgrade is delegated to Bun.serve. Call server.upgrade(req, { data }) from inside a fetch handler — Bun returns undefined from fetch when the upgrade succeeds.

Gotchas

  • connection.port must be a number, not a string. Env-var values need explicit coercion: port: Number(process.env.PORT).
  • glob.scan() returns paths relative to cwd, not absolute. Join with cwd when you need absolute paths for subsequent file operations.
  • server.stop(true) closes open connections immediately. Pass false (or no argument) if you want graceful drain.

Capability Reporting

Use runtimeCapabilities() to programmatically discover what the Bun runtime platform supports:

import { runtimeCapabilities } from '@lastshotlabs/slingshot-runtime-bun';

const caps = runtimeCapabilities();
// => {
//   runtime: 'bun',
//   filesystem: { read: true, write: true },
//   sqlite: true,
//   httpServer: true,
//   glob: true,
//   asyncLocalStorage: true,
//   passwordHashing: 'bun-argon2',
//   webSocket: true,
// }

All boolean capabilities are true because Bun provides every runtime primitive natively. The returned object is frozen so consumers can rely on the values never changing during the lifetime of the process.

Key Files

  • src/index.ts