How arawns1/trabalho-react-hexbyte works
Project type and purpose
• This is a full-stack ecommerce application (frontend in React.js + Styled Components; backend in Spring Boot + PostgreSQL).
• The repository you have is the frontend “ecommerce” React project that serves as the client. It communicates with a separate Spring Boot API and persists data to Postgres.
File structure
• Top-level “ecommerce” directory is the React app:
• public/assets: static images & banners
• src: application source
– main.jsx & index.html: app bootstrap
– common/components: reusable UI modules (buttons, cards, modals, slider, header, etc.)
– common/hooks: useCart & useProducts (state & data fetching)
– common/services: api.js (HTTP client) & LocalStorage.js
– src/pages: route pages (Home, Cart, Login, SignUp, Payment, MyOrders, OrderComplete, Exceptions)
– routes/AllRoutes.jsx: React Router config
– Theme.jsx & global/GlobalStyle.jsx: styling setup
• No backend code here, but README says backend is Spring Boot + Postgres.
Key README insights
• Frontend stack: React.js + Styled Components
• Backend stack: Spring Boot + Postgres
• Live URL: https://loja-hexbyte.vercel.app/
Main components
a. Frontend (React)
– Browser / Client App
– Router layer (AllRoutes.jsx)
– UI Component Library (common/components)
– Page Components (src/pages/*)
– State & Data Layer (common/hooks & common/services)
– Styling Layer (Theme.jsx, GlobalStyle, styled-components)
b. Backend (Spring Boot)
– REST Controllers
– Service Layer
– Repository Layer (data access)
– Business Entities / DTOs
c. Database (PostgreSQL)
d. External Services (if any, e.g., payment gateway)
Interactions / Data flow
• User in Browser interacts with UI Pages → triggers actions/clicks
• Pages/components invoke hooks (useCart/useProducts)
• Hooks call api.js (configured axios) → HTTP request to Spring Boot API endpoints
• api.js handles responses → components update state
• LocalStorage.js persists cart data in client browser storage
• Spring Boot controllers accept requests → service layer applies business logic → repository persists/reads from Postgres
• Responses travel back to React → UI updates
Architectural patterns & principles
• Component-based UI (React + styled-components)
• Single Page Application (SPA) with client-side routing
• Separation of concerns:
• UI components vs. page containers
• Data fetching & caching hooks
• Service (api.js) as API abstraction
• Persistence (LocalStorage) isolated in a service
• Backend is layered (Controller → Service → Repository)
Details
• Related modules inside containers to show boundaries (e.g., “Frontend App”).