How louisephillips-eng/pern_login works
This PERN authentication app lets users register or log in, then uses an HTTP-only JWT cookie to restore their session, protect the current-user endpoint, and log out. The repository contains parallel copies of the frontend and backend at the root and under frontend/ and backend/; the graph keeps these implementations distinct rather than assuming they are wired together. The README documents the broader capabilities, while source excerpts show the root and backend/ server flows. Database wiring from each copy is shown; the relationship between the frontend and a particular backend copy is not established.
Main entry points: src/App.jsx App routing · src/App.jsx App routing · routes/auth.js Auth routes · routes/auth.js Auth routes
Components 19
Root frontend
- App routing
src/App.jsx - Auth pages
src/pages - Navbar
src/components/navbar.jsx - API client
src/App.jsx
Frontend copy
- App routing
frontend/src/App.jsx - Auth pages
frontend/src/pages - Navbar
frontend/src/components/Navbar.jsx - API client
frontend/src/api.js
Root backend
- HTTP server
server.js - Auth routes
routes/auth.js - JWT protection
middleware/auth.js - DB pool
config/db.js
Backend copy
- HTTP server
backend/server.js - Auth routes
backend/routes/auth.js - JWT protection
backend/middleware/auth.js - DB pool
backend/config/db.js
Other components
- User
- PostgreSQL
- PostgreSQL
Connections 22
- User → App routing: uses
- App routing → Auth pages: routes to
src/App.jsx - App routing → Navbar: renders
src/App.jsx - App routing → API client: requests session
src/App.jsx - User → App routing: uses
- App routing → Auth pages: routes to
frontend/src/App.jsx - App routing → Navbar: renders
frontend/src/App.jsx - App routing → API client: requests session
frontend/src/App.jsx - Auth pages → API client: sends auth requests
frontend/src/pages/Login.jsx - Navbar → API client: sends logout
frontend/src/components/Navbar.jsx - HTTP server → Auth routes: mounts routes
server.js - Auth routes → JWT protection: protects current user
routes/auth.js - Auth routes → DB pool: queries users
routes/auth.js - JWT protection → DB pool: loads user
middleware/auth.js - DB pool → PostgreSQL: connects pool
config/db.js - HTTP server → Auth routes: mounts routes
backend/server.js - Auth routes → JWT protection: protects current user
backend/routes/auth.js - Auth routes → DB pool: queries users
backend/routes/auth.js - JWT protection → DB pool: loads user
backend/middleware/auth.js - DB pool → PostgreSQL: connects pool
backend/config/db.js - API client → Auth routes: calls auth API
- API client → Auth routes: calls auth API