How jubairanjumrony/parcelify works
Project Type and Purpose
• This is a full-stack MERN (MongoDB, Express.js, React, Node.js) Parcel Management System.
• Purpose: allow users to book parcels, admins to assign them, and delivery personnel to update statuses, with real-time tracking, payments via Stripe, and Firebase-based authentication.
File Structure
• Top level separates Client-Side (React) and Server-Side (Node/Express).
• Client-Side/src: React components split into Shared, Layouts, Pages, Providers, Routes, hooks, and Firebase config.
• Server-Side: index.js, package.json – a single Express app likely connecting to MongoDB and exposing REST endpoints.
• Config files: vite.config.js (frontend build), eslint.config.js (linting), .gitignore, .env references in README.
README Insights
• Tech stack calls out React Router, Axios, TailwindCSS, React Query, ApexCharts on front end; Express, MongoDB on back end; Firebase Auth; Stripe for payments.
• Features emphasize role-based routing (AdminRoute, PrivateRoute, DeliveryMenRoute), real-time data fetch (React Query), real-time map integration (external service), data visualization (ApexCharts), notifications, and responsive UI.
Main Components
a. Frontend (React App)
• Components: Shared UI (Navbar, Footer, Spinner), Pages (Home, Login, SignUp, Dashboard variants), Layouts (Main, Dashboard), Providers (Auth), Routes (Public, Private, Role-based).
• State & Data Layer: React Query for server interaction, Axios clients (public & secure), Firebase SDK for auth.
b. Backend (Express API)
• REST API endpoints for users, parcels, assignments, payments, statistics.
• Middleware: JWT validation or Firebase token verification, role checks.
• Third-party integrations: Stripe webhooks, Firebase Admin (if used).
c. Database
• MongoDB collections: users, parcels, payments, delivery assignments, logs.
d. External Services
• Firebase Authentication service (Auth flow).
• Stripe Payment Gateway (client-side stripe.js & server webhook).
• (Optional) Map provider API for live map integration.
Relationships & Data Flows
• User Browser ↔ React UI ↔ React Query/Axios ↔ Express API
• Express API ↔ MongoDB (CRUD)
• React UI ↔ Firebase Auth (login/signup/token)
• React UI ↔ Stripe Elements for checkout ↔ Stripe API
• Express API ↔ Stripe Webhooks (listen for payment events)
• Express API ↔ (Optional) Map API for geocoding/directions
Architectural Patterns & Principles
• Separation of concerns: UI vs business logic vs data persistence.
• Role-based routing and access control in both client (Routes) and server (middleware).
• React Query for caching and real-time updates.
• Component-based React architecture: Shared, Layouts, Pages.
• RESTful API design on backend.
• Environment config (.env) for secrets.
• Labels for each component (e.g., “ParcelController”, “AuthProvider”, “useAxiosSecure”).
• Optional: annotate protocols (HTTP/HTTPS, WebSocket if real-time used) and ports.