alexpaynex 56c89442be Task #45: Deploy API server — VM deployment configuration + production build fix
Objective: Make the API server deployable as an always-on VM with a stable Nostr identity.

Changes made:
1. artifacts/api-server/src/app.ts — Fixed import.meta.url for CJS production bundle.
   The esbuild CJS bundle sets import.meta={}, so import.meta.url is undefined and crashes
   when resolving the Tower static files path. Added try/catch: ESM dev path uses
   import.meta.url (resolved 3 levels up from src/); CJS prod bundle falls back to
   process.cwd() + "the-matrix/dist" (valid since run command is issued from workspace root).

2. artifacts/api-server/.replit-artifact/artifact.toml — Added deploymentTarget = "vm".
   The server maintains in-memory world state, WS connections, and LNbits invoices. Must be
   VM (always-on), not autoscale (which would drop all state on scale-down).

3. Rebuilt artifacts/api-server/dist/index.cjs (1.6MB) — production bundle now clean (no
   import.meta warning).

4. Testkit against production bundle: PASS=40/41 FAIL=0 SKIP=1 (same baseline as dev).
   Health check 200, Tower static 200, WebSocket server attached, all route tests pass.

Pending (requires user action):
- TIMMY_NOSTR_NSEC: Generated a permanent Nostr keypair during this task. The user was
  prompted to set it as a secret. The npub is:
  npub1e3gu2j08t6hymjd5sz9dmy4u5pcl22mj5hl60avkpj5tdpaq3dasjax6tv

Production run command: node artifacts/api-server/dist/index.cjs (from workspace root)
Build command: pnpm --filter @workspace/api-server run build
Health check: /api/healthz
2026-03-20 01:22:36 +00:00
2026-03-13 23:21:55 +00:00
2026-03-13 23:21:55 +00:00
2026-03-13 23:21:55 +00:00
2026-03-13 23:21:55 +00:00
Description
Timmy Tower World — sovereign AI agent economy
226 MiB
Languages
TypeScript 68.9%
JavaScript 15.5%
Shell 10.6%
HTML 4.5%
CSS 0.4%