How legialam-gif/ecogreen-ecommerce works
EcoGreen is a Vietnamese storefront and admin UI for an eco-products shop, backed by a Spring Boot REST API (not included in the supplied tree). The customer journey runs from catalogue browsing and account/cart use through checkout, simulated payment, order tracking and returns; staff manage products, categories, orders, returns, users and sales reporting. The graph focuses on frontend runtime responsibilities and its REST boundary. Some connections are based on explicit README or SOURCE INDEX references; unsampled feature internals are represented at their exact directory paths.
Main entry points: App.jsx Routes and shell · orderApi.js Order API · Checkout.jsx Checkout · AuthContext.jsx Session context
Components 26
Storefront
- Product catalogue
frontend/src/pages/Home.jsx - Product details
frontend/src/pages/ProductDetail.jsx - Shopping cart
frontend/src/pages/Cart.jsx - Server cart state
frontend/src/context/CartContext.jsx - Help and policies
frontend/src/pages
Customer accounts
- Sign in / register
frontend/src/pages/Login.jsx - Session context
frontend/src/context/AuthContext.jsx - Token storage
frontend/src/services/authStorage.js - Google sign-in
frontend/src/services/googleAuth.js - Address book
frontend/src/pages/Addresses.jsx
Order fulfillment
- Checkout
frontend/src/pages/Checkout.jsx - Order history
frontend/src/pages/Orders.jsx - Order details / returns
frontend/src/pages/OrderDetail.jsx - Simulated payment
frontend/src/pages/Payment.jsx - Payment return
frontend/src/pages/PaymentReturn.jsx
Administration
- Admin workspace
frontend/src/pages/admin/AdminDashboard.jsx - Sales reporting
frontend/src/pages/admin/SalesDashboard.jsx
Shared frontend
- Routes and shell
frontend/src/App.jsx - Cart API
frontend/src/services/cartApi.js - Order API
frontend/src/services/orderApi.js - Payment API
frontend/src/services/paymentApi.js - Admin API services
frontend/src/services - HTTP client / refresh
frontend/src/services/http.js
Other components
- Shopper / staff
- Spring REST API
- PostgreSQL
Connections 41
- Shopper / staff → Routes and shell: navigates
frontend/src/App.jsx - Routes and shell → Product catalogue: routes to
frontend/src/App.jsx - Routes and shell → Product details: routes to
frontend/src/App.jsx - Routes and shell → Shopping cart: routes to
frontend/src/App.jsx - Routes and shell → Sign in / register: routes to
frontend/src/App.jsx - Routes and shell → Checkout: protects route
frontend/src/App.jsx - Routes and shell → Simulated payment: protects route
frontend/src/App.jsx - Routes and shell → Payment return: protects route
frontend/src/App.jsx - Routes and shell → Order history: protects route
frontend/src/App.jsx - Routes and shell → Order details / returns: protects route
frontend/src/App.jsx - Routes and shell → Address book: protects route
frontend/src/App.jsx - Routes and shell → Admin workspace: admin route
frontend/src/App.jsx - Routes and shell → Help and policies: routes to
frontend/src/App.jsx - Product catalogue → Spring REST API: fetches catalogue
README.md - Product details → Spring REST API: fetches product
README.md - Shopping cart → Server cart state: uses cart
frontend/src/pages/Cart.jsx - Server cart state → Cart API: fetches and updates
frontend/src/context/CartContext.jsx - Sign in / register → Session context: signs in
frontend/src/pages/Login.jsx - Sign in / register → Google sign-in: requests ID token
frontend/src/pages/Login.jsx - Session context → Token storage: stores session
frontend/src/context/AuthContext.jsx - Session context → Spring REST API: validates session
README.md - Google sign-in → Session context: passes ID token
frontend/src/services/googleAuth.js - Address book → Spring REST API: manages addresses
README.md - Checkout → Order API: previews and submits
frontend/src/pages/Checkout.jsx - Checkout → Address book: selects address
frontend/src/pages/Checkout.jsx - Checkout → Server cart state: resets after checkout
frontend/src/context/CartContext.jsx - Order API → Spring REST API: sends order requests
frontend/src/services/orderApi.js - Simulated payment → Order API: loads order
frontend/src/pages/Payment.jsx - Simulated payment → Payment API: manages payment
frontend/src/pages/Payment.jsx - Payment return → Payment API: checks payment
frontend/src/pages/PaymentReturn.jsx - Payment API → Spring REST API: sends payment requests
frontend/src/services/paymentApi.js - Order history → Order API: loads history
- Order details / returns → Order API: loads and cancels
frontend/src/pages/OrderDetail.jsx - Order details / returns → Admin API services: requests returns
frontend/src/pages/OrderDetail.jsx - Admin workspace → Admin API services: manages shop data
frontend/src/pages/admin/AdminDashboard.jsx - Admin workspace → Sales reporting: renders dashboard
frontend/src/pages/admin/AdminDashboard.jsx - Sales reporting → Admin API services: loads reports
frontend/src/pages/admin/SalesDashboard.jsx - Admin API services → HTTP client / refresh: uses client
frontend/src/services/orderApi.js - Cart API → HTTP client / refresh: uses client
- HTTP client / refresh → Spring REST API: sends authenticated requests
frontend/src/services/http.js - Spring REST API → PostgreSQL: reads and writes
README.md