Skip to content

Latest commit

 

History

History
209 lines (156 loc) · 4.41 KB

File metadata and controls

209 lines (156 loc) · 4.41 KB

Quick Start: Template Marketplace

Get started with the StarForge Template Marketplace in 5 minutes.

Installation

# Build StarForge with the new feature
cargo build --release

# Add to PATH (optional)
cp target/release/starforge ~/.local/bin/

1. Initialize (First Time Only)

starforge template init

This adds example templates to your local registry.

2. Discover Templates

Search

# Search by keyword
starforge template search defi

# Search with tags
starforge template search dex --tags amm

List All

starforge template list

View Details

starforge template show uniswap-v2

3. Use a Template

# Create project from marketplace template
starforge new contract my-dex --template uniswap-v2 --from marketplace

# Navigate and build
cd my-dex
stellar contract build

4. Create Your Own Template

Step 1: Create a Contract

starforge new contract my-template
cd my-template

Step 2: Add Placeholders

Edit Cargo.toml:

[package]
name = "{{PROJECT_NAME}}"

Edit src/lib.rs:

#[contract]
pub struct {{PROJECT_NAME_PASCAL}};

Step 3: Test It

cargo test
stellar contract build

Step 4: Publish

cd ..
starforge template publish ./my-template \
  --name my-awesome-template \
  --description "Does something awesome" \
  --author "Your Name" \
  --tags "defi,awesome"

5. Share with Others

# Others can now use your template
starforge new contract test-project \
  --template my-awesome-template \
  --from marketplace

Available Placeholders

Placeholder Input: "my-project" Output
{{PROJECT_NAME}} my-project my-project
{{PROJECT_NAME_SNAKE}} my-project my_project
{{PROJECT_NAME_PASCAL}} my-project MyProject

Common Commands

# Search
starforge template search <query>
starforge template search <query> --tags <tag1,tag2>

# List
starforge template list

# Show
starforge template show <name>

# Use
starforge new contract <name> --template <template> --from marketplace

# Publish
starforge template publish <path> [options]

# Remove
starforge template remove <name>

# Initialize
starforge template init

Example Workflow

# 1. Find a template
starforge template search lending

# 2. Check it out
starforge template show lending-pool

# 3. Use it
starforge new contract my-lending --template lending-pool --from marketplace

# 4. Build and deploy
cd my-lending
stellar contract build
starforge deploy --wasm target/wasm32-unknown-unknown/release/my_lending.wasm

Tips

Use verified templates - Look for the ✓ badge ✅ Review code first - Always check template source ✅ Test locally - Try templates in a safe environment ✅ Add good tags - Make your templates discoverable ✅ Document well - Include a comprehensive README

Troubleshooting

Template not found?

starforge template list  # Check available templates

Invalid structure?

# Ensure your template has:
# - Cargo.toml
# - src/lib.rs
# - src/ directory

Git clone failed?

# Check if git is installed
git --version

# Verify template source URL
starforge template show <template-name>

Built-in Templates

These templates are available without initializing the marketplace:

Template Command Description
hello-world starforge new contract my-contract Basic contract with optional storage
token starforge new contract my-token --template token Fungible token with mint/burn/transfer
nft starforge new contract my-nft --template nft Non-fungible token with URI metadata
voting starforge new contract my-vote --template voting DAO proposal and voting contract
stablecoin starforge new contract my-stable --template stablecoin Pegged stablecoin with mint/burn
escrow starforge new contract my-escrow --template escrow Three-party escrow with arbiter release/refund

Next Steps

Support