How harsh-p30/tbpc works
Project type and purpose
• This is a single-page e-commerce storefront built entirely as a React/TypeScript frontend.
• It uses Vite for bundling/dev server, Tailwind CSS for styling, shadcn-ui for reusable UI primitives, and local data modules (e.g. productsData.js) or external APIs for product information.
File structure
• Top level: package.json, Vite/Tailwind/TypeScript configs → build & dev tooling
• public/ → static assets (robots.txt, index.html template)
• src/
• main.tsx → application entrypoint (mounts React <App/>)
• lib/ → shared utility functions
• hooks/ → custom React hooks (useMobile, useFilteredProducts, useToast, etc.)
• components/ → UI component library and domain-specific components
– ui/ → primitive components (button, modal, form, etc.) from shadcn-ui
– products/ → product-focused components & filtering logic
– layout & generic (Navbar, Footer, Hero, etc.)
• pages/ → route targets (Index, Products, Cart, ProductDetail, CategoryDetail, About, Contact, NotFound)
• No backend or API server code is present here—it’s purely a frontend application.
Key insights from README
• Confirms tech stack: Vite, TypeScript, React, shadcn-ui, Tailwind CSS
• Standard npm scripts for local dev (npm run dev) and build
• Deployed as static assets (no server-side rendering indicated)
Main components
A. Developer & SCM layer
• Developer workstation (IDE, git client) → Git repository
• CI/CD pipeline (optional) triggered on push
B. Build & Deployment layer
• Vite (dev server for localhost; build tool for production)
• Output: static JS/CSS assets + index.html
• Hosting/CDN (e.g. Netlify, Vercel, S3 + CloudFront)
C. Runtime layer (Browser)
• index.html → mounts React App
• App shell & Router (react-router-dom)
• Pages (src/pages/*)
• Components (src/components/*)
• Hooks & Utils (src/hooks, src/lib)
• UI primitives (shadcn-ui) + Tailwind CSS runtime
D. Data sources
• Local JSON/modules (productsData.js)
• Or external REST/GraphQL endpoints (if configured)
Relationships & interactions
• Developer → Git push → CI/CD → Vite build → Deploy → Hosting / CDN
• Browser requests index.html + static assets → React App starts
• User action → React Router → Page component
• Page component → uses custom hooks (e.g. useFilteredProducts) → util modules or API calls → returns data
• Data flows into Presentational Components (ProductCard, Carousel, Filters, etc.)
• UI primitives & Tailwind render visual elements
Architectural patterns & design principles
• Component-based architecture (atomic UI + domain components)
• Unidirectional data flow (React state/hooks → props → UI)
• Layered separation: Pages (routes) → Components (UI) → Hooks/Utils (logic) → Data
• Utility-first styling (Tailwind) + design system (shadcn-ui)