mega init

The init command creates a new project with boilerplate code configured for MegaETH.

Usage

mega init [project-name] [options]

Arguments

ArgumentDescription
project-nameName of the project directory to create (optional, will prompt if not provided)

Options

OptionDescription
--frontendCreate a frontend-only project (NextJS + WalletConnect)
--foundryCreate a Foundry-only project configured for Mega testnet

Description

This command scaffolds a new project with predefined templates and configurations for working with MegaETH. By default, it creates a full-stack project that includes both Foundry for smart contract development and NextJS for frontend development.

The command:

  • Creates a new directory with the specified project name
  • Clones the appropriate template repository
  • Initializes a new git repository
  • Installs dependencies

Templates and Contributing

The init command uses the following template repositories. If you have suggestions for improving any of these templates, you can submit pull requests to the respective GitHub repositories:

Project TypeTemplate Repository
Full-stack (default)github.com/awesamarth/mega-starter-full
Frontend-onlygithub.com/awesamarth/mega-starter-frontend
Foundry-onlygithub.com/awesamarth/mega-starter-foundry

Your contributions help improve the experience for all MegaETH developers!

Examples

Create a full-stack project

mega init my-mega-project

Create a frontend-only project

mega init my-frontend --frontend

Create a Foundry-only project

mega init my-contracts --foundry
  • dev - Start the development environment after creating a project
  • compile - Compile contracts in your new project