2

Let's say I have downloaded all the necessary things needed to start developing on Cardano and I just opened up the terminal. I want to start building a new project. What are the commands I run.

Example -- If I was going to do this for React I would run the following command and start coding.

npx create-react-app my-app
cd my-app
npm start

What is the equivalent of that for Plutus.

1

3 Answers 3

3

There is no npx create-react-app my-app on cardano unfortunately, but there is a helpful repository that has the project structure necessary to start working with plutus.

So, first, you need to nix-shell inside the plutus-apps repo:

$ git clone https://github.com/input-output-hk/plutus-apps # if you haven't already
$ cd plutus-apps
$ git checkout <current-tag>
$ nix-shell

The git checkout part just need's to be done in the first time you run this or whenever you change the cabal.project file. "<current-tag>" can be found inside cabal.project file (in this case it would be plutus-starter-devcontainer/v1.0.14)

So, assuming you are already on a nix-shell, it would look like this:

$ git clone https://github.com/input-output-hk/plutus-starter.git
$ cd plutus-starter
$ cabal update
$ cabal repl

Way longer than the create-react-app one, but that's mainly because of nix-shell, after a while you get used to it.

2
  • Why do we need to do the command git checkout <current tag> ? I am following the plutus-pionner-program and I have to do this for every week's folder too. Why cant we just run nix-shell and start up the client ?
    – szhang9921
    Mar 17, 2022 at 0:56
  • Because plutus-apps is being constantly developed and so some syntax / features change from lecture to lecture
    – Mateus
    Mar 17, 2022 at 8:58
1

If your app is fairly simple and all you need is to be able to send transactions to an address, send transactions to a smart contract or redeem assets from a smart contract then there is a create-react-app to get you started here:

Create React App on Cardano Developer Portal

0

inside the terminal you would be able to make a custom directory (or folder tree) using the commands mkdir and cd which make a folder and change the current folder your in respectively.

Doing this will separate your project files from the plutus files, but by running nix-shell your environment would still be the one required to compile plutus smart contracts.

To use this with vscode from the terminal navigate to your project directory and run code .. This should port your nix-shell environment into the vscode one, if it doesn't you may have to change some settings in vscode.

Between this and @Mateus answer your good to go.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.