API Migration Status
Migrated API Endpoints
We have successfully migrated the following API endpoints from Next.js API routes to Firebase Cloud Functions:
| Status | Next.js API Route | Firebase Function Endpoint |
|---|---|---|
| ✅ | /api/auth-status | /api/auth-status |
| ✅ | /api/send-email | /api/send-email |
| ✅ | /api/export-data | /api/export-data |
| ✅ | /api/health | /api/health |
| ✅ | /api/verify-token | /api/verify-token |
| ✅ | /api/auth/refresh-token | /api/auth/refresh-token |
| ✅ | /api/users | /api/users |
| ✅ | /api/users/reset-password | /api/users/reset-password |
Updated Client Components
We have updated the following client components to use the new API endpoints:
| Status | Component/Service | Notes |
|---|---|---|
| ✅ | src/lib/notifications/emailService.ts | Updated to use the new API configuration |
| ✅ | src/components/export/DataExport.tsx | Updated to use the new API with authentication |
| ✅ | src/lib/firebase/userClientService.ts | Updated all user management functions to use new API endpoints |
| ✅ | src/lib/auth/AuthContext.tsx | Updated token refresh functionality |
| ❌ | Convert server components to client components | Remaining components still need to be updated |
Next Steps
-
Deploy Firebase Functions:
Terminal window firebase deploy --only functions -
Update Next.js Configuration:
- To enable static export mode, update
next.config.js:
output: 'export',images: {unoptimized: true,} - To enable static export mode, update
-
Update Dynamic Routes:
- Either implement
generateStaticParams()for dynamic routes like/tickets/[id] - Or convert them to use client-side data fetching
- Either implement
-
Build and Deploy Static Site:
Terminal window npm run buildfirebase deploy --only hosting
Remaining Work
- Convert server components to client components
- Handle dynamic routes
- Configure and test static export
- Handle client-side authentication flow
- Update middleware.ts for static site compatibility
- Test API functionality and authentication