packages/examples/cloud/edad/README.md
A different pattern from apps/edad/: instead of creating a character on Eliza Cloud and redirecting users to cloud/chat/<characterId>, this variant keeps the chat UI on the app's own domain and proxies /v1/messages calls to Eliza Cloud with the app + affiliate code attached as headers.
Shipped live at https://eliza.nubs.site/apps/edad/ by RemilioNubilio.
recordCreatorEarnings; affiliate code adds a separate sharebrowser app backend eliza cloud
┌──────────────────┐ ┌──────────────────┐ ┌───────────────────┐
│ index.html │ POST /api/msgs │ proxy.ts │ /v1/messages │ debits user's │
│ + chat UI JS │─────────────────▶│ adds x-app-id │──────────────▶│ org balance │
│ │ │ + x-affiliate- │ │ adds markup → me │
│ Steward JWT │ │ code header │ │ creator earnings │
│ (OAuth required) │ │ + Authorization │ │ + affiliate share│
└──────────────────┘ └──────────────────┘ └───────────────────┘
| file | purpose |
|---|---|
public/index.html | landing + chat UI + OAuth sign-in + message loop |
public/style.css | dad-energy dark theme, SVG silhouette, responsive |
public/meta.json | app index metadata |
api/proxy.ts | Next.js-style catch-all route handler — used when edad-chat is mounted under a host Next.js app at /api/* |
server.ts | standalone Bun server with the same wire behavior as api/proxy.ts — used when edad-chat runs as its own container |
Dockerfile | bun:1.2-alpine image, exposes :3000, includes /health for ECS health checks |
ELIZA_APP_ID=<uuid of app registered via POST /api/v1/apps>
ELIZA_CLOUD_URL=https://www.elizacloud.ai
ELIZA_AFFILIATE_CODE=AFF-XXXXXX # your affiliate code — drives per-call affiliate share earnings
There is no operator-paid fallback. The proxy rejects requests without a Steward JWT with 401. Reasoning:
apps/edad/ (character creator variant)| concern | edad/ (signup funnel) | edad-chat/ (this variant) |
|---|---|---|
| where chat happens | Eliza Cloud domain (/chat/<charId>) | miniapp's own domain |
| character per user | yes (registered via /api/affiliate/create-character) | no — system prompt is per-request |
| cold-start friction | low (anon session + 5 free messages via affiliate API) | medium (OAuth sign-in required) |
| monetization lever | affiliate API affiliateId baked into character creation | X-Affiliate-Code header on every /v1/messages + creator markup % on the app |
| works for existing users | yes (redirects them into cloud chat) | yes (they chat right there with their credits) |
| brand continuity | breaks (user leaves miniapp domain) | preserved |
Neither is strictly better — they serve different distribution models. edad/ wins for signup-funnel miniapps; edad-chat/ wins for embedded chat on a branded domain.
POST https://www.elizacloud.ai/api/v1/apps with { name, app_url, skipGitHubRepo: true } → get app_id backinference_markup_percentage on the app row to a value > 0 so you earn the markup share on every chatELIZA_APP_ID and ELIZA_AFFILIATE_CODE env vars on the hostpublic/ as static assets; wire api/proxy.ts as a server route at /api/*Self-hosting closes the loop: app earnings refill the org's credit balance via the earnings auto-fund service, container daily-billing keeps debiting that balance, and the app keeps itself alive as long as it earns enough.
# 1. build + push to your ECR (or any registry the cloud can pull from)
docker build -t edad-chat:latest -f apps/edad-chat/Dockerfile apps/edad-chat
docker tag edad-chat:latest <account>.dkr.ecr.<region>.amazonaws.com/edad-chat:latest
docker push <account>.dkr.ecr.<region>.amazonaws.com/edad-chat:latest
# 2. POST /api/v1/containers (use any cloud API key with deploy scope)
curl -X POST https://www.elizacloud.ai/api/v1/containers \
-H "Authorization: Bearer $ELIZA_API_KEY" \
-H "content-type: application/json" \
-d '{
"name": "edad-chat",
"project_name": "edad",
"port": 3000,
"cpu": 256,
"memory": 512,
"ecr_image_uri": "<account>.dkr.ecr.<region>.amazonaws.com/edad-chat:latest",
"health_check_path": "/health",
"environment_vars": {
"ELIZA_APP_ID": "<your-app-uuid>",
"ELIZA_AFFILIATE_CODE": "<your-affiliate-code>",
"ELIZA_CLOUD_URL": "https://www.elizacloud.ai"
}
}'
# 3. (one-time, on the org dashboard) enable earnings auto-fund:
# PUT /api/v1/billing/earnings-auto-fund
# { "enabled": true, "amount": 5, "threshold": 2, "keepBalance": 10 }
# → when org credits dip below $2, auto-credit $5 from your redeemable
# earnings, keeping at least $10 cashable at all times.
The container listens on :3000, exposes /health for the ECS health check, and the same /api/* routes as the embedded variant. No code differs between Option A and B — just the host process.
Built by RemilioNubilio. Inspired by Shaw's original eDad spec in apps/edad/.