Files
QQuiz/docs/audit/frontend-migration.md
handsomezhuzhu 9a1a9d3247 refactor: remove legacy frontend code and implement new Next.js structure
- Deleted the old Register page and utility functions.
- Removed Tailwind CSS configuration and Vite configuration files.
- Added a new script for starting a single container with FastAPI and Next.js.
- Updated README to reflect the current status of the Next.js frontend.
- Implemented new login and registration API routes with improved error handling.
- Refactored frontend API calls to use the new proxy structure.
- Enhanced error handling in API response processing.
- Updated components to align with the new API endpoints and structure.
2026-04-17 21:15:06 +08:00

1.4 KiB

Frontend Cutover Notes

Decision

web/ is now the only frontend in the repository.

The previous Vite SPA has been removed so that:

  • split deployment and single-container deployment use the same UI
  • documentation no longer has to describe two competing frontend stacks
  • future frontend changes only need to be implemented once

Runtime Model

Auth

  • Login goes through Next route handlers under /frontend-api/auth/*
  • Backend JWT is stored in an HttpOnly cookie
  • Browser code never reads the raw token

Data

  • Server pages use server-side fetch helpers against FastAPI
  • Client mutations use browser-side fetch helpers against /frontend-api/proxy/*
  • FastAPI continues to own the public /api/* surface

Streaming

  • Browser connects to /frontend-api/exams/{examId}/progress
  • The route reads the session cookie and proxies backend SSE
  • Backend token query parameters stay hidden from the browser

Deployment Outcome

Split Stack

  • backend serves API traffic on :8000
  • web serves Next.js on :3000

Single Container

  • the container runs both FastAPI and Next.js
  • FastAPI stays on :8000
  • non-API requests are proxied from FastAPI to the embedded Next server

Follow-up Expectations

  1. New frontend work lands only in web/
  2. Single-container smoke tests must validate both UI and API paths
  3. Deployment docs must continue to describe web/ as the sole frontend