How yashchhatrala25/dreamland_shop_using_react_typescript works
Project type and purpose
• This is a single-page e-commerce frontend built with React + TypeScript.
• It consumes a dummyjson REST API to display products, categories, and supports searching, filtering, pagination, and product detail pages.
File structure
• Top-level:
• index.html – HTML entry point
• vite.config.ts – Vite build/dev server config
• package.json / package-lock.json – dependencies and scripts
• tsconfig*.json – TypeScript compiler configs
• src/
• main.tsx – React DOM mounting and root providers
• App.tsx – Root React component with router setup
• index.css – global styles
• components/ – all UI components and context:
– FilterContext.tsx – global filter state provider
– Sidebar.tsx – category & price filters
– MainContent.tsx – product grid & pagination
– BookCard.tsx – individual product card
– PopularBlogs.tsx, TopSellers.tsx – sidebar widgets
– ProductPage.tsx – detail view for one product
Key architectural insights from README
• Client-side routing via react-router-dom
• State management with React hooks & Context API
• External data source: dummyjson REST endpoints
a. Main components
• Browser/Client
• Static Host (Vite dev server or built files on Netlify)
• React App
– Root (index.html → main.tsx → App.tsx)
– Router layer
– UI components (Sidebar, MainContent, ProductPage, etc.)
– Context Provider (FilterContext)
• External API (dummyjson)
b. Relationships & data flow
1. Browser requests index.html / JS bundle from static host
2. Vite‐built bundle loads main.tsx → wraps <App> in <FilterContext.Provider>
3. <App> sets up <BrowserRouter>
4. Sidebar dispatches filter actions → updates context → triggers product fetch
5. MainContent uses current filters to call dummyjson API → updates UI
6. ProductPage fetches /products/:id on route change
7. PopularBlogs & TopSellers optionally fetch other endpoints or use demo data
c. Architectural patterns
• Component-based UI
• Single-page application (SPA)
• Context API for cross-cutting state (filters)
• Hook-based data fetching
• Client-side routing (react-router-dom)
d. Key technologies
• React + TypeScript
• Vite (build & dev server)
• react-router-dom (routing)
• dummyjson REST API
Essential elements
• Arrowheads to show request/response or data-update flows
• Callouts for any business logic (e.g. “Price range logic in Sidebar”)