How ishaangautam9595/advertisement-backend works
Main Components
A. API Layer
• Routes into a "Routes Layer" showing endpoints for:
• Authentication (/auth)
• Users (/user)
• Products (/product)
• Categories (/category)
• SubCategories (/subcategory)
• Locations (/location)
• Roles (/role)
B. Middleware Layer
• Two key middleware components:
• Authentication middleware (auth.js)
• Validation middleware (validator.js)
C. Controller Layer
• Controllers that handle business logic:
• AuthController
• UserController
• ProductController
• CategoryController
• SubCategoryController
• LocationController
• RoleController
D. Model Layer
• Database models:
• User
• Product
• ProductDetails
• Category
• SubCategory
• Location
• Order
• OrderItems
• PasswordReset
• UserAddress
• Role
E. Helper Services
• NodeMailer service for email functionality
• Client Requests (Top)
• ↓
• Routes Layer
• ↓
• Middleware Layer
• ↓
• Controllers Layer
• ↓
• Models Layer (Database Interaction)
Component Relationships
• Client → Routes
• Routes → Middleware
• Middleware → Controllers
• Controllers → Models
• Controllers ↔ Helper Services
Additional Elements
• A File Storage component for the 'uploads' directory
• Email service integration via NodeMailer
• Authentication flow with special emphasis on the auth middleware
• Database relationships between models (especially for orders-products, categories-subcategories)
Technical Details
• Node.js/Express.js as the main framework
• Database system (likely MongoDB based on the model structure)
• File upload system for the uploads directory
• Email service integration through NodeMailer
Notes
• A note about the seeding process (referencing the seeders directory)
• Configuration requirements
• Error handling flow
• Validation points in the system