Accounts
Frontend of Backend project (which was built using FastAPI) using Next.js
This project handles all the frontend logic by defining API endpoints, which communicate with the my backend project to perform operations like user registration, login, reset-password and account management. It is built using Next.js. These act as middleware, validating and forwarding requests to the FastAPI backend.
๐งพ Auth Features
๐ User Registration ( And Otp Verification)

Using Email
POST /api/auth/start-registration
This feature allows users to register by providing their email address. An OTP (One-Time Password) is sent to the user's email for verification.

POST /api/auth/verify-email
After OTP verification, POST /api/auth/set-session
this automatically signs the user in.
This feature I like very much and remember building for days to make it work perfectly.
Using Google and Github
Just Simple implementation of Google POST /api/auth/google
and Github POST /api/auth/github
OAuth login. backend handles the OAuth flow and returns user data to the frontend.

๐ Login
Using Email/Username and Password
Log in using their email/username and password. After successful authentication, user is redirected to dashboard page.
Using Google and Github
The backend handles the OAuth flow in this case as well.
๐ Reset Password ( Request + Confirm )
POST /api/auth/request-password-reset
and POST /api/auth/verify-password-reset
Reset password by requesting a password reset OTP via email/username.


POST /api/auth/reset-password
After OTP verification, users can set a new password.

๐ Session and Account Management
GET /api/user/me
- Retrieve the current user's profile information.
POST /api/user/me
- Update the current user's profile information.

POST /api/auth/refresh
The session is automatically refreshed when the user interacts with the application.
๐ช Logout
POST /api/auth/logout
- Logs the user out and clears the session.
๐ Folder Structure
src/
โโโ app/ # Next.js App Router
โ โโโ api/ # API routes
โ โ โโโ auth/ # Auth API endpoints
โ โ โโโ user/ # User API endpoints
โ โ โโโ me/ # User profile operations
โ โโโ auth/ # Auth pages
โ โ โโโ user/ # User auth flows
โ โ โโโ admin/ # Admin auth flows
โ โโโ user/ # User dashboard pages
โ โโโ dashboard/ # Main user dashboard
โ โโโ me/ # Profile management
โโโ components/ # Shared components
โ โโโ ui/ # UI component library
โโโ lib/ # Utility libraries
โโโ middleware # Next.js request middleware
โโโ utils/ # Additional utilities