paltalabs / create-soroban-dapp

Boilerplate for Soroban dApps in ReactJS
https://create-soroban-dapp.vercel.app
Apache License 2.0
7 stars 13 forks source link

@create-soroban-dapp

@create-soroban-dapp is both a npx script and a boilerplate dapp for kickstarting any of your ideas for a Soroban-based Dapp.

Largely inspired by the ink!athon project by Scio Labs and by @create-t3-app by T3 Open Source for the script mechanisms.

Check the LIVE VERSION of the dapp utilizing already deployed testnet contract!

Read the docs here πŸ“šπŸ“š

Introduction

@create-soroban-dapp is composed of two things:

Usage:

Simply use

npx create-soroban-dapp@latest

or

npm create soroban-dapp@latest

Then, cd inside the new project repository.

Troubleshooting

If npm create script malfunctions

The script in its early stage is likely to not function perfectly on every different os and configuration. If the script happens to not function properly 'please report to @benjaminsalon' on the stellar developer discord channel.

Manual cloning

It is also possible to use the dapp boilerplate via manually cloning the repo:

git clone git@github.com:paltalabs/create-soroban-dapp.git

The dapp will then not be in the root folder, this folder is occupied by the npx script. You will find the dapp in the sub folder 'soroban-react-dapp':

cd soroban-react-dapp

From there, it is a normal nextjs app:

yarn or npm install or pnpm install

Using quickstart!

This will launch a Stellar node, when using standalone it will create a Stellar blockchain locally. Also, it will run a container with all the necessary dependancies to deploy and interact with the contracts. Along with the dapp container that will run the front-end of the dapp.

First configure the ADMIN_SECRET_KEY and MAINNET_RPC_URL in the contracts/.env file. You can use the contracts/.env.example file as a template.

Second, move to soroban-react-dapp

```bash
cd soroban-react-dapp
```

Then, run the following command to start the dapp and the soroban node:

bash quickstart.sh <network>

you will typically use this with standalone:

bash quickstart.sh standalone

then open a new terminal, and run the following command to start the dapp:

bash run.sh

Then, compile contracts:

cd contracts
make

Then, install packages

yarn

Then, deploy contracts (in this example we will deploy the greeting contract):

yarn deploy testnet greeting

and run the dapp locally in development mode

cd .. # Move to the parent folder
yarn dev