To initialize a new project, simply run:
anchor init <new-workspace-name>
This creates a new anchor workspace you can move into. The following are some of the important files in the folder:
.anchor
folder: It includes the most recent program logs and a local ledger that is used for testingapp
folder: An empty folder that you can use to hold your frontend if you use a monorepoprograms
folder: This folder contains your programs. It can contain multiple but initially only contains a program with the same name as <new-workspace-name>
. This program already contains a lib.rs
file with some sample code.tests
folder: The folder that contains your E2E tests. It will already include a file that tests the sample code in the programs/<new-workspace-name>
.migrations
folder: In this folder you can save your deploy and migration scripts for your programs.Anchor.toml
file: This file configures workspace wide settings for your programs. Initially, it configures
[programs.localnet]
)[registry]
)[provider]
)[scripts]
). The test
script is run when running anchor test
. You can run your own scripts with anchor run <script_name>
.