Skip to content

Latest commit

 

History

History
209 lines (163 loc) · 3.75 KB

File metadata and controls

209 lines (163 loc) · 3.75 KB

MyFans Quick Start Guide

Prerequisites

  • Node.js 18+ and npm
  • Rust and Cargo
  • Stellar CLI (cargo install soroban-cli)
  • PostgreSQL
  • Freighter Wallet browser extension

Installation

Option 1: Automated Setup (Recommended)

Windows:

setup.bat

Linux/Mac:

chmod +x setup.sh
./setup.sh

Option 2: Manual Setup

1. Install Dependencies

# Frontend
cd frontend
npm install

# Backend
cd ../backend
npm install

# Contracts
cd ../contract
cargo build --release --target wasm32-unknown-unknown

2. Configure Environment

# Frontend
cd frontend
cp .env.local.example .env.local
# Edit .env.local

# Backend
cd ../backend
cp .env.example .env
# Edit .env

Deploy Contracts

cd contract

# Deploy subscription contract
soroban contract deploy \
  --wasm target/wasm32-unknown-unknown/release/subscription.wasm \
  --network testnet \
  --source <YOUR_SECRET_KEY>

# Save the contract ID and update your .env files

Initialize Contract

soroban contract invoke \
  --id <CONTRACT_ID> \
  --network testnet \
  --source <YOUR_SECRET_KEY> \
  -- init \
  --admin <ADMIN_ADDRESS> \
  --fee_bps 500 \
  --fee_recipient <FEE_ADDRESS> \
  --token <TOKEN_ADDRESS> \
  --price 10000000

Start Services

Terminal 1 - Database:

# Using Docker
docker run -d -p 5432:5432 \
  -e POSTGRES_PASSWORD=postgres \
  -e POSTGRES_DB=myfans \
  postgres

# Or start your local PostgreSQL

Terminal 2 - Backend:

cd backend
npm run start:dev
# Runs on http://localhost:3001

Terminal 3 - Frontend:

cd frontend
npm run dev
# Runs on http://localhost:3000

Test the Application

  1. Install Freighter Wallet

  2. Fund Testnet Account

  3. Connect Wallet

  4. Create a Plan (as Creator)

    • Go to Dashboard → Plans
    • Create a subscription plan
    • Set price and interval
  5. Subscribe (as Fan)

    • Browse creators
    • Select a plan
    • Complete checkout
    • Sign transaction in Freighter

Verify Subscription

Check subscription status:

soroban contract invoke \
  --id <CONTRACT_ID> \
  --network testnet \
  -- is_subscriber \
  --fan <FAN_ADDRESS> \
  --creator <CREATOR_ADDRESS>

Troubleshooting

Contract deployment fails

  • Ensure you have testnet XLM
  • Check your secret key is correct
  • Verify soroban-cli is installed

Backend won't start

  • Check PostgreSQL is running
  • Verify .env file exists and is configured
  • Check port 3001 is available

Frontend won't connect

  • Verify Freighter is installed
  • Check .env.local has correct contract ID
  • Ensure backend is running

Transaction fails

  • Check wallet has sufficient balance
  • Verify contract is initialized
  • Check network (testnet vs mainnet)

Development Workflow

  1. Make contract changes:

    cd contract
    cargo test
    cargo build --release --target wasm32-unknown-unknown
    # Redeploy if needed
  2. Make backend changes:

    cd backend
    npm run test
    # Server auto-reloads in dev mode
  3. Make frontend changes:

    cd frontend
    # Next.js auto-reloads

Production Deployment

See DEPLOYMENT.md for production deployment guide.

API Documentation

Once backend is running, visit:

Support

  • Email: [email protected]
  • Issues: GitHub Issues
  • Docs: See INTEGRATION.md for detailed integration guide