Skip to content

QuasarAPI/quasarflow-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

QuasarFlow API

Blockchain abstraction API that simplifies Stellar network integration through REST endpoints

Go Version License

About QuasarFlow

Building blockchain applications typically requires understanding cryptographic key management, learning blockchain-specific SDKs, and handling complex network scenarios. QuasarFlow API eliminates this complexity by providing a simple REST interface to the Stellar network.

Instead of learning blockchain protocols, developers can build blockchain-powered applications using familiar REST API calls:

# Create a blockchain wallet
POST /api/v1/wallets

# Check wallet balance  
GET /api/v1/wallets/{id}/balance

# Send payments
POST /api/v1/wallets/{id}/payment

That's it. No blockchain knowledge required.

Key Features

For Developers:

  • 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

For Businesses:

  • Faster time to market - Build blockchain features in days, not months
  • Reduced development cost - No need for specialized blockchain developers
  • Lower maintenance - We handle blockchain complexity and updates
  • Scalable infrastructure - Built to handle enterprise workloads
  • Security compliance - Enterprise-grade security features built-in

Use Cases

Fintech Applications

  • Add crypto wallet functionality to existing banking apps
  • Enable cryptocurrency payments in e-commerce platforms

Gaming & Digital Assets

  • Manage in-game assets on blockchain
  • Create NFT marketplaces and digital collectibles

Enterprise Solutions

  • Add blockchain capabilities to business systems
  • Enable cross-border payments and remittances

Technology Stack

Quick Start

Docker (Recommended)

# Clone and setup
git clone https://github.com/QuasarAPI/quasarflow-api.git
cd quasarflow-api

# Setup environment
cp .env.example .env
nano .env  # customize settings

# Start all services
docker-compose up -d

# View logs
docker-compose logs -f quasarflow-api

Manual Setup

# Prerequisites: Go 1.21+, PostgreSQL 12+
git clone https://github.com/QuasarAPI/quasarflow-api.git
cd quasarflow-api
go mod download

# Setup database
createdb quasarflow
./scripts/db-manage.sh migrate-up

# Configure and run
cp .env.example .env
go run ./cmd/api/main.go

Quick Example

# 1. Login and get token
TOKEN=$(curl -s -X POST http://localhost:8080/auth/login \
  -H "Content-Type: application/json" \
  -d '{"username": "admin", "password": "admin123"}' | jq -r '.data.token')

# 2. Create a wallet
WALLET_ID=$(curl -s -X POST http://localhost:8080/api/v1/wallets \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $TOKEN" \
  -d '{"network": "local"}' | jq -r '.data.id')

# 3. Fund wallet (development only)
curl -X POST http://localhost:8080/api/v1/wallets/$WALLET_ID/fund \
  -H "Authorization: Bearer $TOKEN"

# 4. Check balance
curl http://localhost:8080/api/v1/wallets/$WALLET_ID/balance \
  -H "Authorization: Bearer $TOKEN"

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.

Quick Example - Verify Existing Wallet

# 1. Generate challenge for wallet
CHALLENGE=$(curl -s http://localhost:8080/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 http://localhost:8080/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 http://localhost:8080/api/v1/accounts/GABC123.../verify-transaction \
  -H "Content-Type: application/json" \
  -d '{"transaction_hash": "transaction_hash_here"}'

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

For complete implementation examples in JavaScript, Go, and Python, see Wallet Ownership Verification Guide.

Demo Credentials: admin/admin123 or user/user123

Configuration

Environment Setup

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

Key Variables

Variable Description Example
ENV Environment development, production
STELLAR_NETWORK Stellar network local, testnet, mainnet
ENCRYPTION_KEY AES key (32 bytes) openssl rand -base64 32
JWT_SECRET JWT secret (32+ chars) SecureProductionSecret123!
ALLOWED_ORIGINS CORS origins https://yourdomain.com

Network Modes

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

API Overview

The API provides REST endpoints for blockchain operations with JWT authentication:

  • Authentication: /auth/login, /auth/logout
  • Wallet Management: /api/v1/wallets
  • Transactions: Payments, balance queries, history
  • Health Check: /health

πŸ“š Complete API documentation: See docs/API.md for detailed endpoint specifications

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)    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

This architecture ensures:

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

Security

Enterprise Security Features

  • JWT Authentication with configurable expiration
  • Rate Limiting to prevent abuse
  • CORS Protection with configurable origins
  • Security Headers (XSS, clickjacking, MIME protection)
  • AES-256-GCM Encryption for private key storage
  • Input Validation and sanitization

Authentication Flow

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

Docker Development

Available Services

  • API: http://localhost:8080
  • PostgreSQL: localhost:5432
  • Stellar Horizon: http://localhost:8000 (local network)
  • Friendbot: http://localhost:8000/friendbot (funding)

Management Commands

# Database migrations
docker-compose run --rm migrate

# API testing
./scripts/test-api.sh

# Service management
docker-compose ps
docker-compose restart quasarflow-api
docker-compose logs -f quasarflow-api

Project Structure

quasarflow-api/
β”œβ”€β”€ cmd/api/                    # Application entry point
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ config/                 # Configuration management
β”‚   β”œβ”€β”€ domain/                 # Business entities & interfaces
β”‚   β”œβ”€β”€ infrastructure/         # Database, Stellar, Crypto
β”‚   β”œβ”€β”€ interface/http/         # REST API, Handlers, Middleware
β”‚   └── usecase/               # Business logic
β”œβ”€β”€ migrations/                 # Database schema
β”œβ”€β”€ pkg/                       # Shared utilities
└── docs/                      # API documentation

Roadmap

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

Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes and add tests
  4. Commit your changes: git commit -m 'Add amazing feature'
  5. Push to the branch: git push origin feature/amazing-feature
  6. Open a Pull Request

Documentation

License

This project is licensed under the MIT License - see the LICENSE file for details.


Quasar Flow - Making blockchain development simple and accessible for everyone.

About

The official Go backend for Quasarflow, a self-hosted API gateway for the Stellar network.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published