How omarkh006/bookstore works
BookStore is an Express REST API for a public books-and-authors catalog, user accounts, password recovery, and administrator-managed catalog changes and image uploads. The main workflow is a client request entering the app and resource routes, passing applicable authorization and validation, then invoking a controller that reads or writes MongoDB and returns a response. Catalog, account, and upload capabilities are shown as distinct branches. The upload implementation and some route wiring are not excerpted; those links rely on README or SOURCE INDEX evidence.
Main entry points: app.js Express app · auth.controller.js Authentication · books.route.js Book routes · authors.route.js Author routes
Components 25
API runtime
- Express app
app.js - Book routes
routes/books/books.route.js - Author routes
routes/authors/authors.route.js - Auth routes
routes/users/auth.route.js - User routes
routes/users/users.route.js - Image uploads
routes/uploads/uploads.route.js
Catalog
- Book catalog
controllers/books/books.controller.js - Book validation
controllers/books/utils/validateBook.js - Book model
models/book/Book.model.js - Author catalog
controllers/authors/authors.controller.js - Author validation
controllers/authors/utils/validateAuthor.js - Author model
models/author/Author.model.js
Accounts
- Authentication
controllers/users/auth.controller.js - User profiles
controllers/users/users.controller.js - User validation
controllers/users/utils/validateUser.js - User model
models/user/User.model.js - Reset email
controllers/users/services/sendEmail.service.js - Reset pages
views
Shared platform
- Auth middleware
middleware/verifyToken.js - ID validation
middleware/validateObjectId.js - Error handling
middleware/errorHandlers.js - Password hashing
middleware/hashPassword.js
Other components
- API client
- MongoDB
- SMTP service
Connections 39
- API client → Express app: sends requests
README.md - Express app → Book routes: mounts routes
app.js - Express app → Author routes: mounts routes
app.js - Express app → Auth routes: mounts routes
app.js - Express app → User routes: mounts routes
app.js - Express app → Image uploads: mounts routes
app.js - Express app → MongoDB: connects
app.js - Book routes → Book catalog: dispatches
routes/books/books.route.js - Author routes → Author catalog: dispatches
routes/authors/authors.route.js - Auth routes → Authentication: dispatches
routes/users/auth.route.js - User routes → User profiles: dispatches
routes/users/users.route.js - Book routes → Auth middleware: guards writes
routes/books/books.route.js - Author routes → Auth middleware: guards writes
routes/authors/authors.route.js - User routes → Auth middleware: checks access
routes/users/users.route.js - Auth routes → Express app: renders views
README.md - Book routes → ID validation: checks IDs
routes/books/books.route.js - Author routes → ID validation: checks IDs
routes/authors/authors.route.js - User routes → ID validation: checks IDs
routes/users/users.route.js - Book catalog → Book validation: validates input
controllers/books/books.controller.js - Book catalog → Book model: reads and writes
controllers/books/books.controller.js - Book catalog → Author model: checks author
controllers/books/books.controller.js - Author catalog → Author validation: validates input
controllers/authors/authors.controller.js - Author catalog → Author model: reads and writes
controllers/authors/authors.controller.js - Author catalog → Book model: deletes books
controllers/authors/authors.controller.js - Authentication → User validation: validates input
controllers/users/auth.controller.js - Authentication → User model: reads and writes
controllers/users/auth.controller.js - Authentication → Password hashing: hashes passwords
controllers/users/auth.controller.js - Authentication → Reset email: sends reset
controllers/users/auth.controller.js - Authentication → Reset pages: renders pages
controllers/users/auth.controller.js - User profiles → User validation: validates input
controllers/users/users.controller.js - User profiles → User model: reads and writes
controllers/users/users.controller.js - User profiles → Password hashing: hashes passwords
controllers/users/users.controller.js - Reset email → SMTP service: sends email
README.md - Image uploads → Auth middleware: requires admin
README.md - Image uploads → Express app: serves uploaded images
README.md - Express app → Error handling: handles errors
app.js - Book model → MongoDB: persists data
README.md - Author model → MongoDB: persists data
README.md - User model → MongoDB: persists data
README.md