You're tasked with implementing a fully functional authentication flow using our real API and Figma design.
- API Docs: https://em80etvxo4.apidog.io
- Figma UI: Vidinfra 2025 - Auth Flow
POST /auth/registerβ Register a new userPOST /auth/loginβ Login and receive JWT access & refresh tokensGET /auth/profilesβ Fetch current authenticated user (requires JWT access token)
Use the following tools:
- β Next.js (App Router)
- β Typescript
- β React Hook Form
- β shadcn/ui
- β TailwindCSS
- Fields: name, email, password
- Submit to
POST /auth/register - On success, redirect to dashboard
- Fields: email, password
- Submit to
POST /auth/login - Store
access_token+refresh_token - On success, redirect to dashboard
- Protected route
- Fetch user info from
GET /auth/profiles - Show name + email + logout button
- Store
access_token(e.g., memory or localStorage for this task) - Store
refresh_tokensecurely (mock cookie or memory) - If access token expires (simulate it), use
refresh_tokento get a new one - Automatically logout on refresh failure
- Use React Context or Zustand to manage auth state
- Auto-refresh token if expired when hitting
/auth/profiles - Follow SOLID principles
- Use React Hook Form for form state + validation
- UI must match the Figma design
- Use
feature/branches:feature/auth-registerfeature/auth-loginfeature/token-refresh
- Use conventional commits:
feat: implement login pagechore: set up auth context
- Push to a public GitHub repo
- Include:
.env.exampleREADME.mdwith setup instructions- Any assumptions
| Area | Expectation |
|---|---|
| Code Quality | SOLID, reusable, modular |
| Token Management | Secure and auto-refresh |
| UI Accuracy | Matches Figma |
| Form Handling | Clean RHF usage |
| Git Hygiene | Proper commits and branching |
| Error Handling | Clear feedback and graceful failures |