# Quickstart

## Installation

Install the package globally, and the tool will be accessible anywhere.

```
npm install -g @polygonlabs/dapp-launchpad
```

*Node >v16.14.x is supported, although Node v18.x.x is recommended. To easily manage different npm versions on your system, we recommend using* [*nvm*](https://github.com/nvm-sh/nvm)*.*

## Initialise a new project

To initialise a project, simply run:

```
dapp-launchpad init [YOUR PROJECT NAME]
```

This will create a new directory in your current directory, initialise a minimal DApp project inside it, then proceed to install all required packages.

By default, the scaffolded project is in javascript. To use typescript (or any other template), use [`--template NAME`](https://0xpolygon.gitbook.io/dapp-launchpad/commands/init#options) option.

To get a list of available templates, run [`list scaffold-templates`](https://0xpolygon.gitbook.io/dapp-launchpad/commands/list/scaffold-templates).

## Set up environment variables

Set up the mandatory environment variables in both the `frontend` and `smart-contracts` sub-folders, in a `.env` file. Example env files are provided for each, in `.env.example`.

### **WalletConnect Project ID**

To get a WalletConnect Project ID, Head over to [WalletConnect Cloud](https://cloud.walletconnect.com/) and create a new project. This will generate a project ID which you can then use.

## Starting development

To start a development environment, use:

```
dapp-launchpad dev
```

<figure><img src="https://417941880-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FO90hmHvsxRTfyJRPdPwI%2Fuploads%2Fr26ejUkoGOs3IbAj8SMH%2FScreenshot%202023-12-06%20at%2011.40.56%E2%80%AFAM.png?alt=media&#x26;token=815e3352-6cca-49c4-8a17-fbc6f11595bc" alt=""><figcaption><p>The frontend dev server running, with your deployed app</p></figcaption></figure>

<figure><img src="https://417941880-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FO90hmHvsxRTfyJRPdPwI%2Fuploads%2F8aQNTPsHd1dztoIEGtIh%2FScreenshot%202023-12-06%20at%2011.41.39%E2%80%AFAM.png?alt=media&#x26;token=032285a0-09d3-4a50-84a4-c2a36da3348c" alt=""><figcaption><p>The local test blockchain running, with your deployed contracts</p></figcaption></figure>

**And this will start a fully integrated dev environment - a local dev blockchain and a local Frontend dev server! Any change in the code automatically updates both the frontend and the smart contracts; no manual reload is necessary!**

The project is divided into two parts - [Frontend](https://0xpolygon.gitbook.io/dapp-launchpad/workflow/frontend) (inside `frontend`) and [Smart contracts](https://0xpolygon.gitbook.io/dapp-launchpad/workflow/smart-contracts) (inside `smart-contracts`).

This will also generate some funded test wallets for you in this test chain, which you can use to develop your DApp.

### Fork existing chain locally

You may also start this local chain by forking any existing EVM-compatible chain. Just run:

```
dapp-launchpad dev -n NETWORK_NAME
```

To see all available options, run:

```
dapp-launchpad dev -h
```

## Deploying to production

To deploy your project to production, run:

```
dapp-launchpad deploy -n CHAIN_NAME
```

This will do 2 things:

* Deploy all your smart contracts to the selected chain, and log the deployment results.
* Deploy your frontend to Vercel, and log the deployment URL.

To deploy only the smart contracts, run:

```
dapp-launchpad deploy -n CHAIN_NAME --only-smart-contracts
```

And to deploy only the frontend, run:

```
dapp-launchpad deploy -n CHAIN_NAME --only-frontend
```

**The frontend deployment requires that smart contracts to have been deployed before.** So if you are only deploying the frontend, make sure that you either:

1. Did run the smart contracts deploy command successfully before this.
2. OR, run [`generate smart-contracts-config -e production -n NETWORK_NAME`](https://0xpolygon.gitbook.io/dapp-launchpad/commands/generate/smart-contracts-config#options) wizard.
