Skip to content

CONFIG: React Router and Router Guards #12

@nayan458

Description

@nayan458

Task: Setup React Router Setup and Route Guards Scaffold

Type: Infrastructure
Milestone: M0-Project - Foundation
Estimate: M

What This Enables

All page-level navigation. Auth-protected routes are blocked until guards exist. Blocks feature teams from wiring up their pages.

Deliverables

  • src/app/router.tsx : createBrowserRouter with route definitions
  • src/app/routes.ts : centralized route path constants (no magic strings)
  • <PrivateRoute> guard : redirects unauthenticated users to /login
  • <PublicRoute> guard : redirects authenticated users away from /login
  • Lazy loading setup : React.lazy + <Suspense> on all feature-level routes
  • 404 fallback route

Route Structure

/                  Landing / redirect
/login             PublicRoute
/dashboard         PrivateRoute (lazy)
/settings          PrivateRoute (lazy) (optional)
*                  404

Acceptance Criteria

  • Unauthenticated access to a private route redirects to /login with ?redirect= preserved
  • Post-login redirect returns user to original destination
  • All feature routes are code-split (verify with vite build chunk output)
  • Route constants used everywhere — no hardcoded path strings in components

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesttype: infraProject setup, tooling, config, or architecture — not feature work

Type

No fields configured for Task.

Projects

Status

Backlog

Relationships

None yet

Development

No branches or pull requests

Issue actions