How mariabhai/bookclub-api works
This is a full-stack book catalogue and review application: visitors browse books and submit reviews, while account holders authenticate to access protected mutations. The browser client is served alongside an Express API, which dispatches requests through route modules to controllers and Mongoose models backed by MongoDB. The README also documents user management and protected pages; the excerpts do not show all client-to-API wiring or every route implementation, so those relationships are included only where documented or indexed.
Main entry points: index.ts Express API · public Static web client · verifyToken.ts Token verification · bookRoutes.ts Book routes
Components 24
Browser client
- Static web client
public - Book listing
public/js/index.js - Book details
public/js/book.js - Review display and form
public/js/review.js - Login page
public/js/login.js - Registration page
public/js/register.js - Protected page
public/js/loggedin.js
API and routing
- Express API
api/index.ts - Book routes
src/routes/bookRoutes.ts - Review routes
src/routes/reviewRoutes.ts - Auth routes
src/routes/auth.ts - User routes
src/routes/user.ts - Greeting routes
src/routes/greetings.ts - Greeting handler
src/controllers/greetingController.ts
Books and reviews
- Book operations
src/controllers/bookController.ts - Review operations
src/controllers/reviewController.ts - Book model
src/models/book.ts - Review model
src/models/review.ts
Accounts and access
- Authentication
src/controllers/authController.ts - User operations
src/controllers/userController.ts - Token verification
src/middleware/verifyToken.ts - User model
src/models/user.ts
Other components
- Browser user
- MongoDB
Connections 40
- Browser user → Static web client: uses
README.md - Express API → Static web client: serves static files
api/index.ts - Static web client → Book listing: includes
README.md - Static web client → Book details: includes
README.md - Static web client → Review display and form: includes
README.md - Browser user → Book listing: browses
README.md - Browser user → Book details: selects book
README.md - Browser user → Review display and form: submits review
README.md - Browser user → Login page: signs in
- Browser user → Registration page: registers
- Browser user → Protected page: opens protected page
- Book listing → Express API: requests books
- Book details → Express API: requests book
README.md - Review display and form → Express API: requests reviews
README.md - Login page → Express API: authenticates
- Registration page → Express API: registers account
- Protected page → Express API: requests protected content
- Express API → Book routes: mounts /api/books
api/index.ts - Express API → Review routes: mounts /api/reviews
api/index.ts - Express API → Auth routes: mounts /api/auth
api/index.ts - Express API → User routes: mounts /api/users
api/index.ts - Express API → Greeting routes: mounts /api/greetings
api/index.ts - Book routes → Book operations: dispatches
src/routes/bookRoutes.ts - Review routes → Review operations: dispatches
src/routes/reviewRoutes.ts - Auth routes → Authentication: dispatches
src/routes/auth.ts - User routes → User operations: dispatches
src/routes/user.ts - Greeting routes → Greeting handler: dispatches
src/routes/greetings.ts - Book routes → Token verification: protects mutations
src/routes/bookRoutes.ts - Review routes → Token verification: protects mutations
src/routes/reviewRoutes.ts - User routes → Token verification: uses token check
src/routes/user.ts - Greeting routes → Token verification: uses token check
src/routes/greetings.ts - Book operations → Book model: queries
src/controllers/bookController.ts - Review operations → Review model: queries
src/controllers/reviewController.ts - Review operations → Book model: checks book
src/controllers/reviewController.ts - Authentication → User model: queries and creates
src/controllers/authController.ts - User operations → User model: manages users
src/controllers/userController.ts - Express API → MongoDB: connects
api/index.ts - Book model → MongoDB: stores books
README.md - Review model → MongoDB: stores reviews
README.md - User model → MongoDB: stores users
README.md