Skip to content

refactor(web): full frontend architecture overhaul#540

Draft
eoaksnes wants to merge 1 commit intostack/02-apifrom
stack/03-web
Draft

refactor(web): full frontend architecture overhaul#540
eoaksnes wants to merge 1 commit intostack/02-apifrom
stack/03-web

Conversation

@eoaksnes
Copy link
Copy Markdown
Collaborator

@eoaksnes eoaksnes commented May 9, 2026

Stack 3/4 — base: `stack/02-api` (#539)

Complete frontend rewrite: tooling, generated SDK, shared platform foundation, and TanStack Router app shell + Todos cutover.

Stack

  1. chore(infra): IaC, compose, redis, oauth2-proxy baseline #538 stack/01-infra
  2. feat(api): add monitoring feature with track_events use case #539 stack/02-api
  3. stack/03-web ← you are here
  4. stack/04-docs (base: stack/03-web)

This pull request introduces significant improvements to the web application's frontend development workflow, focusing on code quality, maintainability, and modern tooling. The changes include the integration of TanStack Query and Router, enhanced linting with ESLint for TanStack Query best practices, improved handling of generated files, and updates to dependencies and configuration for a more robust developer experience.

Linting and Code Quality Enhancements

  • Added a dedicated ESLint flat config (eslint.config.mts) to enforce TanStack Query usage rules and project-specific import boundaries, supplementing Biome for comprehensive linting.
  • Updated linting scripts and configuration (package.json, .mise/tasks/lint.toml) to include a new lint:query command and ensure TanStack Query rules are checked during lint runs. [1] [2]

Generated Files and Tooling

  • Marked OpenAPI and TanStack Router generated files as linguist-generated and excluded them from linting and language statistics, and updated Biome config to ignore these files. [1] [2]
  • Updated the OpenAPI generator config to output to src/api-generated and include plugins for TanStack Query and Zod, enabling type-safe API hooks and schema validation.
  • Added the auto-generated TanStack Query hooks file (src/api-generated/@tanstack/react-query.gen.ts) for type-safe API queries and mutations.

Dependency and Configuration Updates

  • Upgraded and added key dependencies: TanStack Query, TanStack Router, TailwindCSS, Application Insights, and supporting libraries for modern frontend development.
  • Added Yarn SDKs for TypeScript and ESLint, and updated Yarn and Biome configurations for improved editor and linting support. [1] [2] [3] [4] [5]

Developer Experience Improvements

  • Added a color scheme script to index.html to prevent flashes of incorrect theme before React mounts, improving perceived performance.
  • Updated Docker and environment variable handling for Vite, ensuring proper authentication and telemetry configuration in development.

Cleanup and Refactoring

  • Removed legacy authentication and router code from App.tsx and deleted the outdated App.test.tsx, preparing the codebase for the new TanStack Router and Query integration. [1] [2]

These changes collectively modernize the frontend stack, enforce best practices, and streamline the development workflow for future features and maintenance.

Tooling:
- eslint flat config + biome update
- yarn .yarnrc + sdks for editor support
- package.json + yarn.lock dependency bumps
- tsconfig, vite, vitest, openapi-ts config refresh
- mise: add lint:web:query task (TanStack Query lint)
- .gitattributes: mark routeTree.gen.ts and api-generated/ as linguist-generated
- docker-compose.override: pass VITE_AUTH + VITE_TELEMETRY into dev SPA

Generated SDK:
- Move api/generated -> api-generated
- Add @tanstack/react-query.gen.ts (query/mutation hooks)
- Add zod.gen.ts (runtime schema validation)

Shared platform foundation:
- shared/platform/api: configureApiClient, query client factory, ApiError
- shared/platform/auth: current/anonymous user, reauth flow, session watcher
- shared/platform/telemetry: AppInsights/console/noop backends + error boundary
- shared/platform/{theme,toast,feature-flags,access-control}
- shared/components: EmptyState, ErrorPanel, IconButton, LoadingState, PageHeader, Popover
- config/: env, accessControl, featureFlags
- mocks/: MSW server + handlers
- setupTests.ts updated

App shell + Todos cutover:
- app/bootstrap: Providers, ApplicationError, createQueryClient
- app/error-pages: Forbidden/NotFound/StatusPage/RouteErrorBoundary/UnexpectedError
- app/layout: RootLayout, Header, VersionText
- app/routes + routeTree.gen.ts (TanStack Router)
- app/styles, app/auth/SessionExpiredDialog
- features/todos: api (queries/mutations/keys/invalidations/schema), pages/TodosPage with NewTodoForm, TodoItem, TodoList, TodosFilter
- index.tsx + index.html: new bootstrap
- Removed legacy: App.tsx, router.tsx, auth.ts, common/components/*, contexts/TodoContext, hooks/useTodoAPI, pages/TodoListPage, features/todos/todo-list/*
@eoaksnes eoaksnes marked this pull request as draft May 9, 2026 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant