Skip to content

Migrate remaining REST APIs to tRPC #227

@Starefossen

Description

@Starefossen

Title
Migrate all the remaining REST APIs to tRPC for better client type safety.

Description
tRPC is already implemented and verified working, this migration will ensure strongly typed data across client and backend reducing chances of errors.


REST API Migration Inventory

✅ Already Migrated to tRPC / Not Migratable

API Route Status Notes
/api/trpc/[trpc] tRPC handler Core tRPC endpoint
/api/auth/[...nextauth] Framework NextAuth.js handlers (required by framework)
/api/auth/callback Framework WorkOS AuthKit callback (required by framework)
/api/upload/proposal-attachment Cannot Migrate Multipart upload (Vercel Blob) - explicitly excluded
/api/upload/speaker-image Cannot Migrate Multipart image upload
/api/admin/speaker-image Cannot Migrate Multipart image upload
/api/admin/gallery/upload Cannot Migrate Multipart gallery upload
/api/travel-support/upload-receipt Cannot Migrate Multipart receipt upload

📋 APIs to Migrate to tRPC

API Route Method Description Priority
/api/volunteer POST Create volunteer application Medium
/api/proposal/[id]/action POST Proposal status changes High
/api/admin/speakers GET List all speakers (admin) Medium
/api/admin/clear-session GET/POST Clear session cookies (dev only) Low
/api/speakers/search GET Search speakers by name/email Medium
/api/proxy-image GET Proxy images from Sanity Low
/api/badge/validate POST Validate OpenBadges credential Medium

⚠️ Public/External APIs (Should Remain REST)

These are public-facing or external APIs that need REST endpoints for interoperability:

API Route Method Reason to Keep as REST
/api/badge/issuer GET OpenBadges 3.0 spec requires HTTP endpoint
/api/badge/[badgeId]/json GET Public credential endpoint
/api/badge/[badgeId]/image GET Returns SVG binary
/api/badge/[badgeId]/download GET Returns SVG download
/api/badge/[badgeId]/verify GET Public verification endpoint
/api/badge/[badgeId]/achievement GET OpenBadges achievement endpoint
/api/badge/.well-known/jwks.json GET JWKS per RFC 7517
/api/badge/keys/[keyId] GET JWK key endpoint
/api/route GET Health check (Hello world)
/api/dev GET Dev tools (development only)
/api/dev/clear-storage GET Dev tools (development only)
/api/cron/cleanup-orphaned-blobs GET Cron job (Vercel cron)
/api/cron/sales-update GET Cron job (Vercel cron)
/api/webhooks/checkin/ticket-sold POST External webhook receiver

Summary

Category Count
Total REST API routes 29
Already tRPC/Framework 2
Cannot migrate (multipart) 5
Should remain REST (external/public) 14
To migrate to tRPC 7

Migration Tasks

  • /api/proposal/[id]/actionproposal.action (High priority)
  • /api/volunteervolunteer.create (Medium priority)
  • /api/admin/speakersspeakers.list (Medium priority)
  • /api/speakers/searchspeaker.search (Medium priority - may already exist)
  • /api/badge/validatebadge.validate (Medium priority)
  • /api/proxy-image → Consider keeping as REST (returns binary)
  • /api/admin/clear-session → Low priority (dev only)

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions