How subhadip15/ecobazaarx works
Purpose and Entry Points
EcoBazaarX is a full-stack eco-commerce application: catalog, cart, wishlist, checkout/orders, addresses, admin product management, recommendations, and carbon insights. The React SPA starts at Frontend/src/index.js and composes routing/UI in Frontend/src/App.js. The Spring Boot API starts at Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/SignupFormApplication.java.
Client Application Boundary
The frontend is a React application whose pages represent customer and administrative flows, including catalog/detail, checkout, orders, insights, and administration. Shared navigation and protected navigation are centralized in Frontend/src/components/MainNavbar.jsx and Frontend/src/components/ProtectedRoute.jsx. API base configuration is isolated in Frontend/src/config/api.js, with service modules forming the browser-to-backend boundary, e.g. Frontend/src/services/api.js, Frontend/src/services/authService.js, and Frontend/src/services/orderService.js.
Client State and Commerce Flow
Cart and wishlist state are maintained as React contexts, allowing product pages, navbar, and cart/wishlist pages to share client-side state: Frontend/src/context/CartContext.jsx and Frontend/src/context/WishlistContext.jsx. A typical purchase path is catalog/detail → cart → checkout/payment → success/order history, represented by Frontend/src/pages/ProductCatalog.jsx, Frontend/src/pages/CheckoutPage.jsx, and Frontend/src/pages/OrderSuccess.jsx. Toast notifications are a separate cross-cutting UI context at Frontend/src/context/ToastContext.jsx.
API Layer and Authentication
Spring MVC controllers expose domain-oriented API entry points for authentication, products, carts, orders, insights, and administration: Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/controller/AuthController.java, Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/controller/OrderController.java, and Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/controller/AdminController.java. JWT authentication is enforced at the server boundary through Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/security/SecurityConfig.java, Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/security/JwtFilter.java, and Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/security/JwtUtil.java. Authentication includes registration, login, and the README-described forgotten-password/OTP capability via the auth and email service area.
Domain Services and Transactional Workflows
Controllers delegate business logic to services rather than directly owning persistence behavior. Key workflows include auth/user handling (Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/service/AuthService.java), cart mutation (Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/service/CartService.java), and checkout/order creation (Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/service/CheckoutService.java). Request/response DTOs establish the API contract and prevent exposing entities directly, notably Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/dto/auth/LoginRequest.java, Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/dto/order/CheckoutRequest.java, and Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/dto/product/ProductResponse.java.
Persistence and Core Model
The backend uses Spring Data-style repositories over a relational model, intended by the README to be MySQL. Core entities model users, products, carts, orders, shipping, addresses, and carbon data: Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/entity/Users.java, Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/entity/Order.java, and Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/entity/CarbonData.java. Persistence boundaries are represented by repositories such as Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/repository/UserRepository.java, Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/repository/OrderRepository.java, and Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/repository/ProductRepository.java.
Sustainability, Recommendations, and Integrations
Carbon calculation and insights are distinct backend capabilities, surfaced through dedicated controllers/services and persisted carbon entities: Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/service/CarbonCalculationService.java, Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/service/InsightsService.java, and Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/controller/InsightsController.java. Product recommendations are similarly isolated in Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/service/RecommendationService.java. External integration seams include email/OTP delivery through Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/service/EmailService.java and frontend Cloudinary media handling through Frontend/src/services/cloudinaryService.js.
Main entry points: App.js App routes and pages · OrderController.java Domain API controllers · OrderRepository.java Spring Data repositories · AuthService.java Auth and user service
Components 21
React client
- React entry
Frontend/src/index.js - App routes and pages · Customer and administrative flows are composed here.
Frontend/src/App.js - Navigation and route guard
Frontend/src/components/ProtectedRoute.jsx - Cart and wishlist state
Frontend/src/context/CartContext.jsx - Checkout and order flow · Catalog, checkout, success, and order history flow.
Frontend/src/pages/CheckoutPage.jsx - Toast notifications
Frontend/src/context/ToastContext.jsx - API service boundary · Config and domain service modules call the API.
Frontend/src/services/api.js - Cloudinary media client
Frontend/src/services/cloudinaryService.js
Spring Boot API
- Spring Boot entry
Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/SignupFormApplication.java - JWT security boundary · Filters protected requests and authenticates JWTs.
Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/security/SecurityConfig.java - Domain API controllers · Auth, product, cart, order, insights, and admin endpoints.
Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/controller/OrderController.java - Request and response DTOs · Keeps entities out of the public API.
Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/dto/order/CheckoutRequest.java - Auth and user service · Registration, login, and password recovery workflows.
Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/service/AuthService.java - Cart and checkout services · Cart mutation and transactional order creation.
Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/service/CheckoutService.java - Insights and recommendations · Carbon calculation, insights, and recommendations.
Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/service/CarbonCalculationService.java - Email and OTP service
Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/service/EmailService.java - Spring Data repositories · Repositories access user, product, and order data.
Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/repository/OrderRepository.java - Commerce relational model · Users, products, carts, orders, addresses, shipping, and carbon data.
Backend/SignupForm/SignupForm/src/main/java/com/SignupForm/entity/Order.java
External systems
- MySQL · Intended production datastore.
- Cloudinary
- Email delivery · Delivers OTP and recovery email.
Connections 22
- React entry → App routes and pages: mounts
- App routes and pages → Navigation and route guard: uses
- App routes and pages → Cart and wishlist state: shares state
- App routes and pages → Checkout and order flow: routes to
- App routes and pages → Toast notifications: notifies through
- App routes and pages → API service boundary: requests data
- App routes and pages → Cloudinary media client: handles media
- Cloudinary media client → Cloudinary: uploads media
- API service boundary → JWT security boundary: HTTP with JWT
- Spring Boot entry → JWT security boundary: configures
- JWT security boundary → Domain API controllers: authorizes requests
- Domain API controllers → Request and response DTOs: binds contracts
- Domain API controllers → Auth and user service: delegates auth
- Domain API controllers → Cart and checkout services: delegates commerce
- Domain API controllers → Insights and recommendations: delegates insights
- Auth and user service → Email and OTP service: sends OTP
- Email and OTP service → Email delivery: delivers via
- Auth and user service → Spring Data repositories: persists users
- Cart and checkout services → Spring Data repositories: persists carts and orders
- Insights and recommendations → Spring Data repositories: reads product and carbon data
- Spring Data repositories → Commerce relational model: maps
- Commerce relational model → MySQL: stored in