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

@bun-eth/foundry-deployer

v0.2.1

Published

Foundry deployment utilities with contract hot reload support

Readme

@bun-eth/foundry-deployer

Foundry deployment utilities with contract hot reload support for Bun-Eth.

Features

  • 🔥 Contract Hot Reload - Auto-generate TypeScript from Foundry deployments
  • Bun-Native - Fast execution with Bun runtime
  • 🎯 Type-Safe - Generated contracts have full TypeScript support
  • 🌐 Multi-Chain - Support for multiple networks
  • 🔄 Auto-Update - Next.js Fast Refresh integration

How It Works

  1. Deploy with Foundry: Run forge script to deploy contracts
  2. Generate TypeScript: This package reads Foundry's broadcast artifacts
  3. Hot Reload: Next.js detects the file change and updates the UI automatically

Installation

bun add @bun-eth/foundry-deployer

Usage

As a Script

Add to your package.json:

{
  "scripts": {
    "generate:contracts": "foundry-deployer"
  }
}

Run after deploying:

forge script script/Deploy.s.sol:DeployScript --broadcast
bun run generate:contracts

Programmatic

import { generateDeployedContracts } from "@bun-eth/foundry-deployer";

await generateDeployedContracts({
  foundryRoot: "./packages/contracts",
  outputPath: "./packages/contracts/deployedContracts.ts",
  networks: {
    31337: { name: "localhost", deploymentDir: "31337" },
    1: { name: "mainnet", deploymentDir: "1" },
  },
});

With Foundry Post-Deploy Hook

Add to foundry.toml:

[profile.default]
post_deploy = "bun run generate:contracts"

Now contracts auto-generate after every deployment!

Generated File Structure

// packages/contracts/deployedContracts.ts
const deployedContracts = {
  31337: {
    SimpleStorage: {
      address: "0x5FbDB2315678afecb367f032d93F642f64180aa3",
      abi: [...]
    }
  }
} as const;

export default deployedContracts;

Integration with Hooks

The generated file works seamlessly with @bun-eth/hooks:

import { useScaffoldReadContract } from "@bun-eth/hooks";

// Contract name and ABI are auto-loaded from deployedContracts.ts
const { data } = useScaffoldReadContract({
  contractName: "SimpleStorage", // Type-safe!
  functionName: "retrieve",
});

Configuration

Custom Networks

await generateDeployedContracts({
  foundryRoot: "./contracts",
  outputPath: "./src/contracts/deployedContracts.ts",
  networks: {
    31337: { name: "localhost", deploymentDir: "31337" },
    1: { name: "mainnet", deploymentDir: "1" },
    10: { name: "optimism", deploymentDir: "10" },
    8453: { name: "base", deploymentDir: "8453" },
  },
});

Custom Output Location

You can place the generated file anywhere:

{
  outputPath: "./apps/web/src/contracts/deployedContracts.ts"
}

Foundry Broadcast Structure

This package expects Foundry's standard broadcast structure:

packages/contracts/
├── broadcast/
│   └── Deploy.s.sol/
│       ├── 31337/
│       │   └── run-latest.json
│       └── 1/
│           └── run-latest.json
└── out/
    └── SimpleStorage.sol/
        └── SimpleStorage.json

Hot Reload Flow

┌─────────────────────────────────────────────────┐
│ 1. Deploy Contracts (forge script)             │
└─────────────────┬───────────────────────────────┘
                  │
                  ▼
┌─────────────────────────────────────────────────┐
│ 2. Foundry writes to broadcast/               │
└─────────────────┬───────────────────────────────┘
                  │
                  ▼
┌─────────────────────────────────────────────────┐
│ 3. foundry-deployer generates TypeScript       │
└─────────────────┬───────────────────────────────┘
                  │
                  ▼
┌─────────────────────────────────────────────────┐
│ 4. deployedContracts.ts file updated           │
└─────────────────┬───────────────────────────────┘
                  │
                  ▼
┌─────────────────────────────────────────────────┐
│ 5. Next.js Fast Refresh detects change         │
└─────────────────┬───────────────────────────────┘
                  │
                  ▼
┌─────────────────────────────────────────────────┐
│ 6. React components re-render with new data 🎉 │
└─────────────────────────────────────────────────┘

API

generateDeployedContracts(config)

Generates the TypeScript contracts file.

Parameters:

  • config.foundryRoot - Path to Foundry project root
  • config.outputPath - Where to write the generated file
  • config.networks - Networks to include (optional)

Returns: Promise<void>

loadFoundryDeployment(foundryRoot, chainId)

Loads deployment data for a specific chain.

Parameters:

  • foundryRoot - Path to Foundry project root
  • chainId - Chain ID to load

Returns: FoundryDeployment

Requirements

  • Foundry installed and configured
  • Bun runtime
  • Valid Foundry deployment artifacts

License

MIT