How ahmedhamdiy/sanay3yonthego works
Project Type & Purpose
• This is a full-stack service network application built using the PERN stack (PostgreSQL, Express.js, React, Node.js). It enables three primary user classes (Customers, Technicians, and Admins) to interact with the system.
• The project allows customers to request technician services, technicians to manage and respond to orders, and admins to oversee operations and manage issues like complaints and feedback.
Main Components
a. Client (Frontend):
• The Client folder holds a React application that is subdivided into separate views based on user roles:
• AdminView: Contains components, routes, and styles for admin functionalities (e.g., AdminAccount, NavBarAdmin, service management pages).
• CustView: Contains routes and components for customers (e.g., AccountDetails, OrderList, ComplaintForm, review and feedback interfaces).
• TechView: Contains components and routes tailored for technicians (e.g., OrdersList, UploadOffer, Profile, ratings, etc.).
• UserView: Handles user login and profile management.
b. Server (Backend):
• The Server folder contains the Node.js/Express server.
• Key subcomponents include:
• Configuration (e.g., DB.js to connect to PostgreSQL).
• Controllers: Divided into general controllers (OrderController, UserController) and “minor” controllers handling specific domains such as Bundles, Complaints, Feedback, Notifications, Offers, Rewards, and Services.
• Routes: Organized similarly with separate route definitions for “minor” endpoints and dedicated routes for orders and user management.
• Helpers: Utility functions (e.g., GenHelper.js) that support various controller operations.
• It’s important to show how these controllers and routes form the server’s API layer that handles HTTP requests from the client.
c. Database:
• PostgreSQL database (created using the CreateDB.sql script) which stores persistent data for users, orders, complaints, feedback, and possibly technician work details.
Relationships and Interactions
• The server processes incoming requests through its controllers and routes, interacts with the PostgreSQL database to execute queries or store data, and then sends responses back to the client.
Architectural Patterns and Design Principles
• Separation of concerns:
• Frontend separates concern via multiple view modules (AdminView, CustView, TechView, etc.) offering role-based interfaces.
• Backend is modularized into controllers, routes, and configuration.
• RESTful API-based communication between Client and Server.
• Layered architecture: Presentation layer (React UI) → Business Logic/API layer (Express controllers/routes) → Data layer (PostgreSQL).
Additional Details
• Data flow that begins at the user interface, passes through API endpoints, and ends with database operations, then is returned back as application responses.