Stage 1 — src/index.tsx
Redux persist config whitelists only
users:
Stage 2 — src/App.tsx
Provider nesting (outer → inner):
- ThemeCustomization — MUI theme, palette, typography
- RTLLayout — RTL support wrapper
- Locales — react-intl messages
- ScrollTop — scroll restoration on route change
- JWTProvider — auth state, token, login/logout
- RouterProvider —
routerfromroutes/index.tsx - Snackbar — global toast notifications
JWT initialization side effects
On mount,JWTProvider:
- Reads
serviceTokenfromlocalStorage - Validates JWT expiry with
jwt-decode - Calls
GET /user/verifyTokento restore user - Calls
getSocket(userId)to connect Socket.IO
isInitialized is true, a full-page <Loader /> is shown.
Router creation
routes/index.tsx:
Default landing path
config.ts sets APP_DEFAULT_PATH = '/dashboard'. GuestGuard redirects logged-in users there after login.