Use Docker Desktop to run substrate-cli in local.
- Make sure the docker daemon is running before starting cli.
- Open a terminal from the directory where you downloaded/cloned substrate-cli.
- Mac -> type in ./subs2.command in the terminal, this will start cli. for windows, one doesn’t need to open a terminal, directly can double click or run subs2.bat
- This can ask for the required permissions(mostly in Mac). you can safely click allow to let substrate run in the background.
- Once allowed, 2 terminals will popup, one is the primary terminal and second is the actual user interactive cli where you will be asked to choose model and enter your prompt.
- The selector will ask for your preferred model.
- Once model is selected, it will prompt for the api key.
- Enter the cluster name, if cluster name not prompted, it will automatically generate a name for the project.
- Once you paste your api key, it will ask for the description.
- Once substrate starts building your project, wait for your cluster generation completion, it can take upto a few minutes.
- Once generated Substrate CLI will notify in terminal that your app is running on a particular port.
Download and save a project to local computer.
- run ‘./download.command’ in terminal for Mac/ double click or run download.bat for Windows.
- This will save your cluster by the project name in your directory where the substrate cli is located with folder name “gen”
- Once downloaded it is good to manually quit the running cluster containers from docker to prevent taking the cluster unnecessary resources. For ex., if the cluster name was “winter-wolf-245” simply look for the container named “winter-wolf-245”. If you have generated a full stack cluster then there will be 2 containers named “winter-wolf-245-app” and “winter-wolf-245-server” so you will have to quit 2 of them.
- once you are done with Substrate CLI, you can press ctrl+c on the primary terminal and the interactive terminal where substrate started to quit all the containers in docker. wait for the containers to quit or else it will fail to jeopardise all the container.
- If somehow containers fail to quit, then you can manually quit and remove all the running containers on docker desktop UI.
What substrate-cli can :
- Build a web app completely on next js
- Build a web app completely on next js and node js, if you specify “with backend” in the prompt it will simply include node js in the cluster and run node js and next js apps in separate containers.
- Clone a web-app from url, if you specify a valid url in the prompt, Substrate CLI will clone your specified url web app into a next js project and start it in a container.
- Clone a web-app from GitHub repo, if you specify a GitHub repo in the prompt, Substrate CLI will clone it into an interactive web app.
What substrate-cli cannot :
- Edit a website. once a cluster is generated, it won’t ask you for a prompt to make customisations or tweaks.
- Deploy your cluster.