Frontend auth module for InvoiceBuilder built with React, TypeScript, Vite, Tailwind, shadcn/ui, Axios, and React Router v6.
- Install dependencies:
npm install- Create your environment file from .env.example:
cp .env.example .env- Update
.envwith your API URL:
VITE_API_URL=http://localhost:5043- Start the app:
npm run devnpm run dev- Start development servernpm run build- Type-check and build production bundlenpm run lint- Run ESLintnpm run preview- Preview production build locally
/register/login/verify-email/forgot-password/reset-password?email=...&token=.../dashboard(protected)
- Access and refresh tokens are stored in memory only (not in localStorage/sessionStorage).
- Axios request interceptor attaches
Authorization: Bearer <accessToken>. - Axios response interceptor handles 401 with one silent refresh attempt.
- If refresh fails, auth state is cleared and user is redirected to
/login.
The app requires VITE_API_URL. If it is missing, startup will fail intentionally to avoid hitting an undefined API host.