AlgoKit Project Run
The algokit project run command allows defining custom commands to execute at standalone project level or being orchestrated from a workspace containing multiple standalone projects.
Usage
1$ algokit project run [OPTIONS] COMMAND [ARGS]This command executes a custom command defined in the .algokit.toml file of the current project or workspace.
Options
- -l, --list: List all projects associated with the workspace command. (Optional)
- -p, --project-name: Execute the command on specified projects. Defaults to all projects in the current directory. (Optional)
- -t, --type: Limit execution to specific project types if executing from workspace. (Optional)
- -s, --sequential: Execute workspace commands sequentially, for cases where you do not have a preference on the execution order, but want to disable concurrency. (Optional, defaults to concurrent)
- [ARGS]...: Additional arguments to pass to the custom command. These will be appended to the end of the command specified in the- .algokit.tomlfile.
To get detailed help on the above options, execute:
1algokit project run {name_of_your_command} --helpWorkspace vs Standalone Projects
AlgoKit supports two main types of project structures: Workspaces and Standalone Projects. This flexibility caters to the diverse needs of developers, whether managing multiple related projects or focusing on a single application.
- 
Workspaces: Ideal for complex applications comprising multiple sub-projects. Workspaces facilitate organized management of these sub-projects under a single root directory, streamlining dependency management and shared configurations. 
- 
Standalone Projects: Suited for simpler applications or when working on a single component. This structure offers straightforward project management, with each project residing in its own directory, independent of others. 
Please note, instantiating a workspace inside a workspace (aka ‘workspace nesting’) is not supported and not recommended. When you want to add a new project into existing workspace make sure to run
algokit initfrom the root of the workspace
Custom Command Injection
AlgoKit enhances project automation by allowing the injection of custom commands into the .algokit.toml configuration file. This feature enables developers to tailor the project setup to their specific needs, automating tasks such as deploying to different network environments or integrating with CI/CD pipelines.
How It Works
The orchestration between workspaces, standalone projects, and custom commands is designed to provide a seamless development experience. Below is a high-level overview of how these components interact within the AlgoKit ecosystem.
1graph TD;2A[AlgoKit Project] --> B["Workspace (.algokit.toml)"];3A --> C["Standalone Project (.algokit.toml)"];4B --> D["Sub-Project 1 (.algokit.toml)"];5B --> E["Sub-Project 2 (.algokit.toml)"];6C --> F["Custom Commands defined in .algokit.toml"];7D --> F;8E --> F;- AlgoKit Project: The root command that encompasses all project-related functionalities.
- Workspace: A root folder that is managing multiple related sub-projects.
- Standalone Project: An isolated project structure for simpler applications.
- Custom Commands: Commands defined by the user in the .algokit.tomland automatically injected into thealgokit project runcommand group.
Workspace cli options
Below is only visible and available when running from a workspace root.
- -l, --list: List all projects associated with the workspace command. (Optional)
- -p, --project-name: Execute the command on specified projects. Defaults to all projects in the current directory. (Optional)
- -t, --type: Limit execution to specific project types if executing from workspace. (Optional) To get a detailed help on the above commands execute:
1algokit project run {name_of_your_command} --helpExamples
Assume you have a default workspace with the following structure:
1my_workspace2├── .algokit.toml3├── projects4│   ├── project15│   │   └── .algokit.toml6│   └── project27│       └── .algokit.tomlThe workspace configuration file is defined as follows:
1# ... other non [project.run] related metadata2[project]3type = 'workspace'4projects_root_path = 'projects'5# ... other non [project.run] related metadataStandalone configuration files are defined as follows:
1# ... other non [project.run] related metadata2
3[project]4type = 'contract'5name = 'project_a'6
7[project.run]8hello = { commands = ['echo hello'], description = 'Prints hello' }9
10# ... other non [project.run] related metadata1# ... other non [project.run] related metadata2
3[project]4type = 'frontend'5name = 'project_b'6
7[project.run]8hello = { commands = ['echo hello'], description = 'Prints hello' }9
10# ... other non [project.run] related metadataExecuting algokit project run hello from the root of the workspace will concurrently execute echo hello in both project_a and project_b directories.
Executing algokit project run hello from the root of project_(a|b) will execute echo hello in the project_(a|b) directory.
Controlling Execution Order
Customize the execution order of commands in workspaces for precise control:
- 
Define order in .algokit.toml:1[project]2type = 'workspace'3projects_root_path = 'projects'45[project.run]6hello = ['project_a', 'project_b']
- 
Execution behavior: - Projects are executed in the specified order
- Invalid project names are skipped
- Partial project lists: Specified projects run first, others follow
 
Note: Explicit order always triggers sequential execution.
Controlling Concurrency
You can control whether commands are executed concurrently or sequentially:
- 
Use command-line options: Terminal window 1$ algokit project run hello -s # or --sequential2$ algokit project run hello -c # or --concurrent
- 
Behavior: - Default: Concurrent execution
- Sequential: Use -sor--sequentialflag
- Concurrent: Use -cor--concurrentflag or omit the flag (defaults to concurrent)
 
Note: When an explicit order is specified in
.algokit.toml, execution is always sequential regardless of these flags.
Passing Extra Arguments
You can pass additional arguments to the custom command. These extra arguments will be appended to the end of the command specified in your .algokit.toml file.
Example:
1$ algokit project run hello -- worldIn this example, if the hello command in .algokit.toml is defined as echo "Hello", the actual command executed will be echo "Hello" world.
Further Reading
To learn more about the algokit project run command, please refer to run in the AlgoKit CLI reference documentation.