Adds an optional cloud/paid mode behind a BILLING_ENABLED flag. With the flag off the app is byte-identical to today's self-hosted BYOK build (regression-zero). Backend (cloud/ package, only imported when BILLING_ENABLED): - Auth: magic link (Resend) + Google OAuth (authlib) + JWT sessions - Stripe: hosted Checkout with 3-day card trial, Customer Portal, idempotent order-safe webhooks; 3 plans (Starter/Creator/Pro) resolved by lookup_key - Postgres + SQLAlchemy async; atomic minute metering (reserve/commit/release, plan->topup FIFO, restart-safe) with sweeper - Managed keys: Gemini + Upload-Post server-side for entitled users; paid-only (BYOK core header ignored on hosted); Upload-Post white-label per-user profiles - Metering wired into /api/process (probe->reserve->402, priority queue) and thumbnail image generation (3 min/batch) - yt-dlp residential PROXY_URL support + 720p cap for hosted YouTube downloads Frontend: - AuthContext, LoginModal, PricingSection (3-day trial), AccountPage, UsageMeter, TopUpModal, TrialGate/AdvancedBanner - Paid-only UI: hide BYOK core inputs, trial prompts per tool - Included (Clip Generator, YouTube Studio) vs BYOK (AI Shorts/dubbing: fal.ai + ElevenLabs) clearly separated; ThumbnailStudio + SaaShortsTab managed-aware - Landing: free-self-host vs paid-hosted messaging Verified end-to-end against real Postgres + Stripe test mode.
38 lines
1.4 KiB
Text
38 lines
1.4 KiB
Text
# Cloud (paid / managed-keys) mode — env template for openshorts.app.
|
|
# Copy to .env and fill in. Only needed when running with docker-compose.cloud.yml.
|
|
# Self-hosters running plain BYOK do NOT need any of this.
|
|
|
|
BILLING_ENABLED=true
|
|
|
|
# Postgres (docker-compose.cloud.yml provisions the `db` service)
|
|
POSTGRES_PASSWORD=change-me
|
|
DATABASE_URL=postgresql+asyncpg://openshorts:change-me@db:5432/openshorts
|
|
|
|
# Auth
|
|
JWT_SECRET=generate-a-long-random-string
|
|
FRONTEND_URL=https://openshorts.app
|
|
ALLOWED_ORIGINS=https://openshorts.app
|
|
|
|
# Email — magic link (Resend)
|
|
RESEND_API_KEY=re_...
|
|
EMAIL_FROM=OpenShorts <login@openshorts.app>
|
|
|
|
# Google OAuth (optional; magic link works without it)
|
|
GOOGLE_CLIENT_ID=
|
|
GOOGLE_CLIENT_SECRET=
|
|
|
|
# Stripe (test keys shown; use live keys in production).
|
|
# Prices are resolved by lookup_key (starter_monthly, topup_60, ...) at runtime,
|
|
# so no price IDs are needed here. Create the prices with those lookup_keys.
|
|
STRIPE_SECRET_KEY=sk_test_...
|
|
STRIPE_WEBHOOK_SECRET=whsec_...
|
|
|
|
# Managed provider keys (server-owned; only handed to entitled paid users)
|
|
MANAGED_GEMINI_API_KEY=
|
|
MANAGED_UPLOAD_POST_API_KEY=
|
|
OPENSHORTS_LOGO_URL=https://openshorts.app/logo.png
|
|
|
|
# Residential proxy for YouTube downloads (avoids datacenter-IP bans on the
|
|
# hosted server). Recommended: DataImpulse (~$1/GB PAYG). Downloads are capped
|
|
# to 720p when this is set, to control bandwidth cost. Empty = direct download.
|
|
PROXY_URL=
|