How rohan-shridhar/trashtrace works
TrashTrace is a QR-scan-based waste-shipment tracking application. Owners enter package, destination, and source GPS details; the backend geocodes the destination and registers a shipment, and the frontend presents its tracking QR code. A courier scans it, shares device location, and the backend records scan history, compares distance to the destination, updates delivery status, and may notify the owner. The dashboard aggregates owned shipments and notifications. Links among sampled modules are grounded in source excerpts or README documentation; unsampled internals are represented only where the README documents their capability.
Main entry points: trashRoutes.js Shipment routes · TrackShipment.jsx Shipment tracking · routes.jsx Page routing · CreateShipment.jsx Create shipment
Components 24
Web experience
- React app
frontend/src/app/App.jsx - Page routing
frontend/src/app/routes.jsx - Owner dashboard
frontend/src/pages/Dashboard/Dashboard.jsx - Device owner token
frontend/src/utils/owner.js - JSON API client
frontend/src/utils/api.js
Shipment lifecycle
- Create shipment
frontend/src/pages/CreateShipment/CreateShipment.jsx - QR code card
frontend/src/components/qr/QRCodeCard.jsx - Shipment tracking
frontend/src/pages/TrackShipment/TrackShipment.jsx - QR scan page
frontend/src/pages/ScanQR/ScanQR.jsx - Browser geolocation
frontend/src/utils/geolocation.js - Scan timeline
frontend/src/components/shipment/ShipmentTimeline.jsx - Delivery progress
frontend/src/components/shipment/ShipmentProgress.jsx
API and services
- Express API
backend/api/index.js - Shipment routes
backend/routes/trashRoutes.js - Notification routes
backend/routes/notificationRoutes.js - Address geocoder
backend/utils/geocoder.js - Distance calculator
backend/utils/distance.js
Persistence
- Mongo connection
backend/config/db.js - Shipment records
backend/models/Trash.js - Scan records
backend/models/Scan.js - Notifications
backend/models/Notification.js
Other components
- Owner
- Courier
- Nominatim
Connections 29
- Owner → React app: uses
README.md - Courier → React app: opens QR link
README.md - React app → Page routing: renders
frontend/src/app/App.jsx - Page routing → Create shipment: routes to
frontend/src/app/routes.jsx - Page routing → Shipment tracking: routes to
frontend/src/app/routes.jsx - Page routing → QR scan page: routes to
frontend/src/app/routes.jsx - Page routing → Owner dashboard: routes to
frontend/src/app/routes.jsx - Create shipment → Browser geolocation: gets GPS
frontend/src/pages/CreateShipment/CreateShipment.jsx - Create shipment → Device owner token: gets token
frontend/src/pages/CreateShipment/CreateShipment.jsx - Create shipment → JSON API client: submits shipment
frontend/src/pages/CreateShipment/CreateShipment.jsx - Create shipment → QR code card: renders QR
frontend/src/pages/CreateShipment/CreateShipment.jsx - Shipment tracking → JSON API client: requests tracking
frontend/src/pages/TrackShipment/TrackShipment.jsx - Shipment tracking → Browser geolocation: gets scan GPS
frontend/src/pages/TrackShipment/TrackShipment.jsx - Shipment tracking → Scan timeline: renders history
frontend/src/pages/TrackShipment/TrackShipment.jsx - Shipment tracking → Delivery progress: renders status
frontend/src/pages/TrackShipment/TrackShipment.jsx - QR scan page → Shipment tracking: links to tracking
README.md - Owner dashboard → Device owner token: gets token
frontend/src/pages/Dashboard/Dashboard.jsx - Owner dashboard → JSON API client: loads packages
frontend/src/pages/Dashboard/Dashboard.jsx - JSON API client → Express API: sends requests
README.md - Express API → Mongo connection: connects
backend/api/index.js - Express API → Shipment routes: mounts routes
backend/api/index.js - Express API → Notification routes: mounts routes
backend/api/index.js - Shipment routes → Address geocoder: geocodes address
backend/routes/trashRoutes.js - Shipment routes → Distance calculator: calculates distance
README.md - Shipment routes → Shipment records: reads and writes
backend/routes/trashRoutes.js - Shipment routes → Scan records: records scans
backend/routes/trashRoutes.js - Shipment routes → Notifications: creates alerts
backend/routes/trashRoutes.js - Notification routes → Notifications: reads and updates
backend/routes/notificationRoutes.js - Address geocoder → Nominatim: geocodes
README.md