HyperMyths is a Next.js application for generating cinematic video experiences from a small amount of user input. The public product surface includes several story modes such as creator cuts, X-profile autobiographies, token-led trading stories, family keepsakes, music-led videos, and scene recreation.
The repo is split into a web app, a background worker, and a dedicated video render service. Payments can be handled through manual Solana deposits, MoonPay checkout, discount codes, and x402 / USDC flows for agent-style requests.
HyperMyths is built around a few user-facing experiences:
HyperMfor creator-style concept cutsMythXfor autobiographies derived from X profilesHashMythfor token and wallet story videosLoveXfor family moments and keepsakesTrenchMyths,FunMyths,Music, andRecreatorfor additional story modes
Each experience maps to a route in the App Router and is configured through shared cinema configuration in lib/cinema/config.ts.
- Next.js App Router UI
- Global shell and navigation in
components/SiteHeader.tsx - Homepage in
app/page.tsx - Experience-specific generator clients:
components/cinema/CinemaGeneratorClient.tsxcomponents/hyperm/HyperMGeneratorClient.tsx
- Shared chat and checkout surfaces:
components/chat/CinemaConciergeChat.tsxcomponents/PaymentInstructionsCard.tsx
- Job creation, retry, discount, and status routes in
app/api/jobs - X-profile tweet ingestion in
app/api/hyperm/tweets - Manual Solana and MoonPay payment handling
- x402 / USDC endpoint in
app/api/x402/video - Helius webhook ingestion in
app/api/helius-webhook - Inference endpoints in
app/api/inference/textandapp/api/inference/video - Media output routes in
app/api/report/[jobId]andapp/api/video/[jobId]
workers/server.tsdispatches due jobsworkers/process-job.tsadvances jobs through analysis, prompt generation, and renderworkers/sweep-payments.tssweeps collected Solana paymentsworkers/commands.tsexposes operational commands for the worker runtime
- Firestore stores jobs, reports, and runtime state
- Firebase Storage stores generated assets
- Helius is used for Solana chain activity and webhook subscription management
- OpenRouter / OpenAI / Anthropic / Replicate / Hugging Face / Ollama can be used as inference backends depending on config
/homepage and primary product entry/HyperCinema/HyperM/MythX/HashMyth/LoveX/TrenchCinema/FunCinema/MusicVideo/Recreator/gallery/gallery/private/trending/job/[jobId]/login
POST /api/jobsGET /api/jobs/[jobId]POST /api/jobs/[jobId]/retryPOST /api/jobs/[jobId]/discountPOST /api/jobs/[jobId]/moonpay/startGET /api/report/[jobId]GET /api/video/[jobId]POST /api/x402/videoPOST /api/hyperm/tweetsPOST /api/inference/textPOST /api/inference/videoGET /api/servicePOST /api/helius-webhookPOST /api/moonpay-webhook
/admin/moderation/admin/inference/admin/discount-codes/amber-vaults
POST /api/jobscreates a job and assigns a dedicated payment address.app/api/jobs/[jobId]exposes payment instructions.app/api/helius-webhookreceives on-chain activity.lib/payments/onchain-verify.tsandlib/payments/settlement.tsverify and apply settlement.- Once payment is confirmed, the job transitions into processing and the worker dispatches render work.
- The finished report and video are available from
GET /api/report/[jobId]andGET /api/video/[jobId].
POST /api/jobs/[jobId]/moonpay/startprepares a hosted checkout flow.- MoonPay webhook events are handled in
app/api/moonpay-webhook/route.ts. - Confirmed payment advances the same job pipeline as manual Solana payments.
POST /api/x402/videovalidates the x402 payment signature and settles the request.- A successful payment creates the job immediately and dispatches rendering.
- Text inference is handled by
app/api/inference/text - Video inference is handled by
app/api/inference/video - Backend provider selection comes from
lib/env.tsand the inference runtime config - The video pipeline is implemented under
lib/video
Environment variables are validated in lib/env.ts.
HELIUS_API_KEY=
SOLANA_RPC_URL=
VIDEO_API_KEY=
FIREBASE_PROJECT_ID=
PAYMENT_MASTER_SEED_HEX=APP_BASE_URL=http://localhost:3000
SOLANA_RPC_FALLBACK_URL=https://api.mainnet-beta.solana.com
FIREBASE_STORAGE_BUCKET=
WORKER_URL=
WORKER_TOKEN=
ALLOW_IN_PROCESS_WORKER=true
JOB_DISPATCH_BATCH_LIMIT=25
JOB_PROCESSING_STALE_MS=120000
PAYMENT_DERIVATION_PREFIX=hashcinema-job
HELIUS_WEBHOOK_ID=
HELIUS_WEBHOOK_SECRET=
SWEEP_MIN_LAMPORTS=5000
SWEEP_BATCH_LIMIT=50
OPENROUTER_API_KEY=
OPENROUTER_BASE_URL=https://openrouter.ai/api/v1
OPENROUTER_APP_NAME=HYPERCINEMA
OPENROUTER_SITE_URL=
VIDEO_API_BASE_URL=
VIDEO_ENGINE=google_veo
VIDEO_VEO_MODEL=veo-3.1-fast-generate-001
VIDEO_RESOLUTION=1080p
VIDEO_RENDER_POLL_INTERVAL_MS=5000
VIDEO_RENDER_MAX_POLL_ATTEMPTS=2160
X402_FACILITATOR_URL=https://x402.dexter.cash
GOONBOOK_API_BASE_URL=
GOONBOOK_AGENT_API_KEY=
GOONBOOK_AGENT_HANDLE=hasmedia
GOONBOOK_AGENT_DISPLAY_NAME=HASMEDIA
GOONBOOK_AGENT_BIO=HyperMyths drops AI video trailers and posts them to GoonBook.
GOONBOOK_SYNC_BATCH_LIMIT=12
ANALYTICS_ENGINE_MODE=v2_fallback_legacy
MOONPAY_API_KEY=
MOONPAY_WEBHOOK_SHARED_TOKEN=
NEXT_PUBLIC_MOONPAY_PAYLINK_ID=
NEXT_PUBLIC_MOONPAY_NETWORK=
CROSSMINT_SERVER_API_KEY=
NEXT_PUBLIC_CROSSMINT_API_KEY=
CROSSMINT_COOKIE_DOMAIN=
CROSSMINT_ADMIN_ALLOWLIST=See apphosting.yaml for the deployment environment variable wiring used in hosted environments.
Install dependencies and run the app:
npm install
npm run devRun the video service in another terminal:
npm run video:devUseful checks:
npm run lint
npm run build
npm testThe repo uses Vitest for unit and integration-style tests.
npm testruns the main suitenpm run test:ciruns the suite with the default reporternpm run test:liveruns the external smoke test only
Coverage in the current repository includes:
- payment settlement and webhook logic
- Solana / Helius transaction processing
- inference config and render pipeline behavior
- job state machine and retry flows
- report generation and PDF output
- rate limiting and security helpers
The app is designed around three runtime pieces:
- The Next.js web app
- The background worker
- The video render service
Production deployment should ensure:
- the web app can reach Firestore, Firebase Storage, Helius, and the selected inference/video providers
- the worker process has access to the same job datastore and payment config
- the video service can be started independently and receives the same runtime config
- webhook endpoints are reachable for Helius and MoonPay
APP_BASE_URLis set correctly for generated status and return URLs
If you are deploying the app on a platform that supports separate services, keep the worker and video service separate from the web tier.
- Payment addresses are derived from a master seed. Protect
PAYMENT_MASTER_SEED_HEX. HELIUS_WEBHOOK_SECRETandMOONPAY_WEBHOOK_SHARED_TOKENshould be treated as secrets, not public config.- Keep the public and private pricing paths in sync with
lib/cinema/config.tsandlib/packages.ts. ALLOW_IN_PROCESS_WORKERis useful for local development, but production should run the worker separately.- Job retries and sweeps are operational workflows, not end-user features. Monitor them separately.
- Inference and render backends are configurable. A bad provider config can stall the queue without breaking the UI.
- The repo includes admin routes and moderator tooling. Keep those behind auth and out of public navigation.
app/ Next.js routes, APIs, pages, and layout
components/ Reusable UI and experience-specific clients
lib/ Core domain logic, payments, jobs, inference, analytics, and storage helpers
workers/ Background worker and command entrypoints
tests/ Vitest suite for domain, API, and integration behavior
Local repo skill:
skills/hasmedia/SKILL.md
Use it for x402 video jobs, job polling, report retrieval, and GoonBook publishing flows.