How heifarabuval/mernauth works
MernAuth is a MERN authentication and personal-blog application. Users register or log in, then access a protected blog to read and manage posts and comments; account recovery uses a reset link sent by email. The React app routes screens, while Express mounts authentication and protected blog APIs backed by MongoDB models. The README only identifies authentication pages; the post, comment, and recovery capabilities are supported by the sampled source. Some screen implementations and database configuration were not sampled, so their internal calls are not inferred.
Main entry points: App.js App router · server.js Express server · Blog.js Blog screen · blog.js Blog routes
Components 23
React client
- App router
client/src/App.js - Private route
client/src/components/routing/PrivateRoute.js - Account screens
client/src/components/screens - Private screen
client/src/components/screens/PrivateScreen.js - Blog screen
client/src/components/screens/Blog.js - Post editor
client/src/components/screens/AddPost.js - Post detail and edit
client/src/components/screens - Navigation header
client/src/components/screens/Header.js
Account services
- Auth routes
routes/auth.js - Auth operations
controllers/auth.js - User account model
models/User.js - Email sender
utils/sendEmail.js
Blog services
- Blog routes
routes/blog.js - Token protection
middlewares/auth.js - Post and comment operations
controllers/blog.js - Post model
models/Post.js - Comment model
models/Comment.js
Server and data
- Express server
server.js - Database connection
config/db.js - Error handler
middlewares/error.js
Other components
- Visitor
- Email service
- MongoDB
Connections 24
- Visitor → App router: uses
client/src/App.js - App router → Private route: routes through
client/src/App.js - App router → Private screen: routes to
client/src/App.js - App router → Account screens: routes to
client/src/App.js - App router → Blog screen: routes to
client/src/App.js - App router → Post detail and edit: routes to
client/src/App.js - Blog screen → Post editor: renders
client/src/components/screens/Blog.js - Blog screen → Navigation header: renders
client/src/components/screens/Blog.js - Private screen → Navigation header: uses
client/src/components/screens/PrivateScreen.js - Auth routes → Auth operations: dispatches to
routes/auth.js - Auth operations → User account model: reads and writes
controllers/auth.js - Auth operations → Email sender: sends recovery email
controllers/auth.js - Email sender → Email service: sends mail
utils/sendEmail.js - Blog routes → Token protection: protects routes
routes/blog.js - Blog routes → Post and comment operations: dispatches to
routes/blog.js - Token protection → User account model: looks up user
middlewares/auth.js - Post and comment operations → Post model: reads and writes
controllers/blog.js - Post and comment operations → Comment model: creates comments
controllers/blog.js - Blog screen → Blog routes: calls API
client/src/components/screens/Blog.js - Express server → Auth routes: mounts
server.js - Express server → Blog routes: mounts
server.js - Express server → Database connection: connects
server.js - Database connection → MongoDB: connects
- Express server → Error handler: handles errors
server.js