Skip to content

Migrate billing (non-webhook) routes from Hono to TanStack Start #484

@InfinityBowman

Description

@InfinityBowman

Context

Tier 3 of the Hono → TanStack Start consolidation. Tier 1 + Tier 2 (user-facing /api/orgs/*) are landing separately. This issue tracks migrating the non-webhook billing routes.

Full migration recipe and conventions: packages/docs/audits/hono-to-tanstack-migration.md.

Scope

Files in packages/workers/src/routes/billing/ (non-webhook), recommended order smallest-first:

  • sync.ts (80 lines)
  • portal.ts (108 lines)
  • validation.ts (126 lines)
  • grants.ts (135 lines)
  • invoices.ts (149 lines)
  • subscription.ts (307 lines)
  • checkout.ts (431 lines)

~1,400 lines total across 7 files. Each is its own pass.

Out of scope

  • Stripe webhooks stay on Hono for now (raw-body signature verification). Tracked separately under the "retire Hono app" issue.

Per-file recipe

  1. Create TanStack file route(s) in packages/web/src/routes/api/billing/ mirroring the path
  2. Port tests into co-located __tests__/*.server.test.ts files
  3. Strip the Hono route to an empty stub (preserve export so parent mount compiles)
  4. Delete the corresponding Hono test file
  5. Run pnpm --filter web test, pnpm --filter workers test, and both typechecks
  6. Update any client callers (most already use plain fetch)

Risk

Billing handles money. Review each migration individually. Don't batch multiple files into one PR.

Suggested branch

`migrate-billing-routes`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions