init
The algokit init
command is used to quickly initialize new projects using official Algorand Templates or community provided templates. It supports a fully guided command line wizard experience, as well as fully scriptable / non-interactive functionality via command options.
Quick start
For a quick start template with all of the defaults you can run: algokit init
which will interactively guide you through picking the right stack to build your AlgoKit project. Afterwards, you should immediately be able to hit F5 to compile the hello world smart contract to the smart_contracts/artifacts
folder (with breakpoint debugging - try setting a breakpoint in smart_contracts/helloworld.py
) and open the smart_contracts/helloworld.py
file and get linting, automatic formatting and syntax highlighting.
Prerequisites
Git is a prerequisite for the init command as it is used to clone templates and initialize git repos. Please consult the AlgoKit Getting Started Guide for installation instructions.
Functionality
As outlined in quick start, the simplest use of the command is to just run algokit init
and you will then be guided through selecting a template and configuring options for that template. e.g.
1> algokit init2? Which of these options best describes the project you want to start? `Smart Contract` | `Dapp Frontend` | `Smart Contract & Dapp Frontend` | `Custom`3? Name of project / directory to create the project in: my-cool-app
Once above 2 questions are answered, the cli
will start instantiating the project and will start asking questions specific to the template you are instantiating. By default official templates such as python
, fullstack
, react
, beaker
include a notion of a preset
. If you want to skip all questions and let the tool preset the answers tailored for a starter project you can pick Starter
, for a more advanced project that includes unit tests, CI automation and other advanced features, pick Production
. Lastly, if you prefer to modify the experience and tailor the template to your needs, pick the Custom
preset.
If you want to accept the default for each option simply hit [enter] or alternatively to speed things up you can run algokit init --defaults
and they will be auto-accepted.
Workspaces vs Standalone Projects
AlgoKit supports two distinct project structures: Workspaces and Standalone Projects. This flexibility allows developers to choose the most suitable approach for their projectβs needs.
To initialize a project within a workspace, use the --workspace
flag. If a workspace does not already exist, AlgoKit will create one for you by default (unless you disable it via --no-workspace
flag). Once established, new projects can be added to this workspace, allowing for centralized management.
To create a standalone project, use the --no-workspace
flag during initialization. This instructs AlgoKit to bypass the workspace structure and set up the project as an isolated entity.
For more details on workspaces and standalone projects, refer to the AlgoKit Project documentation.
Bootstrapping
You will also be prompted if you wish to run the bootstrap command, this is useful if you plan to immediately begin developing in the new project. If you passed in --defaults
or --bootstrap
then it will automatically run bootstrapping unless you passed in --no-bootstrap
.
1? Do you want to run `algokit bootstrap` to bootstrap dependencies for this new project so it can be run immediately? Yes2Installing Python dependencies and setting up Python virtual environment via Poetry3poetry: Creating virtualenv my-smart-contract in /Users/algokit/algokit-init/my-smart-contract/.venv4poetry: Updating dependencies5poetry: Resolving dependencies...6poetry:7poetry: Writing lock file8poetry:9poetry: Package operations: 53 installs, 0 updates, 0 removals10poetry:11poetry: β’ Installing pycparser (2.21)12
13---- other output omitted for brevity ----14
15poetry: β’ Installing ruff (0.0.171)16Copying /Users/algokit/algokit-init/my-smart-contract/smart_contracts/.env.template to /Users/algokit/algokit-init/my-smart-contract/smart_contracts/.env and prompting for empty values17? Would you like to initialise a git repository and perform an initial commit? Yes18π Performed initial git commit successfully! π19π Project initialized at `my-smart-contract`! For template specific next steps, consult the documentation of your selected template π§20Your selected template comes from:21β‘οΈ https://github.com/algorandfoundation/algokit-beaker-default-template22As a suggestion, if you wanted to open the project in VS Code you could execute:23
24> cd my-smart-contract && code .
After bootstrapping you are also given the opportunity to initialize a git repo, upon successful completion of the init command the project is ready to be used. If you pass in --git
it will automatically initialise the git repository and if you pass in --no-git
it wonβt.
Options
There are a number of options that can be used to provide answers to the template prompts. Some of the options requiring further explanation are detailed below, but consult the CLI reference for all available options.
Community Templates
As well as the official Algorand templates shown when running the init command, community templates can also be provided by providing a URL via the prompt or the --template-url
option.
e.g. algokit init --template-url https://github.com/algorandfoundation/algokit-beaker-default-template
(that being the url of the official beaker template, the same as algokit init -t beaker
).
The --template-url
option can be combined with --template-url-ref
to specify a specific commit, branch or tag
e.g. algokit init --template-url https://github.com/algorandfoundation/algokit-beaker-default-template --template-url-ref 9985005b7389c90c6afed685d75bb8e7608b2a96
If the URL is not an official template there is a potential security risk and so to continue you must either acknowledge this prompt, or if you are in a non-interactive environment you can pass the --UNSAFE-SECURITY-accept-template-url
option (but we generally donβt recommend this option so users can review the warning message first) e.g.
1Community templates have not been reviewed, and can execute arbitrary code.2Please inspect the template repository, and pay particular attention to the values of \_tasks, \_migrations and \_jinja_extensions in copier.yml3? Continue anyway? Yes
If you want to create a community template, you can use the AlgoKit guidelines on template building and Copier documentation as a starting point.
Template Answers
Answers to specific template prompts can be provided with the --answer {key} {value}
option, which can be used multiple times for each prompt. Quotes can be used for values with spaces e.g. --answer author_name "Algorand Foundation"
.
To find out the key for a specific answer you can either look at .algokit/.copier-answers.yml
in the root folder of a project created via algokit init
or in the copier.yaml
file of a template repo e.g. for the beaker template.
Non-interactive project initialization
By combining a number of options, it is possible to initialize a new project without any interaction. For example, to create a project named my-smart-contract
using the beaker
template with no git, no bootstrapping, the author name of Algorand Foundation
, and defaults for all other values, you could execute the following:
1> algokit init -n my-smart-contract -t python --no-git --no-bootstrap --answer author_name "Algorand Foundation" --defaults2π Project initialized at `my-smart-contract`! For template specific next steps, consult the documentation of your selected template π§3Your selected template comes from:4β‘οΈ https://github.com/algorandfoundation/algokit-beaker-default-template5As a suggestion, if you wanted to open the project in VS Code you could execute:6
7> cd my-smart-contract && code .