Interactive setup wizard for OFFER-HUB Orchestrator — prompts, environment configuration, database migrations, and platform user bootstrapping.
The create-offer-hub-orchestrator package is the official interactive setup wizard for the OFFER-HUB Orchestrator. It automates environment configuration, cryptographic key generation, database migrations, and platform user bootstrapping into a guided terminal workflow.
Tip
For developers setting up a new Orchestrator instance, the scaffolder replaces manual .env file editing and multi-step terminal setup. Running npx create-offer-hub-orchestrator gets you a configured, fully bootstrapped instance in about two minutes.
Prerequisites
Before running the scaffolder, ensure your development or host environment has the following installed:
Requirement
Minimum Version
Purpose
Node.js
20.x or higher
Runtime for orchestrator and installer (packages/create-offerhub/package.json)
npm
10.x or higher
Package execution
PostgreSQL
14+
Primary database (Supabase, Railway, Docker, or self-hosted)
Redis
6+
Caching, idempotency store, and BullMQ queues (Upstash or Redis local)
In crypto mode, the Orchestrator manages invisible Stellar wallets for buyers, sellers, and the platform. Private keys are encrypted at rest using AES-256-GCM. The WALLET_ENCRYPTION_KEY is a 32-byte (64 hex character) key used for this cipher.
Warning
Back up WALLET_ENCRYPTION_KEY immediately. If this key is lost, all stored user and platform wallet private keys become permanently unrecoverable on-chain. Store it securely in a secrets manager (AWS Secrets Manager, Railway Variables, or 1Password).
Generated Environment Configuration (.env)
The wizard formats and writes the root .env file using packages/create-offerhub/src/env-generator.ts. The resulting file is organized into modular sections:
This applies all pending migrations from packages/database/prisma/migrations/ to your PostgreSQL database without requiring manual interactive confirmation.
Step 3 — Platform User & Stellar Wallet Bootstrap
The Orchestrator requires a dedicated internal platform user (scripts/bootstrap.ts). This platform user holds the Stellar keypair that acts as platformAddress and disputeResolver in Soroban escrow smart contracts.
The scaffolder runs:
$
npm run bootstrap
The bootstrap script performs the following actions:
Idempotency Check: Queries User where externalUserId = "offerhub-platform". If the platform user already exists, it skips creation and outputs the existing PLATFORM_USER_ID.
User & Balance Record Creation: In a single database transaction, creates the platform User entity (status: "ACTIVE", type: "BOTH") and initializes an associated Balance record (available: "0.00", reserved: "0.00", currency: "USD").
Stellar Keypair & Wallet Encryption: Generates a cryptographically random Stellar keypair (Keypair.random()), encrypts the secret key using AES-256-GCM with WALLET_ENCRYPTION_KEY, and persists the wallet record in PostgreSQL.
Testnet Account Funding: On testnet, automatically requests test XLM from Stellar Friendbot (https://friendbot.stellar.org?addr=<publicKey>).
USDC Trustline Setup: Submits a changeTrust transaction to Stellar Horizon establishing a trustline for the configured USDC asset and issuer.
Environment Update: Emits PLATFORM_USER_ID=usr_<id>. The scaffolder captures this value and updates the PLATFORM_USER_ID= line in .env.
Note
If you run the scaffolder with runMigrations: false, you can run the bootstrap step manually at any time after deploying your migrations:
bash
npm run bootstrap
Then paste the emitted PLATFORM_USER_ID=usr_... into your .env file.
Step 4 — Initial Admin API Key Generation
If generateApiKey is selected and the local API is accessible, the wizard issues a request to create an initial administrative API key:
If the API server is not yet running, the scaffolder prints the exact curl command with your master key so you can mint your initial key as soon as the server boots.
Starting the Orchestrator
After the scaffolder finishes, launch the API:
bash
# Development mode with hot-reload
npm run dev
# Or build and run for production
npm run build
node apps/api/dist/main.js
Verify that the API and background workers are healthy: