> ## Documentation Index
> Fetch the complete documentation index at: https://mega-cli.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Get up and running with Mega CLI in minutes

## Video Demo

Watch a full demonstration of Mega CLI in action:

<iframe width="560" height="315" src="https://www.youtube.com/embed/uLLzEAp9DL4" title="Mega CLI Demo" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen />

This demo walks through setting up a a starter project, working with accounts, deploying contracts, and more.

## Prerequisites

Before you begin, make sure you have:

* Installed Mega CLI globally (`npm install -g megaeth-cli`)
* Set up Foundry using `mega setup`
* Created a local account using `mega account create` (recommended)

If you haven't completed these steps yet, see the [Installation and Setup](/installation-and-setup) guide.

## Creating Your First Project

Mega CLI makes it easy to set up a new project with all the necessary configuration for MegaETH.

### Create a Full-Stack Project

```bash theme={null}
# Create a new project
mega init my-mega-project

# Navigate to your new project
cd my-mega-project
```

This creates a full-stack project with both Foundry (for smart contracts) and Next.js (for frontend).

<Accordion title="What's included in the full-stack project?">
  * A Foundry environment configured for Mega testnet
  * A Next.js frontend with WalletConnect integration
  * Example smart contracts and frontend components
  * Configuration files and project structure
</Accordion>

### Start the Development Environment

Once your project is created, you can start the development environment:

```bash theme={null}
mega dev
```

This command starts both:

* A local Anvil blockchain instance for development
* The Next.js development server for the frontend

You can also start them individually (recommended):

```bash theme={null}
# Start only the Foundry/Anvil environment
mega dev --foundry

# Start only the Next.js frontend
mega dev --frontend
```

## Deploying Your First Contract

The starter project includes sample contracts you can deploy right away:

1. First, compile your contracts:

```bash theme={null}
mega compile
```

2. Then, deploy to the local development chain:

```bash theme={null}
mega deploy foundry-app/src/GmegaCounter.sol:GmegaCounter --broadcast
```

3. Or, deploy to the Mega testnet using your account:

```bash theme={null}
mega deploy foundry-app/src/GmegaCounter.sol:GmegaCounter --broadcast --testnet --account <account-name>
```

<Note>
  Before deploying to testnet, make sure you have test tokens. You can request them using:

  ```bash theme={null}
  mega faucet --account <account-name>
  ```
</Note>

## Checking Account Balance

You can check the balance of your account or any address:

```bash theme={null}
# Check balance of your account
mega balance --account <account-name>

# Check balance of any address
mega balance 0x123...abc

# Show balance in ether instead of wei
mega balance --account dev --ether
```

## Next Steps

Now that you've created your first project and explored the basic features, you can:

* Learn more about [project structure](/reference/project-structure)
* Explore the [command reference](/commands/setup) for detailed usage
* See [examples](/reference/examples) of common workflows

## Troubleshooting

If you encounter any issues:

* Ensure Foundry is properly installed (`mega setup --check`)
* Check that you're using the latest version of Mega CLI
* For testnet operations, confirm you have test tokens in your account
