Creating projects

Quickly scaffold new projects using templates with ZKsync CLI create

The ZKsync CLI provides a helpful command to scaffold a project to develop smart contracts, dApps, and scripts for ZKsync. The create command provides many templates to allow you to quickly start a project using various available libraries and frameworks like Solidity, Vyper, Ethers, and Hardhat to name a few.

Create a new project

To quickly setup a brand new project, navigate to a directory where you want to set up a new folder for your project. In this example we will create a project to build smart contracts. Run the following command:

zksync-cli create

The CLI prompts you with several questions to determine what template to setup for the new project. A template will download and the dependencies will install using the selected package manager.

? Enter a folder name for your project: example-project
? What type of project do you want to create? Contracts
? Ethereum framework Ethers v6
? Template Hardhat + Solidity
? Private key of the wallet responsible for deploying contracts (optional)
? Package manager npm

Setting up template in /Users/sf/scratch/playground/example-project...
 Cloned template
 Environment variables set up
 Installing dependencies with npm... This may take a couple minutes.

Upon a successful install, the CLI will return a success message with instructions on how to navigate to your project along common commands to use.

 Dependencies installed

🎉 All set up! 🎉

--------------------------

Navigate to your project: cd example-project

Directory Overview:
  - Contracts: /contracts
  - Deployment Scripts: /deploy

Commands:
  - Compile your contracts: npm run compile
  - Deploy your contract: npm run deploy
    - Tip: You can use the --network option to specify the network to deploy to.

Further Reading:
  - Check out the README file in the project location for more details: example-project/README.md

--------------------------

Navigate into your project with the command provided from the CLI.

cd example-project

If you are using VSCode for development, you can use the VSCode CLI to launch from the command line. Depending on your environment, you may need to pre-install some requirements before you can run the VSCode CLI. For more information, see the section Launching from command line from Visual Studio Code's Command Line Interface (CLI).

code .

Next steps

You have successfully scaffolded a new project to start developing on ZKsync! Check out the Community Code website to find a collection of tutorials and guides to further your knowledge in developing on ZKsync.


Made with ❤️ by the ZKsync Community