|
| 1 | +--- |
| 2 | +title: Scaffold Stellar |
| 3 | +description: Convention-over-configuration toolkit for Stellar smart contract development |
| 4 | +sidebar_label: Scaffold Stellar |
| 5 | +sidebar_position: 110 |
| 6 | +--- |
| 7 | + |
| 8 | +**Scaffold Stellar** is a developer toolkit for building decentralized applications (dApps) and smart contracts on the Stellar blockchain. It helps you go from idea to working full-stack dApp faster — by providing CLI tools, reusable contract templates, a smart contract registry, and a modern frontend. |
| 9 | + |
| 10 | +## Prerequisites |
| 11 | + |
| 12 | +Before you begin, make sure you have the following installed: |
| 13 | + |
| 14 | +| Tool | Description | Install Link | |
| 15 | +| --- | --- | --- | |
| 16 | +| [Rust & Cargo](https://www.rust-lang.org/tools/install) | For writing and compiling smart contracts | `curl https://sh.rustup.rs -sSf \| sh` | |
| 17 | +| [Node.js & npm](https://nodejs.org/) | For frontend development | Download from official site | |
| 18 | +| [Stellar CLI](https://github.com/stellar/stellar-cli) | For building, deploying, and interacting with smart contracts | [`Link for the repo`](https://github.com/stellar/stellar-cli) | |
| 19 | + |
| 20 | +## Getting Started |
| 21 | + |
| 22 | +### Installation |
| 23 | + |
| 24 | +Install the required CLI tools: |
| 25 | + |
| 26 | +```bash |
| 27 | +# Install stellar-scaffold CLI |
| 28 | +cargo install stellar-scaffold-cli |
| 29 | + |
| 30 | +# Install registry CLI (to easily deploy your contract to the registry) |
| 31 | +cargo install stellar-registry-cli |
| 32 | +``` |
| 33 | + |
| 34 | +### Creating a New Project |
| 35 | + |
| 36 | +1. Initialize a new project: |
| 37 | + |
| 38 | +```bash |
| 39 | +stellar scaffold init my-project |
| 40 | +cd my-project |
| 41 | +``` |
| 42 | + |
| 43 | +You will have a few sample contracts already in the project, or you can start from the [OpenZeppelin Wizard](./openzepplin-contracts) to customize your contract and start a Scaffold Stellar project from there. |
| 44 | + |
| 45 | +2. Set up your development environment: |
| 46 | + |
| 47 | +```bash |
| 48 | +# Copy and configure environment variables |
| 49 | +cp .env.example .env |
| 50 | + |
| 51 | +# Install frontend dependencies |
| 52 | +npm install |
| 53 | +``` |
| 54 | + |
| 55 | +3. Start development environment: |
| 56 | + |
| 57 | +```bash |
| 58 | +npm run dev |
| 59 | +``` |
| 60 | + |
| 61 | +You'll have a running dApp, with a couple of contracts to start with, ready to start building! |
| 62 | + |
| 63 | +Explore the `environments.toml` file to customize your development environment(s). |
| 64 | + |
| 65 | +## Project Structure |
| 66 | + |
| 67 | +When you run `stellar scaffold init`, it creates a full-stack project structure with example contracts and a modern frontend: |
| 68 | + |
| 69 | +``` |
| 70 | +my-project/ |
| 71 | +├── contracts/ # Rust smart contracts (compiled to WASM) |
| 72 | +├── packages/ # Auto-generated TypeScript contract clients |
| 73 | +├── src/ # React frontend code |
| 74 | +│ ├── components/ # Reusable UI components |
| 75 | +│ ├── contracts/ # Contract interaction logic |
| 76 | +│ ├── App.tsx # Main app component |
| 77 | +│ └── main.tsx # Entry point |
| 78 | +├── environments.toml # Configuration per environment (dev/test/prod) |
| 79 | +├── .env # Local environment variables |
| 80 | +├── package.json # Frontend packages |
| 81 | +└── target/ # Build outputs |
| 82 | +``` |
| 83 | + |
| 84 | +This template provides a ready-to-use frontend application with example smart contracts and their TypeScript clients. The frontend is set up with `Vite`, `React`, and includes basic components for interacting with the contracts. |
| 85 | + |
| 86 | +## Features |
| 87 | + |
| 88 | +- **CLI Plugins for Stellar** |
| 89 | + |
| 90 | + - `stellar scaffold init`: Initialize new Stellar smart contract projects |
| 91 | + - `stellar scaffold upgrade`: Transform existing Stellar contract workspaces into Scaffold projects |
| 92 | + - `stellar scaffold build`: Build contracts and generate TypeScript clients |
| 93 | + - `stellar scaffold watch`: Development mode with hot reloading |
| 94 | + - `stellar registry`: Publish, deploy, and manage smart contracts |
| 95 | + |
| 96 | +- **Environment Management** |
| 97 | + |
| 98 | + - Environment-specific builds (development, testing, staging, production) |
| 99 | + - Seamless integration with both local and deployed contracts |
| 100 | + - Network configuration via `environments.toml` |
| 101 | + - Support for multiple deployment environments |
| 102 | + |
| 103 | +- **Smart Contract Registry** |
| 104 | + - On-chain publishing platform for Wasm binaries |
| 105 | + - Version management and contract naming |
| 106 | + - Contract verification and dependency management |
| 107 | + - Secure deployment workflow for testnet and mainnet |
| 108 | + |
| 109 | +### More Resources |
| 110 | + |
| 111 | +For more information, check out the [project on GitHub](https://github.com/AhaLabs/scaffold-stellar)! |
0 commit comments