No description
- TypeScript 99%
- JavaScript 1%
| src | ||
| .gitignore | ||
| AGENTS.md | ||
| eslint.config.js | ||
| package.json | ||
| pnpm-lock.yaml | ||
| pnpm-workspace.yaml | ||
| README.md | ||
| tsconfig.json | ||
ddcais
Local mock backend for a node-based GPU motion-design editor. Speaks the editor's server protocol: passwordless auth, license validation, pricing, and token-metered AI endpoints — everything the desktop app needs to consider itself licensed, without contacting the real upstream.
How it works
The editor reads its backend URL from an environment variable at startup. Point that variable at ddcais and every request the app makes lands here:
- Auth — magic-link flow is auto-approved. Submitting any email immediately
authorizes the nonce, so the next poll (the app polls every 3 s) receives a
license key. Keys are deterministic: a UUID-shaped slice of
sha256(email), so the same email always yields the same key. - License —
/license/checkanswersvalid: true(type: "perpetual",canExport: true,tokenBalance: 0) for any key this process issued. Unknown keys getlicense_not_found, same as upstream. - Pricing — returns mock variants whose checkout URLs route back to the mock itself (a stub HTML page, no real purchase).
- AI — the model catalog is served so the AI UI populates, but every
generation endpoint returns
402 insufficient_tokens. BYOK mode in the app bypasses this server entirely (direct provider calls) and is unaffected.
The app caches a successful license check locally with a 7-day offline grace, so once licensed it keeps working even after the mock is stopped.
Quickstart
pnpm install
pnpm dev
The server prints the exact PowerShell command to launch the editor against it:
$env:<TARGET_ENV_VAR> = "http://localhost:8787" # real name printed at startup
& "<path-to-editor.exe>"
Then enter any email in the app's license dialog — it activates within seconds.
Endpoints
| Method | Path | Behavior |
|---|---|---|
POST |
/auth/request-magic-link |
{ ok, beta: true }, auto-approves nonce |
GET |
/auth/poll?email&nonce |
{ ready: true, licenseKey } once approved |
POST |
/license/check |
valid: true for issued keys |
GET |
/pricing |
mock license + token-pack variants |
GET |
/ai/models |
real model catalog |
GET |
/ai/video/models |
empty list |
POST |
/ai/generate |
402 insufficient_tokens |
POST |
/ai/shader |
402 insufficient_tokens |
POST |
/ai/video/upload-url |
402 insufficient_tokens |
POST |
/ai/video/submit |
402 insufficient_tokens |
POST |
/ai/video/status |
402 insufficient_tokens |
Config
| Env var | Default | Purpose |
|---|---|---|
PORT |
8787 |
listen port |
Notes
- State is in-memory: restart the mock and the app must re-authenticate (instant, since approval is automatic).
- Editor-specific strings (env var name, binary path) are stored
reversed-base64'd in
src/obfuscated.tsand decoded only at runtime. - Lint with
pnpm lint.