Documentation

Getting Started

QuasarFlow API provides a simple REST interface to the Stellar network, eliminating the need to learn complex blockchain protocols. Build blockchain-powered applications using familiar HTTP requests.

What is QuasarFlow?

QuasarFlow is a blockchain abstraction API that simplifies Stellar network integration. Instead of learning cryptographic key management and blockchain-specific SDKs, developers can build blockchain features using simple REST API calls.

Key Benefits

  • Simple REST API - No blockchain SDK learning curve
  • Enterprise Security - JWT authentication, rate limiting, and comprehensive security headers
  • Secure by default - AES-256-GCM encryption for private keys
  • External Wallet Support - Verify ownership of existing Stellar wallets using SEP-10 standards
  • Production ready - Built with enterprise-grade architecture and security
  • Well documented - Clear API specifications and examples

Quick Start

Docker (Recommended)

Docker Setup
1# Clone and setup
2git clone https://github.com/QuasarAPI/quasarflow-api.git
3cd quasarflow-api
4
5# Setup environment
6cp .env.example .env
7nano .env  # customize settings
8
9# Start all services
10docker-compose up -d
11
12# View logs
13docker-compose logs -f quasarflow-api

Manual Setup

Manual Setup
1# Prerequisites: Go 1.21+, PostgreSQL 12+
2git clone https://github.com/QuasarAPI/quasarflow-api.git
3cd quasarflow-api
4go mod download
5
6# Setup database
7createdb quasarflow
8./scripts/db-manage.sh migrate-up
9
10# Configure and run
11cp .env.example .env
12go run ./cmd/api/main.go

Quick Example

Quick Example
1# 1. Login and get token
2TOKEN=$(curl -s -X POST https://quasarflow.dev/api/auth/login \
3  -H "Content-Type: application/json" \
4  -d '{"username": "admin", "password": "admin123"}' | jq -r '.data.token')
5
6# 2. Create a wallet
7WALLET_ID=$(curl -s -X POST https://quasarflow.dev/api/v1/wallets \
8  -H "Content-Type: application/json" \
9  -H "Authorization: Bearer $TOKEN" \
10  -d '{"network": "testnet"}' | jq -r '.data.id')
11
12# 3. Fund wallet (development only)
13curl -X POST https://quasarflow.dev/api/v1/wallets/$WALLET_ID/fund \
14  -H "Authorization: Bearer $TOKEN"
15
16# 4. Check balance
17curl https://quasarflow.dev/api/v1/wallets/$WALLET_ID/balance \
18  -H "Authorization: Bearer $TOKEN"

Demo Credentials

Use admin/admin123 oruser/user123 for testing.

Authentication

QuasarFlow API uses JWT (JSON Web Tokens) for authentication. All protected endpoints require a valid JWT token in the Authorization header.

Authentication Flow

  1. Login with credentials → Receive JWT token
  2. Include token in Authorization: Bearer <token> header
  3. Access protected endpoints with valid token

Login Example

Login Example
1curl -X POST https://quasarflow.dev/api/auth/login \
2  -H "Content-Type: application/json" \
3  -d '{
4    "username": "admin",
5    "password": "admin123"
6  }'
7
8# Response
9{
10  "success": true,
11  "data": {
12    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
13    "expires_at": "2024-01-01T12:00:00Z"
14  }
15}

Wallet Management

QuasarFlow handles all the complexity of blockchain wallet management, including key generation, encryption, and secure storage.

Create Wallet

Create Wallet
1curl -X POST https://quasarflow.dev/api/v1/wallets \
2  -H "Authorization: Bearer YOUR_TOKEN" \
3  -H "Content-Type: application/json" \
4  -d '{
5    "network": "testnet"
6  }'
7
8# Response
9{
10  "success": true,
11  "data": {
12    "id": "wallet_123",
13    "public_key": "GABC123...",
14    "network": "testnet",
15    "created_at": "2024-01-01T12:00:00Z"
16  }
17}

Check Balance

Check Balance
1curl https://quasarflow.dev/api/v1/wallets/wallet_123/balance \
2  -H "Authorization: Bearer YOUR_TOKEN"
3
4# Response
5{
6  "success": true,
7  "data": {
8    "balances": [
9      {
10        "asset": "XLM",
11        "amount": "1000.0000000"
12      }
13    ]
14  }
15}

Send Payment

curl -X POST https://quasarflow.dev/api/v1/wallets/wallet_123/payment \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "GDEF456...",
    "amount": "10.5",
    "asset": "XLM",
    "memo": "Payment for services"
  }'

# Response
{
  "success": true,
  "data": {
    "transaction_hash": "abc123...",
    "status": "pending"
  }
}

External Wallet Support

QuasarFlow API supports users with existing Stellar wallets through ownership verification. Users can prove they own a wallet without registering with the platform.

Supported Verification Methods

  • šŸ” Message Signing (SEP-10) - Cryptographically sign a challenge
  • šŸ“ Transaction Proof - Use recent signed transactions as proof
  • šŸ“Š Account Activity - Verify based on account existence and activity

Verify Existing Wallet

# 1. Generate challenge for wallet
CHALLENGE=$(curl -s https://quasarflow.dev/api/v1/accounts/GABC123.../challenge | jq -r '.challenge')

# 2. Sign challenge with private key (client-side)
# This requires a Stellar SDK implementation in your application
SIGNATURE="base64_encoded_signature"

# 3. Verify ownership
curl -X POST https://quasarflow.dev/api/v1/accounts/GABC123.../verify-ownership \
  -H "Content-Type: application/json" \
  -d '{
    "signature": "'$SIGNATURE'",
    "message": "'$CHALLENGE'"
  }'

# 4. Alternative: Verify via recent transaction
curl -X POST https://quasarflow.dev/api/v1/accounts/GABC123.../verify-transaction \
  -H "Content-Type: application/json" \
  -d '{
    "transaction_hash": "transaction_hash_here"
  }'

Configuration

Environment Setup

# Copy and customize environment file
cp .env.example .env
nano .env  # Edit with your settings

Key Variables

VariableDescriptionExample
ENVEnvironmentdevelopment, production
STELLAR_NETWORKStellar networklocal, testnet, mainnet
ENCRYPTION_KEYAES key (32 bytes)openssl rand -base64 32
JWT_SECRETJWT secret (32+ chars)SecureProductionSecret123!

Network Modes

  • Local: Docker Stellar network + Friendbot for testing
  • Testnet: Stellar testnet for staging
  • Mainnet: Production Stellar network

Architecture

QuasarFlow API follows Clean Architecture principles for maintainability and testability.

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│             HTTP Layer                  │
│    (REST API, Middleware, Routing)     │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
                  │
ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā–¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│           Use Case Layer                │
│      (Business Logic & Rules)          │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
                  │
ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā–¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│           Domain Layer                  │
│     (Entities & Interfaces)            │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
                  │
ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā–¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│        Infrastructure Layer             │
│  (Database, Stellar Client, Crypto)    │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

Architecture Benefits

  • Testability - Easy to unit test business logic
  • Flexibility - Simple to swap implementations
  • Maintainability - Clear separation of concerns

Project Structure

quasarflow-api/
ā”œā”€ā”€ .cursor/rules/              # Cursor IDE rules
ā”œā”€ā”€ cmd/api/                    # Application entry point
ā”œā”€ā”€ docs/                       # API documentation
ā”œā”€ā”€ internal/                   # Private application code
│   ā”œā”€ā”€ config/                 # Configuration management
│   ā”œā”€ā”€ domain/                 # Business entities & interfaces
│   ā”œā”€ā”€ infrastructure/         # Database, Stellar, Crypto
│   ā”œā”€ā”€ interface/http/         # REST API, Handlers, Middleware
│   └── usecase/               # Business logic
ā”œā”€ā”€ migrations/                 # Database schema migrations
ā”œā”€ā”€ pkg/                       # Shared utilities
ā”œā”€ā”€ scripts/                   # Build and deployment scripts
ā”œā”€ā”€ .dockerignore              # Docker ignore file
ā”œā”€ā”€ .env.example               # Environment variables template
ā”œā”€ā”€ .gitignore                 # Git ignore file
ā”œā”€ā”€ Dockerfile                 # Docker container definition
ā”œā”€ā”€ LICENSE                    # MIT License
ā”œā”€ā”€ README.md                  # Project documentation
ā”œā”€ā”€ api                        # API specification
ā”œā”€ā”€ docker-compose.yml         # Docker services configuration
ā”œā”€ā”€ go.mod                     # Go module definition
└── go.sum                     # Go module checksums

Technology Stack

  • Go 1.21+ - High-performance backend language (72.2% of codebase)
  • PostgreSQL - Reliable data persistence
  • Stellar Network - Fast, low-cost blockchain
  • Docker - Containerization and deployment
  • Shell Scripts - Build and deployment automation (26.9% of codebase)
  • Clean Architecture - Maintainable, testable codebase

Repository Statistics

0
Stars
2
Forks
10
Commits

Current Features

  • āœ… Wallet creation and management
  • āœ… Secure private key storage (AES-256-GCM)
  • āœ… Payment transactions (XLM and custom assets)
  • āœ… Multi-network support (local, testnet, mainnet)
  • āœ… JWT Authentication & Enterprise Security
  • āœ… Docker development environment

Roadmap

  • Multi-signature wallet support
  • Webhook notification system
  • Database user management
  • Advanced role-based permissions
  • Support for additional blockchains
  • Advanced transaction types (escrow, atomic swaps)
  • Analytics and reporting dashboard
  • SDKs for popular languages