Menu

Deployment Options Overview

ApiCharge can be deployed in several different ways, depending on your needs, scale, and infrastructure requirements. This page provides an overview of the available deployment options and helps you choose the right approach for your use case.

Note: All deployment options include the same core functionality. The main differences are in setup complexity, scalability, and operational requirements.

Deployment Overview

ApiCharge offers three primary deployment models:

Docker Container Deployment

Recommended for: Most deployments, from development to production

Deploy ApiCharge as a Docker container with all dependencies included. This is the simplest and most consistent deployment method.

Learn more about Docker deployment →

Standalone Deployment

Recommended for: Custom environments, specific OS integration

Deploy ApiCharge as a standalone application on a server or virtual machine. This gives you more control over the environment but requires more setup.

Learn more about standalone deployment →

Clustered Deployment

Recommended for: High availability, scaling, production workloads

Deploy multiple ApiCharge instances with shared state for high availability and horizontal scaling. This is the most complex but also the most robust deployment model.

Learn more about clustered deployment →

System Requirements

ApiCharge has the following general system requirements:

Component Minimum Requirements Recommended
CPU 2 cores 4+ cores
Memory 2 GB RAM 4+ GB RAM
Disk 5 GB 20+ GB SSD
Network 10 Mbps 100+ Mbps
Operating System Linux, Windows, or macOS with Docker support Linux (Ubuntu 20.04+, Debian 11+)
Note: The embedded Stellar RPC server component can be resource-intensive. Requirements may be higher for production deployments with high transaction volumes.

Stellar Blockchain Integration Architecture

A key component of ApiCharge is its integration with the Stellar blockchain for secure, low-cost micropayments. This section explains the architecture of this integration.

Blockchain Architecture Overview

ApiCharge uses the Stellar blockchain as its payment rail, leveraging Soroban smart contracts for secure susbcription management. The architecture consists of several components:

+----------------+         +------------------+         +----------------+
|                |         |                  |         |                |
|    Client      |<------->|    ApiCharge     |<------->|  Your Backend  |
|  Application   |         |    Service       |         |   Services     |
|                |         |                  |         |                |
+----------------+         +--+------------+--+         +----------------+
                             |            |
                             |            |
                    +--------v--+      +--v------------+
                    |           |      |               |
                    |  Soroban  |<---->|   Stellar     |
                    |  RPC      |      |   Network     |
                    |  Server   |      |               |
                    +-----------+      +---------------+

Key Components

  1. ApiCharge Service - Core application that handles API proxying, rate limiting, and payment verification
  2. Soroban RPC Server - Interface between ApiCharge and the Stellar blockchain, handling transaction submission and verification
  3. Stellar Network - The blockchain network that processes the micropayments
  4. ApiCharge Smart Contract - Soroban smart contract deployed on the Stellar network that handles payment validation

How ApiCharge Communicates with Stellar

The communication flow between ApiCharge and the Stellar blockchain involves these steps:

  1. Quote Generation - ApiCharge generates and cryptographically signs quotes for ApiCharge Subscriptions
  2. Payment Verification - When a client makes a payment, ApiCharge verifies it by:
    • Querying the Soroban RPC server for transaction details
    • Verifying the transaction has been included in the Stellar ledger
    • Confirming payment amount and destination
  3. Access Token Issuance - After payment verification, ApiCharge generates a cryptographically signed access token
  4. Ongoing Validation - For each request using the token, ApiCharge validates its signature and checks rate limiter state
+--------+                  +------------+                +-----------+              +-------------+
| Client |                  | ApiCharge  |                | Soroban   |              | Stellar    |
|        |                  |            |                | RPC Server|              | Network    |
+---+----+                  +-----+------+                +-----+-----+              +------+-----+
    |                             |                             |                           |
    | 1. Request Quote            |                             |                           |
    +--------------------------->+                             |                           |
    |                             |                             |                           |
    | 2. Return Signed Quote      |                             |                           |
    |<---------------------------+                             |                           |
    |                             |                             |                           |
    | 3. Make Payment             |                             |                           |
    +--------------------------------------------------------->+------------------------->+
    |                             |                             |                           |
    | 4. Request Access Token     |                             |                           |
    +--------------------------->+                             |                           |
    |                             |                             |                           |
    |                             | 5. Verify Payment           |                           |
    |                             +--------------------------->+                           |
    |                             |                             |                           |
    |                             | 6. Payment Confirmed        |                           |
    |                             |<---------------------------+                           |
    |                             |                             |                           |
    | 7. Return Access Token      |                             |                           |
    |<---------------------------+                             |                           |
    |                             |                             |                           |
    | 8. API Requests with Token  |                             |                           |
    +--------------------------->+                             |                           |
    |                             |                             |                           |
    | 9. API Responses            |                             |                           |
    |<---------------------------+                             |                           |

Smart Contract Integration

ApiCharge integrates with a Stellar Soroban smart contract that handles:

Different contract instances are deployed on the Stellar Testnet and Mainnet. The appropriate contract is used automatically based on the UseNetwork configuration setting.

Network Options

ApiCharge can connect to different Stellar networks:

Network Description Use Case
Testnet Stellar's test network with test tokens Development, testing, integration
Mainnet Stellar's production network with real assets Production deployments
Important: Mainnet deployments involve real financial transactions. Ensure proper testing on Testnet before migrating to Mainnet.

Deployment Considerations

When deploying ApiCharge with Stellar integration, consider these factors:

1. Wallet Management

ApiCharge requires a Stellar account (wallet) to sign quotes and verify payments. The private key must be securely stored and provided via environment variables.

2. RPC Server Resources

The Soroban RPC server requires sufficient resources to maintain blockchain state and process transactions:

3. Network Connectivity

ApiCharge needs reliable network connectivity to the Stellar network. In production environments, consider:

4. Security Considerations

Protect your Stellar integration with these security measures:

Deployment Scenarios

Here are some common deployment scenarios and recommended approaches:

Development Environment

Testing/Staging Environment

Small Production Environment

Large Production Environment

Next Steps

Based on your deployment needs, explore these detailed guides: