Skip to content
245 changes: 155 additions & 90 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,105 +3,87 @@
[![Apache 2.0 licensed](https://img.shields.io/badge/license-apache%202.0-blue.svg)](LICENSE)
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/AhaLabs/scaffold-stellar)

Scaffold Stellar is a convention-over-configuration toolkit for blockchain and distributed application development on the Stellar network. It provides a seamless development experience through CLI tools, smart contract management, and deployment utilities.
**Scaffold Stellar** is a developer toolkit for building decentralized applications (dApps) and smart contracts on the [**Stellar** blockchain](https://stellar.org).

The project consists of several main components:
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.

- **stellar-scaffold-cli**: The main command-line interface for Scaffold Stellar. It provides commands for initializing projects, managing development workflows, and automating contract deployment.
---

- **stellar-registry-cli**: A CLI tool for managing the on-chain contract registry, handling contract publishing, deployment, and version management.
## Why Use Scaffold Stellar?

- **stellar-build**: Core build utilities and helper functions for Stellar smart contract development.
- Simplifies blockchain dApp development
- Generates smart contract projects and React UIs
- Deploys smart contracts and manages versions
- Easy to learn for newcomers; powerful for pros

- **stellar-scaffold-macro**: Rust procedural macros that simplify contract development and integrate with the Scaffold Stellar ecosystem.
---

- **registry**: The on-chain smart contract that powers the Scaffold Stellar registry system, enabling contract verification, naming, and version management.
## What Is Stellar?

[**Stellar**](https://www.stellar.org/) is a blockchain designed for fast, low-cost financial transactions and smart contracts written in **Rust** and compiled to **WebAssembly (Wasm)**.

## Features
With Scaffold Stellar, you write smart contracts in Rust and interact with them using modern TypeScript + React tooling.

- **CLI Plugins for Stellar**
- `stellar scaffold`: Initialize and manage Scaffold Stellar projects
- Creates smart contract projects with best practices
- Includes frontend setup using [scaffold-stellar-frontend](https://github.com/AhaLabs/scaffold-stellar-frontend)
- `stellar registry`: Publish Wasm binaries and deploy smart contracts
- Automated development workflow with hot reloading
---

Currently these are available as separate binaries: `stellar-scaffold` and `stellar-registry` respectively.
## Prerequisites

- **Declarative Environment Management**
- Environment-specific builds (development, testing, staging, production)
- Seamless integration with both local and deployed contracts
- Network configuration via `environments.toml`
Before you begin, make sure you have the following installed:

- **Coming soon: Smart Contract Registry**
- On-chain publishing platform for Wasm binaries
- Version management and contract naming
- Contract verification and dependency management
| Tool | Description | Install Link |
|------|-------------|--------------|
| [Rust & Cargo](https://www.rust-lang.org/tools/install) | For writing and compiling smart contracts | `curl https://sh.rustup.rs -sSf \| sh` |
| [Node.js & npm](https://nodejs.org/) | For frontend development | Download from official site |
| [Just](https://github.com/casey/just) | Task runner used in the setup process | `cargo install just` |
| [Git](https://git-scm.com/downloads) | To clone the repository | [Download Git](https://git-scm.com/downloads) |

- **Coming soon: Deployment Pipeline**
- Streamlined deployment process for testnet and mainnet
- Contract lifecycle management
- Automated environment updates
---

## Project Structure
## Quickstart (New Developers Welcome!)

- `stellar-scaffold-cli`: Main CLI tool for project scaffolding and development
- `stellar-registry-cli`: Contract registry and deployment management
- `stellar-build`: Build utilities for Stellar smart contracts
- `stellar-scaffold-macro`: Procedural macros for contract development
This section walks you through setting up Scaffold Stellar from scratch.

## Installation
### 1. Clone the Repository
Comment thread
pselle marked this conversation as resolved.
Outdated

### Development Setup
```bash
just setup && just build
```

### Direct Installation
To install the executables directly:

```bash
git clone https://github.com/AhaLabs/scaffold-stellar.git
cd scaffold-stellar
```
### 2. Install the CLI Tools
```
# Install stellar-scaffold-cli
cargo install stellar-scaffold-cli

# Install stellar-registry-cli
# Install stellar-scaffold-cli
Comment thread
CoolatMax marked this conversation as resolved.
Outdated
cargo install stellar-registry-cli
```

## Quick Start

1. Install the required CLI tools:
```bash
# Install stellar-scaffold CLI
cargo install stellar-scaffold-cli

# Install registry CLI (needed for deployments)
cargo install stellar-registry-cli
### 3. Create a New Project
```

2. Initialize a new project:
```bash
stellar scaffold init my-project
cd my-project
```

3. Set up your development environment:
```bash
### 4. Configure Your Environment
```
# Copy and configure environment variables
cp .env.example .env
```

Edit `.env` with your preferred network, secret keys, and other settings.

# Install frontend dependencies
### 5. Install Frontend Dependencies
```
# Install Frontend dependencies
npm install
```

4. Start development environment:
```bash
### 6. Start Development
```
npm run dev
```
You should see your React frontend at http://localhost:3000.
Comment thread
CoolatMax marked this conversation as resolved.
Outdated

5. For testnet/mainnet deployment:
```bash
### 7. For testnet/mainnnet deployment:
Comment thread
CoolatMax marked this conversation as resolved.
Outdated
```
# First publish your contract to the registry
stellar registry publish

Expand All @@ -123,45 +105,128 @@ stellar registry deploy \
stellar registry install my-contract
```

## Scaffold Initial Project Structure

When you run `stellar scaffold init`, it creates a frontend-focused project structure with example contracts:
## Project Layout
After scaffolding a project, your folder structure will look like this:

```
my-project/ # Your initialized project
├── contracts/ # Example smart contracts
├── packages/ # Auto-generated TypeScript clients
├── src/ # Frontend React application
│ ├── components/ # React components
│ ├── contracts/ # Contract interaction helpers
│ ├── App.tsx # Main application component
│ └── main.tsx # Application entry point
├── target/ # Build artifacts and WASM files
├── environments.toml # Environment configurations
├── package.json # Frontend dependencies
── .env # Local environment variables
my-project/
├── contracts/ # Rust smart contracts (compiled to WASM)
├── packages/ # Auto-generated TypeScript contract clients
├── src/ # React frontend code
│ ├── components/ # Reusable UI pieces
│ ├── contracts/ # Contract interaction logic
│ ├── App.tsx # Main app component
│ └── main.tsx # Entry point
├── environments.toml # Configuration per environment (dev/test/prod)
├── .env # Local environment variables
├── package.json # Frontend packages
── target/ # Build outputs
```

This template provides a ready-to-use frontend application with example smart contracts and their TypeScript clients. You can use these as reference while building your own contracts and UI. The frontend is set up with Vite, React, and includes basic components for interacting with the contracts.

See the [CLI Documentation](./docs/cli.md) for detailed command information and the [Environments Guide](./docs/environments.md) for configuration details.
See the [CLI Documentation](https://github.com/AhaLabs/scaffold-stellar/blob/main/docs/cli.md) for detailed command information and the [Environments Guide](https://github.com/AhaLabs/scaffold-stellar/blob/main/docs/environments.md) for configuration details.
Comment thread
CoolatMax marked this conversation as resolved.

## Documentation
---

- [CLI Commands](./docs/cli.md)
- [Environment Configuration](./docs/environments.md)
- [Registry Guide](./docs/registry.md)
- [Deployment Guide](./docs/deployment.md)
## CLI Tools
Comment thread
CoolatMax marked this conversation as resolved.
Scaffold Stellar provides two main CLI tools:

stellar-scaffold
Initialize and manage dApp projects:
```
stellar scaffold init my-project
stellar-registry
```
Manage contract deployment and versions:
```
stellar registry publish # Publish contract to the registry
stellar registry deploy # Deploy a contract instance
stellar registry install # Install deployed contracts locally
```
> Use `--help` on any command for usage instructions.

---
## Smart Contract Deployment
1. Publish Your Contract
```
stellar registry publish
```
2. Deploy the Contract
```
stellar registry deploy \
--deployed-name my-contract \
--published-name my-contract \
-- \
--param1 value1
```
3. Install the Deployed Contract
```
stellar registry install my-contract
```
> You can deploy to testnet or mainnet depending on your `.env` and `environments.toml`.

---
## Concept: What Is the Contract Registry?
The registry is an on-chain smart contract that lets you:
* Publish and verify other contracts
* Manage multiple versions
* Reuse deployed contracts across dApps

>This means your contracts can be upgraded, shared, and used like packages.
---
## Project Structure (Top-Level)
Your repo contains the following key folders:

|Folder | Purpose |
|-------|---------|
|`.cargo/`, `.config/` | Rust and build settings|
|`contracts/` | Example smart contracts|
|`crates/`| Internal Rust libraries and helpers|
|`docs/`| Documentation files|
|`npm/`| Shared frontend packages|
|`deploy_registry.sh`| Helper script to deploy the registry|
|`justfile` | Commands you can run with just|

---

Documentation
* [CLI Commands](https://github.com/AhaLabs/scaffold-stellar/blob/main/docs/cli.md)
* [Environment Setup](https://github.com/AhaLabs/scaffold-stellar/blob/main/docs/environments.md)
* [Registry Guide](https://github.com/AhaLabs/scaffold-stellar/blob/main/docs/registry.md)
* [Deployment Guide](https://github.com/AhaLabs/scaffold-stellar/blob/main/docs/deployment.md)

---
## Learning Resources
Video: [Intro to Scaffold Stellar](https://www.youtube.com/watch?v=559ht4K4pkM)

Video : [Which Frontend?](https://www.youtube.com/watch?v=pz7O54Oia_w)

Video : [Get Started Building](https://www.youtube.com/watch?v=H-M962aPuTk)

---
## Contributing
We love contributions! If you’re new, check these out:

Contributions are welcome! Please check out our [Contributing Guide](CONTRIBUTING.md) for guidelines.
[Contributing Guide](https://github.com/AhaLabs/scaffold-stellar/blob/main/CONTRIBUTING.md)

## Additional Developer Resources
- Video: [Intro to Scaffold Stellar](https://www.youtube.com/watch?v=559ht4K4pkM)
- Video: [Which Frontend?](https://www.youtube.com/watch?v=pz7O54Oia_w)
- Video: [Get Started Building](https://www.youtube.com/watch?v=H-M962aPuTk)
---

## License

This project is licensed under the Apache-2.0 License - see the [LICENSE](LICENSE) file for details.
#### This project is licensed under the Apache-2.0 License — see the [LICENSE](https://github.com/scaffold-stellar/blob/main/LICENSE) file for details.
---

## Need Help?
If you’re new to Stellar, Rust, or smart contracts:

Ask questions in the repo Discussions tab

Search [DeepWiki](https://deepwiki.org/)

Or just open an issue — we're happy to help!

Happy hacking!
---
##### Readme Created by
##### **[SHISHIR TAMBE](https://github.com/SHISKEBAB)**
Comment thread
CoolatMax marked this conversation as resolved.
Outdated