How adaezeowunna21/hair-hub-backend-api-development works
Hair Hub is an Express API for hair-care users and catalog content. A client sends requests to the API entry point, which dispatches resource routes to controllers; controllers perform CRUD operations against Mongoose-backed collections. The product route is protected by JWT middleware, and user registration/login add password hashing and token issuance. Other documented API areas include categories, components, hairstyles, image metadata, and interactions. The graph reflects the shown entry-point wiring and module references; database connectivity details and some middleware behavior were not sampled.
Main entry points: index.js Express app · user.controller.js User operations · errorHandler.js Error handler · user.route.js User routes
Components 27
API platform
- Express app
index.js - JWT guard
middleware/verifyJWT.js - Error handler
middleware/errorHandler.js - Error logging
middleware/logEvents.js
User identity
- User routes
routes/user.route.js - User operations
controllers/user.controller.js - Users
models/users.model.js - Hash and token libraries
Catalog resources
- Product routes
routes/product.route.js - Product operations
controllers/product.controller.js - Products
models/products.model.js - Category routes
routes/category.route.js - Category operations
controllers/category.controller.js - Categories
models/categories.model.js - Component routes
routes/component.route.js - Component operations
controllers/component.controller.js - Components
models/components.model.js
Hair content
- Hairstyle routes
routes/hairstyle.route.js - Hairstyle operations
controllers/hairstyle.controller.js - Hairstyles
models/hairstyles.model.js - Image routes
routes/imagemetadata.route.js - Image metadata operations
controllers/imagemetadata.controller.js - Image metadata
models/images_metadata.model.js
Engagement
- Interaction routes
routes/interaction.route.js - Interaction operations
controllers/interaction.controller.js - Interactions
models/interactions.model.js
Other components
- API client
Connections 26
- API client → Express app: sends requests
- Express app → User routes: mounts routes
index.js - Express app → Product routes: mounts routes
index.js - Express app → Category routes: mounts routes
index.js - Express app → Component routes: mounts routes
index.js - Express app → Hairstyle routes: mounts routes
index.js - Express app → Image routes: mounts routes
index.js - Express app → Interaction routes: mounts routes
index.js - Express app → JWT guard: guards products
index.js - Express app → Error handler: handles errors
index.js - User routes → User operations: dispatches to
routes/user.route.js - User operations → Users: reads and writes
controllers/user.controller.js - User operations → Hash and token libraries: hashes and signs
controllers/user.controller.js - Product routes → Product operations: dispatches to
routes/product.route.js - Product operations → Products: reads and writes
controllers/product.controller.js - Category routes → Category operations: dispatches to
routes/category.route.js - Category operations → Categories: reads and writes
controllers/category.controller.js - Component routes → Component operations: dispatches to
routes/component.route.js - Component operations → Components: reads and writes
controllers/component.controller.js - Hairstyle routes → Hairstyle operations: dispatches to
routes/hairstyle.route.js - Hairstyle operations → Hairstyles: reads and writes
controllers/hairstyle.controller.js - Image routes → Image metadata operations: dispatches to
routes/imagemetadata.route.js - Image metadata operations → Image metadata: reads and writes
controllers/imagemetadata.controller.js - Interaction routes → Interaction operations: dispatches to
routes/interaction.route.js - Interaction operations → Interactions: reads and writes
controllers/interaction.controller.js - Error handler → Error logging: records errors
middleware/errorHandler.js