Skip to content

CONFIG: React Router and Router Guards #12

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

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

Type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions