Doc Router is a document AI product. FastAPI already owns auth, APIs, workers, and the database. The browser app is a logged-in React UI.
We moved that UI from Next.js to Vite. Same screens. A static build served by nginx. Generating code is easy. A simpler framework is still worth it: less to debug, fewer deploy paths, and more control over routing and auth.
Architecture: Before and After
Figure 1: Before and after the Next.js β Vite migration.
The browser used to reach the Next.js UI, the Next.js server, and FastAPI. Now it reaches a static SPA and FastAPI, and only FastAPI talks to the database.
What We Replaced (at a Glance)
| Next.js | Vite + React Router |
|---|---|
| File-based routes | React Router |
| Next image and dynamic import | A normal image and lazy loading |
| API routes and a Node session | A FastAPI session cookie |
| A Node server in production | Static files on nginx |
NEXT_PUBLIC_* env vars | VITE_* env vars |
Same Look and Feel
We kept MUI, Tailwind, Form.io, and the same screens.

The flows editor, unchanged.
How We Migrated (Short Version)
- Backend first β moved all the Next.js server APIs to FastAPI.
- Vite side by side with Next.js.
- Route parity β same URLs, now in React Router.
- Remove Next. CI and Docker build Vite only.
- Cleanup.
The port took two days: about 18k lines touched across 258 files.
The code migration was done in Cursor with Composer 2.5 Fast. This post was written with Grok, the latest Grok coding model.
Unit Tests
About 1,400 backend unit tests and 180 frontend unit tests stayed in place. They cover login, documents, flows, and the UI. The frontend could change. The API did not.
Conclusion: When to Pick Which Front End
| You want⦠| Consider |
|---|---|
| SSR, SEO, file-based app + server components | Next.js |
| API already in Python/Go/etc., static deploy, cookie session API | Vite + React Router |
Doc Router fits Vite and React because FastAPI already handles auth, APIs, and the database. The Doc Router UI only has to be a static React app.
