This guide provides step-by-step instructions for deploying StellarStream to various platforms and using Docker.
- Stellar Smart Contract Deployment
- Backend Deployment (Railway)
- Frontend Deployment (Vercel)
- Docker Deployment
- Troubleshooting
Before deploying the backend, you must deploy the Soroban smart contract to the Stellar Testnet.
- Soroban CLI installed.
- A Stellar account with testnet XLM.
- Generate a new keypair if you don't have one:
soroban config identity generate deployer
- Fund it via Friendbot:
curl "https://friendbot.stellar.org/?addr=$(soroban config identity address deployer)"
- Navigate to the root directory.
- Run the deployment script (replace with your secret key):
SECRET_KEY="YOUR_SECRET_KEY" ./scripts/deploy.sh - Note the Contract ID output (also saved in
contracts/contract_id.txt). You will need this for the backend configuration.
The backend is a Node.js Express app that connects to a SQLite database.
- Create a new project on Railway.
- Connect your GitHub repository.
- Set the Root Directory to
backend. - Add a Persistent Volume (Disk) and mount it to
/app/datato persist the SQLite database. - Configure the following Environment Variables:
PORT:3001CONTRACT_ID: (From step 1)SERVER_PRIVATE_KEY: (Your Stellar secret key)JWT_SECRET: (Generate usingopenssl rand -hex 32)DB_PATH:/app/data/streams.dbALLOWED_ASSETS:USDC,XLMRPC_URL:https://soroban-testnet.stellar.org:443NETWORK_PASSPHRASE:Test SDF Network ; September 2015
- Health Check: Set the health check path to
/api/health.
The frontend is a React app built with Vite.
- Create a new project on Vercel.
- Connect your GitHub repository.
- Set the Root Directory to
frontend. - Configure the Build Settings:
- Framework Preset:
Vite - Build Command:
npm run build - Output Directory:
dist
- Framework Preset:
- Add the following Environment Variable:
VITE_API_URL: (The URL of your deployed Railway backend, e.g.,https://your-backend.up.railway.app/api)
For a quick production-like setup using Docker Compose.
- Copy
backend/.env.exampletobackend/.envand fill in the required values. - Run the following command from the root directory:
docker-compose up -d --build
Create a docker-compose.prod.yml if you need specific production overrides (e.g., removing dev-only tools):
version: "3.9"
services:
backend:
build:
context: ./backend
dockerfile: dockerfile
command: ["npm", "start"] # Assuming 'start' runs compiled JS
frontend:
build:
context: ./frontend
dockerfile: dockerfile
command: ["npm", "run", "preview", "--", "--host"]Ensure the CONTRACT_ID environment variable is correctly set in your deployment platform. The indexer will not start without it.
Check the webhook_dead_letters table in the database. Ensure WEBHOOK_DESTINATION_URL is accessible from the backend server. Refer to the Runbook for re-queueing instructions.
Ensure the backend ALLOWED_ORIGINS (if implemented) or CORS configuration allows requests from your frontend domain.
This can happen if multiple processes try to write to the SQLite file. In production, ensure only one instance of the backend is running at a time or use WAL mode (already enabled in db.ts).