How shahnewaz-labib/auth-be-wildin works
Main Components
A. Server Layer:
• HTTP Server (main.go) handling incoming requests on port 9000
• Route handlers for /register, /login, /me, and /logout endpoints
B. Authentication Layer (auth/auth.go):
• Authentication service handling user verification
• Session management
• Password hashing and verification
C. Database Layer (db/db.go):
• User storage and retrieval
• Session storage
┌─────────────────────────────────────┐
• Client Requests │
• (Browser/API Client with Cookies) │
• ┘
• ↕ HTTP
┌─────────────────────────────────────┐
• HTTP Server (main.go) │
• POST /register │
• POST /login │
• GET /me │
• POST /logout │
• ┘
• ↕ Internal Calls
┌─────────────────────────────────────┐
• Auth Service (auth/auth.go) │
• User Authentication Logic │
• Session Management │
• Password Handling │
• ┘
• ↕ Data Access
┌─────────────────────────────────────┐
• Database Layer (db/db.go) │
• User Storage │
• Session Storage │
• ┘
Important Details to Capture
• Session Management:
• Cookie-based authentication flow
• Session storage and retrieval
• Session validation points
• Authentication Flow:
• Registration process
• Login process
• Session verification for protected routes
• Logout and session cleanup