Skip to main content

Mock → live migration

The frontend started as a pure-mock SPA. It's transitioning to live-API. Track what's still mock so you know what's safe to throw away.

Status

SurfaceSourceNotes
Homepage featured agentsLive (useAgents())Replaces the original mock featured set
Browse catalogLive
Agent detail (hero, pricing, reviews, changelog)Live
Dashboard subscriptionsLive
/admin/leadsMockleads[] in src/data/agents.ts
/admin/customersMockcustomers[] in src/data/agents.ts
/admin/vendorsMockvendors[] in src/data/agents.ts
/admin/overview KPIsPartial mockSome derived from live, some hard-coded
Some "trending" homepage stripsCommented outAwaiting backend support
Static category color themesStatic (intentional)src/data/categoryThemes.ts — not migrating

To migrate AdminLeads

The backend doesn't have a leads table yet. Two options:

  1. Postpone — leave the mock data in place until you have an actual lead tracking system.
  2. Reuse interactions — the interactions table already captures demo_request and user_signup. Aggregate it into a lead view: SELECT ... FROM interactions WHERE type IN ('demo_request', 'user_signup').

Recommendation: rename AdminLeads to AdminLeadFeed, point it at GET /admin/interactions?type=demo_request, and ship.

To migrate AdminCustomers

Aggregate user_agent_subscriptions by userId. Recommended new endpoint:

GET /admin/customers?cursor=&limit=20
→ [{ userId, email, name, totalMRR, agents: [...] }, ...]

Until then, build it client-side from subscriptions + auth.user data via existing endpoints.

To migrate AdminVendors

There's no notion of "vendor" in the schema today — every agent has createdBy (a user ID) and that's it. Add:

  • Column on agents: publisherId, publisherName.
  • Or full vendors table with (id, name, contactEmail, payoutMethod) and agents.vendorId FK.

Then GET /admin/vendors aggregates installs, revenue, agent count per vendor.

Hybrid mode for previews

The mock entries in src/data/agents.ts are still useful for:

  • Previewing UI on a slow CI build without provisioning a backend.
  • Adding placeholder copy for an agent that doesn't exist in the DB yet.

The runtime preference is live API. Mock entries are visible only when useAgents() returns empty or errors.

Decommission criteria

Each mock array can be deleted from src/data/agents.ts when:

  • Its backend endpoint exists.
  • The corresponding admin page is updated to call that endpoint.
  • All consumers in the codebase reference the live hook.

Don't delete proactively — keep them as live documentation of the desired shape until the backend catches up.