Skip to content

Latest commit

 

History

History
161 lines (125 loc) · 3.26 KB

File metadata and controls

161 lines (125 loc) · 3.26 KB

Quick Start Guide

This guide will help you get the Aframp backend server up and running quickly.

Prerequisites

  1. Install Rust (if not already installed):

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    source ~/.cargo/env
  2. Install PostgreSQL:

    # Ubuntu/Debian
    sudo apt update
    sudo apt install postgresql postgresql-contrib
    
    # macOS
    brew install postgresql
    
    # Start PostgreSQL service
    sudo systemctl start postgresql  # Linux
    brew services start postgresql   # macOS
  3. Install Redis:

    # Ubuntu/Debian
    sudo apt install redis-server
    
    # macOS
    brew install redis
    
    # Start Redis service
    sudo systemctl start redis      # Linux
    brew services start redis       # macOS

Quick Setup

  1. Clone the repository:

    git clone https://github.com/yourusername/aframp-backend.git
    cd aframp-backend
  2. Create database:

    sudo -u postgres createdb aframp
    sudo -u postgres createuser -s $USER
  3. Configure environment:

    cp .env.example .env

    Edit .env to match your setup:

    # For local development, these should work:
    STELLAR_NETWORK=testnet
    STELLAR_REQUEST_TIMEOUT=15
    STELLAR_MAX_RETRIES=3
    STELLAR_HEALTH_CHECK_INTERVAL=30
    REDIS_URL=redis://127.0.0.1:6379
    RUST_LOG=info
  4. Run the server:

    cargo run

Verify Setup

The server should start and show output like:

Starting Aframp backend service
Stellar client initialized successfully
Stellar Horizon is healthy - Response time: 123ms
=== Demo: Testing Stellar functionality ===
Account GCJRI5CIWK5IU67Q6DGA7QW52JDKRO7JEAHQKFNDUJUPEZGURDBX3LDX does not exist (this is expected for test addresses)
Aframp backend service started successfully

Test Endpoints

Once running, you can test:

  1. Health check:

    curl http://localhost:8000/health
  2. Stellar account info (if you have a Stellar account):

    curl "http://localhost:8000/api/stellar/account/GXXX..."

Common Issues

Database Connection Failed

# Check if PostgreSQL is running
sudo systemctl status postgresql

# Create database if missing
sudo -u postgres createdb aframp

Redis Connection Failed

# Check if Redis is running
redis-cli ping

# If not running, start it:
sudo systemctl start redis  # Linux
brew services start redis   # macOS

Rust Compilation Issues

# Update Rust
rustup update

# Clear build cache
cargo clean

Development Workflow

  1. Run with auto-reload:

    cargo install cargo-watch
    cargo watch -x run
  2. Run tests:

    cargo test
  3. Check code quality:

    cargo clippy
    cargo fmt --check

Next Steps

  1. Explore the API endpoints in src/main.rs
  2. Check the database schema in migrations/
  3. Review the Stellar integration in src/chains/stellar/
  4. Look at the cache implementation in src/cache/

Need Help?