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

bunact

v0.6.0

Published

A lightweight React framework with SSR and SSG support

Downloads

392

Readme

Bunact

A lightweight React framework built with Bun, featuring file-based routing, SSR streaming, and ISR.

This framework is written in Bun and requires Bun to run.

Features

  • File-based Routing - Automatic routing based on pages/ directory structure
  • SSR & Streaming - React streaming server-side rendering with hydration
  • ISR - Incremental Static Regeneration with background revalidation
  • Image Optimization - Automatic image optimization and caching using Sharp
  • API Routes - Built-in API endpoints support in pages/api/
  • Type Safety - Full TypeScript support

Quick Start

Create a New Project

bunx bunact create my-app
cd my-app

Start Development Server

bun dev

Build for Production

bun run build

Project Structure

my-app/
├── pages/
│   ├── page.tsx              # Main page
│   ├── layout.tsx            # Layout component
│   ├── not-found.tsx         # 404 page
│   ├── loading.tsx           # Loading UI
│   ├── error.tsx             # Error boundary
│   └── api/
│       └── hello.ts          # API endpoint
├── public/                   # Static files
└── proxy.ts                  # Global middleware (optional)

Core Features

Page Component

// pages/page.tsx
export const Page = async ({ params, searchParams, cookies, headers }) => {
    const data = await fetch('...')

    return {
        metadata: {
            title: 'My Page',
            description: '...',
        },
        default: () => <div>{/* ... */}</div>,
    }
}

Dynamic Routing

pages/
├── [id]/page.tsx           # Matches /123
├── [...slug]/page.tsx      # Matches /a/b/c
└── [[...slug]]/page.tsx    # Matches / or /a/b/c

Image Optimization

import { Image } from 'bunact/ui/Image'

<Image
  src="/photo.jpg"
  width={800}
  height={600}
  alt="Photo"
  quality={80}
/>

// Fill mode
<div style={{ position: 'relative', width: '100%', height: '400px' }}>
  <Image
    src="/banner.jpg"
    fill
    objectFit="cover"
    alt="Banner"
  />
</div>

ISR (Incremental Static Regeneration)

// pages/blog/[id]/page.tsx
export const revalidate = 60 // Revalidate every 60 seconds

export const BlogPost = async ({ params }) => {
    const post = await fetchPost(params.id)

    return {
        default: () => <article>{/* ... */}</article>,
    }
}

API Routes

// pages/api/users/[id].ts
export const GET = async (request: Request, { params }) => {
    const user = await db.user.findById(params.id)
    return Response.json(user)
}

export const POST = async (request: Request) => {
    const body = await request.json()
    const user = await db.user.create(body)
    return Response.json(user, { status: 201 })
}

Environment Variables

# .env
SECRET_KEY=server-only-value              # Server-only
BUNACT_PUBLIC_API_URL=https://api.com     # Available on client
// Server component
const secret = process.env.SECRET_KEY // Server-only
const apiUrl = process.env.BUNACT_PUBLIC_API_URL // Server + Client

Configuration

Create a bunact.config.ts (or .js, .mjs) file in your project root to customize framework behavior:

// bunact.config.ts
import type { BunactConfig } from 'bunact'

export default {
    port: 4000,
    constants: {
        server: {
            defaultPort: 4000,
        },
        cache: {
            maxIsrCacheSize: 2000,
            maxImageCacheSizeMB: 1000,
        },
    },
    plugins: [
        {
            name: 'my-plugin',
            setup: async (config) => {
                console.log('Plugin initialized!')
            },
        },
    ],
} satisfies BunactConfig

Available configuration options:

  • port - Development server port (default: 3000)
  • pagesDir - Pages directory path (default: pages)
  • publicDir - Public assets directory (default: public)
  • cacheDir - Cache directory (default: .bunact/cache)
  • constants - Override framework constants
  • plugins - Add custom plugins

Requirements

  • Bun ≥ 1.3.0
  • React 19
  • TypeScript 5

License

MIT

Links