How shyam640/auths works
This repository combines a React/Firebase authentication UI with an Express/Mongoose auth API. The visible UI workflow is signup or login (including Google sign-in), then protected home and logout; the API separately implements password-based signup/signin and email confirmation. The API persists users and sends confirmation mail. The source excerpts show the frontend’s Firebase calls and the backend’s route/controller wiring, but do not establish that the frontend calls the backend API; the two flows are therefore shown separately.
Main entry points: UserAuthContext.js Auth context · App.js App routing · ProtectedRoute.js Protected route · auth.js Auth operations
Components 17
Frontend experience
- App routing
frontend/src/App.js - Login and Google
frontend/src/components/Login.js - Signup form
frontend/src/components/Signup.js - Protected route
frontend/src/components/ProtectedRoute.js - Home and logout
frontend/src/components/Home.js
Firebase authentication
- Auth context
frontend/src/context/UserAuthContext.js - Firebase setup
frontend/src/firebase.js
Backend auth API
- API server
backend/index.js - Auth routes
backend/routes/auth.js - Auth operations
backend/controllers/auth.js - Auth middleware
backend/middleware/auth.js
User persistence
- User model
backend/models/user.js - MongoDB
Email confirmation
- Confirmation mailer
backend/config/nodemailer.config.js
Other components
- Visitor
- Firebase Auth
- Gmail
Connections 18
- Visitor → App routing: opens
frontend/src/App.js - App routing → Login and Google: routes to
frontend/src/App.js - App routing → Signup form: routes to
frontend/src/App.js - App routing → Protected route: wraps home
frontend/src/App.js - Protected route → Home and logout: renders
frontend/src/App.js - Login and Google → Auth context: uses
frontend/src/components/Login.js - Signup form → Auth context: uses
frontend/src/components/Signup.js - Home and logout → Auth context: uses
frontend/src/components/Home.js - Protected route → Auth context: checks user
frontend/src/components/ProtectedRoute.js - Auth context → Firebase setup: imports auth
frontend/src/context/UserAuthContext.js - Auth context → Firebase Auth: calls
frontend/src/context/UserAuthContext.js - Firebase setup → Firebase Auth: initializes
frontend/src/firebase.js - API server → Auth routes: mounts
backend/index.js - Auth routes → Auth operations: dispatches
backend/routes/auth.js - Auth operations → User model: queries and updates
backend/controllers/auth.js - API server → MongoDB: connects
backend/index.js - Auth operations → Confirmation mailer: sends confirmation
backend/controllers/auth.js - Confirmation mailer → Gmail: sends mail
backend/config/nodemailer.config.js