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 🙏

© 2025 – Pkg Stats / Ryan Hefner

megaeth-cli

v0.7.4

Published

A CLI tool for MegaETH (install globally with -g flag)

Downloads

25

Readme

Mega CLI

A sick CLI tool for MegaETH devs and users. This CLI streamlines the development workflow for smart contract developers, frontend developers, full-stack developers and users working with the Mega testnet.

MEGA CLI interface showing available commands

NPM Version License: MIT

Features

  • Account management: Create, import, and manage blockchain accounts
  • MegaETH operations: Check balances and request tokens from faucet
  • Project templating: Create boilerplate projects for smart contract, frontend, or full-stack development
  • Development environment: Easily start local blockchain and/or frontend development servers
  • Smart contract operations: Compile and deploy contracts on Mega testnet
  • Foundry: Most Mega CLI commands are wrappers around Foundry (Anvil, Forge, Cast, Chisel) commands

Documentation

Full documentation available at mega-cli.mintlify.app

Video Walkthrough

Watch a complete demonstration of all Mega CLI commands and features:

Full Video Walkthrough

Installation

# Install globally using npm
npm install -g megaeth-cli

# Or using yarn
yarn global add megaeth-cli

# Or using pnpm
pnpm add -g megaeth-cli

Setup

Mega CLI requires Foundry for most of its commands. You can install it by running:

# Check and set up dependencies
mega setup

# Check if dependencies are installed
mega setup --check

Recommended: Set Up a Local Account

For the optimal experience with Mega CLI, it is recommended to set up a local account:

# Create a new account
mega account create
# > Name your account (e.g., "dev")
# > Enter a password

# Check your account was created successfully
mega account list

Quick Start

# Create a new full-stack project
mega init my-mega-project

# Start the development environment
cd my-mega-project
mega dev

Command Reference

Account Management

# Create a new account/wallet
mega account create

# Import an existing account
mega account import

# List all managed accounts
mega account list

Balance Checking

# Check ETH balance for address (in wei)
mega balance [address]

# Check ETH balance for a stored account (in wei)
mega balance --account <name>

# Check ETH balance for address (in ether)
mega balance [address] --ether

# Check ETH balance for a stored account (in wei)
mega balance --account <name>

Faucet

# Request test tokens from faucet
mega faucet --account <name>
# or
mega faucet --private-key <key>

Spin up Boilerplate Templates

# Create a full-stack project (NextJS + Foundry)
mega init 
#or
mega init [project-name]

# Create a frontend-only project (NextJS + WalletConnect)
mega init --frontend

# Create a Foundry-only project. Almost identical to forge init.
mega init --foundry

Development Environment

# Start both frontend and Foundry environments
mega dev

# Start just the NextJS app
mega dev --frontend

# Start just the Foundry local chain (Anvil)
mega dev --foundry

Contract Development

# Compile Solidity contracts
mega compile

# Deploy to local network
mega deploy <path-to-contract>/<contract-file-name>.sol:<contract-name> --broadcast 


# Deploy a contract to MegaETH testnet
mega deploy <path-to-contract>/<contract-file-name>.sol:<contract-name> --broadcast --testnet --account <keystore-account-name>
# or, with private keys 
mega deploy <path-to-contract>/<contract-file-name>.sol:<contract-name> --broadcast --testnet --private-key <private-key>

Explore

#Explore the MegaETH ecosystem (opens Fluffle Tools in browser)
mega fluffle

Configuration

Mega CLI uses Foundry's existing configuration system. For Foundry-specific settings, refer to the Foundry Book.

Project Structure

When you create a new project with mega init, it will generate a project with the following structure:

Full-Stack Project

my-mega-project/
├── foundry-app/            # Smart contract development
│   ├── lib/                # Dependencies including forge-std
│   ├── script/             # Deployment scripts
│   ├── src/                # Contract source files
│   ├── test/               # Contract test files
│   └── foundry.toml        # Foundry configuration
├── next-app/               # Frontend application
│   ├── public/             # Static assets
│   └── src/
│       ├── app/            # Next.js app router
│       │   └── gmega/      # Demo application routes
│       ├── components/     # Reusable components
│       ├── config/         # Reown configuration
│       ├── constants/      # Constants
│       └── context/        # React context providers
└── README.md

Frontend-Only Project

my-mega-project/
├── public/                 # Static assets
├── src/
│   ├── app/                # Next.js app router
│   │   └── gmega/          # Demo application routes
│   ├── components/         # Reusable components
│   ├── config/             # Reown configuration
│   ├── constants/          # Constants
│   └── context/            # React context providers
└── package.json

Foundry-Only Project

my-mega-project/
├── lib/                    # Dependencies including forge-std
├── script/                 # Deployment scripts
├── src/                    # Contract source files
├── test/                   # Contract test files
└── foundry.toml            # Foundry configuration

Examples

Deploying a Contract

# Compile your contracts
mega compile

# Deploy to Mega testnet using a locally stored account named "dev"
mega deploy foundry-app/src/GmegaCounter.sol:GmegaCounter --broadcast --testnet --account dev

Creating and Using Accounts

# Create a new account
mega account create
# > Enter a name for your wallet: myaccount

# Use this account to deploy a contract
mega deploy foundry-app/src/GmegaCounter.sol:GmegaCounter --broadcast

Getting Testnet Tokens

# Request test tokens using a saved account
mega faucet --account myaccount

# Or using a private key directly
mega faucet --private-key <your-private-key>

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT