Getting Started
Configuration
TradeClaw is configured entirely through environment variables. Copy .env.example to .env.local and fill in the values relevant to your deployment.
Full .env.example
apps/web/.env.example
# ---------------------------------------------------------------------------
# App
# ---------------------------------------------------------------------------
NEXT_PUBLIC_BASE_URL=https://tradeclaw.win
# ---------------------------------------------------------------------------
# Stripe (optional — needed for billing/subscriptions)
# ---------------------------------------------------------------------------
STRIPE_SECRET_KEY=sk_live_...
STRIPE_PUBLISHABLE_KEY=pk_live_...
STRIPE_WEBHOOK_SECRET=whsec_...
STRIPE_PRO_MONTHLY_PRICE_ID=price_...
STRIPE_PRO_ANNUAL_PRICE_ID=price_...
STRIPE_ELITE_MONTHLY_PRICE_ID=price_...
STRIPE_ELITE_ANNUAL_PRICE_ID=price_...
NEXT_PUBLIC_STRIPE_PRO_MONTHLY_PRICE_ID=price_...
NEXT_PUBLIC_STRIPE_ELITE_MONTHLY_PRICE_ID=price_...
# ---------------------------------------------------------------------------
# Telegram (optional — needed for bot alerts)
# ---------------------------------------------------------------------------
TELEGRAM_BOT_TOKEN=...
NEXT_PUBLIC_TELEGRAM_BOT_USERNAME=tradeclawbot
TELEGRAM_FREE_CHANNEL_ID=-100...
TELEGRAM_PRO_GROUP_ID=-100...
TELEGRAM_ELITE_GROUP_ID=-100...
# ---------------------------------------------------------------------------
# Database
# ---------------------------------------------------------------------------
DATABASE_URL=postgresql://user:password@host:5432/tradeclaw
# ---------------------------------------------------------------------------
# Redis (optional — for Elite tier rate limiting)
# ---------------------------------------------------------------------------
UPSTASH_REDIS_REST_URL=https://...
UPSTASH_REDIS_REST_TOKEN=...App
| Variable | Description | Example |
|---|---|---|
NEXT_PUBLIC_BASE_URLrequired | Your public app URL. Used for SSE endpoints, OG images, and webhook callbacks. | https://tradeclaw.win |
APP_PORT | Docker host port binding. Defaults to 3000. | 3000 |
Database
| Variable | Description | Example |
|---|---|---|
DATABASE_URLrequired | PostgreSQL connection string. Docker Compose injects this automatically. | postgresql://user:pass@host:5432/db |
DB_NAME | Database name (Docker Compose only). Defaults to tradeclaw. | tradeclaw |
DB_USER | Database username (Docker Compose only). | tradeclaw |
DB_PASSWORD | Database password. Change from default in production. | changeme |
Redis
Redis is optional. It is used for API rate limiting on the Elite tier. If not configured, rate limiting falls back to in-memory (not suitable for multi-instance deployments).
| Variable | Description |
|---|---|
UPSTASH_REDIS_REST_URL | Upstash Redis REST endpoint. Use local Redis URL for self-hosted. |
UPSTASH_REDIS_REST_TOKEN | Auth token for Upstash. Not needed for local Redis. |
Telegram
Create a bot via @BotFather on Telegram to get your token. See the Telegram guide for step-by-step setup.
| Variable | Description |
|---|---|
TELEGRAM_BOT_TOKEN | Bot API token from @BotFather. Format: 123456789:ABC... |
NEXT_PUBLIC_TELEGRAM_BOT_USERNAME | Your bot's @username (without @). Used for deep-link generation. |
TELEGRAM_FREE_CHANNEL_ID | Channel ID for free-tier signal broadcasts. Use a negative number for channels/groups. |
TELEGRAM_PRO_GROUP_ID | Group ID for Pro subscribers. |
TELEGRAM_ELITE_GROUP_ID | Group ID for Elite subscribers. |
Stripe
Stripe is entirely optional. Remove all Stripe variables to disable the billing UI. The app runs fully without Stripe — all features are available without a subscription in the default open-source configuration.
| Variable | Description |
|---|---|
STRIPE_SECRET_KEY | Server-side API key. Never expose to the browser. |
STRIPE_PUBLISHABLE_KEY | Client-safe publishable key. |
STRIPE_WEBHOOK_SECRET | Webhook signing secret for verifying Stripe events. |
STRIPE_PRO_MONTHLY_PRICE_ID | Price ID for the Pro monthly plan. |
STRIPE_PRO_ANNUAL_PRICE_ID | Price ID for the Pro annual plan. |
STRIPE_ELITE_MONTHLY_PRICE_ID | Price ID for the Elite monthly plan. |
STRIPE_ELITE_ANNUAL_PRICE_ID | Price ID for the Elite annual plan. |
Scanner Service
These variables control the background signal scanner process.
| Variable | Default | Description |
|---|---|---|
SCAN_INTERVAL | 60 | Seconds between full scans across all instruments and timeframes. |
SCAN_INSTRUMENTS | all | Comma-separated list of symbols, or "all" to scan every instrument. |