How sameer021000/jafar works
The repository contains an admin authentication portal backed by an Express/Mongoose API, plus two shop frontend directories with little or no evidenced runtime functionality. The main workflow is an admin submitting credentials, receiving a JWT, and having the session revalidated on reload; logout clears the client token. The graph also shows backend request validation and error handling. Shop capabilities are not described in the supplied README or source excerpts, so they are not expanded. Relationships are limited to calls and routes shown in excerpts or the source index.
Main entry points: LoginScreen.jsx Login form · AdminAuthRoutes.js Auth routes · AdminAuthService.js Auth client · App.js Portal session
Components 20
Admin portal
- Portal session
frontend/JafarAdmin/src/App.js - Login form
frontend/JafarAdmin/src/Components/LoginScreen/LoginScreen.jsx - Form input
frontend/JafarAdmin/src/Components/Common/FormInput/FormInput.jsx - Brand header
frontend/JafarAdmin/src/Components/Common/BrandHeader/BrandHeader.jsx - Submit button
frontend/JafarAdmin/src/Components/Common/PrimaryButton/PrimaryButton.jsx - Auth client
frontend/JafarAdmin/src/Services/AdminAuthService.js - HTTP client
frontend/JafarAdmin/src/Api/ApiService.js - Token storage
frontend/JafarAdmin/src/Utils/TokenManager.js - Form validation
frontend/JafarAdmin/src/Utils/Validation.js
Authentication API
- Auth routes
backend/Routes/AdminAuthRoutes.js - Request validation
backend/Middlewares/ValidateRequest.js - Credential rules
backend/Validations/AdminAuthValidation.js - Auth controller
backend/Controllers/AdminAuthController.js - Error handler
backend/Middlewares/ErrorHandler.js - JWT verification
backend/Middlewares/VerifyAdminToken.js - API server
backend/MainFile.js
Authentication core
- Auth service
backend/Services/AdminAuthService.js
Persistence
- Admin model
backend/Models/AdminModel.js - MongoDB connection
backend/Config/Database.js
Other components
- Admin user
Connections 22
- Admin user → Login form: submits credentials
frontend/JafarAdmin/src/Components/LoginScreen/LoginScreen.jsx - Portal session → Login form: renders
frontend/JafarAdmin/src/App.js - Login form → Form input: renders
frontend/JafarAdmin/src/Components/LoginScreen/LoginScreen.jsx - Login form → Brand header: renders
frontend/JafarAdmin/src/Components/LoginScreen/LoginScreen.jsx - Login form → Submit button: renders
frontend/JafarAdmin/src/Components/LoginScreen/LoginScreen.jsx - Login form → Form validation: validates fields
frontend/JafarAdmin/src/Components/LoginScreen/LoginScreen.jsx - Login form → Auth client: requests login
frontend/JafarAdmin/src/Components/LoginScreen/LoginScreen.jsx - Login form → Token storage: saves token
frontend/JafarAdmin/src/Components/LoginScreen/LoginScreen.jsx - Portal session → Auth client: verifies and logs out
frontend/JafarAdmin/src/App.js - Portal session → Token storage: reads and clears
frontend/JafarAdmin/src/App.js - Auth client → HTTP client: calls
frontend/JafarAdmin/src/Services/AdminAuthService.js - Auth client → Auth routes: calls auth endpoints
frontend/JafarAdmin/src/Services/AdminAuthService.js - API server → Auth routes: mounts routes
backend/MainFile.js - API server → MongoDB connection: connects
backend/MainFile.js - API server → Error handler: registers middleware
backend/MainFile.js - Auth routes → Request validation: validates requests
backend/Routes/AdminAuthRoutes.js - Auth routes → Credential rules: uses rules
backend/Routes/AdminAuthRoutes.js - Auth routes → JWT verification: protects verification
backend/Routes/AdminAuthRoutes.js - Auth routes → Auth controller: dispatches requests
backend/Routes/AdminAuthRoutes.js - Auth controller → Auth service: handles auth
backend/Controllers/AdminAuthController.js - Auth service → Admin model: reads and writes admins
backend/Services/AdminAuthService.js - Admin model → MongoDB connection: uses MongoDB connection