How kameshwar736/ecommerce-site works
Purpose and Runtime
SHOP.CO is a client-facing e-commerce storefront built with Next.js 16 App Router, React, Tailwind CSS, and React Context. It presents a static local product catalog, supports browsing/filtering/detail views, and maintains a browser-persisted cart via LocalStorage. Static media is served from public/products, public/images, and public/icons; no backend, database, payment provider, or external commerce API is represented.
Application Entry and Shell
The App Router routes are rooted in src/app/layout.js, which establishes the shared application shell and global styling from src/app/globals.css. Shared chrome is decomposed into navigation, promotional banner, newsletter, and footer components: src/components/layout/Navbar.jsx, src/components/layout/TopBanner.jsx, and src/components/layout/Footer.jsx.
Route-Level Experience
The home route at src/app/page.js composes marketing and product-discovery sections, notably src/components/home/Hero.jsx, src/components/home/NewArrival.jsx, and src/components/home/TopSelling.jsx. Browsing occurs at src/app/category/page.js; the dynamic product-detail boundary is src/app/product/[id]/page.js, where an ID selects a catalog item. Cart review and modification is isolated to src/app/cart/page.js. Missing routes/items are handled by src/app/notFound.js.
Catalog and Product Discovery
Local catalog records originate in src/data/products.js, with supporting style/testimonial datasets in src/data/dressStyle.js and src/data/testimonialData.js. Category browsing couples src/components/category/FilterSidebar.jsx for filter controls with src/components/category/ProductGrid.jsx for responsive, paginated results. The primary flow is catalog data → product context/filter state → grid/detail links; filtering remains frontend-only rather than querying a service.
Shared State Boundaries
src/contexts/ProductContext.jsx provides product-oriented shared state to home, category, and detail surfaces. src/contexts/CartContext.jsx owns cart mutations, quantities, and LocalStorage synchronization. This is the main client-state boundary: product selection and cart actions propagate through React Context rather than server actions or an API layer.
Product-to-Cart Flow
A user selects a product from category or home listings, navigates to src/app/product/[id]/page.js, chooses variant-related options and quantity, then adds it through cart context. Cart rendering is divided among src/components/carts/CartItems.jsx for line-item updates/removal, src/components/carts/OrderSummary.jsx for totals, and src/components/carts/CouponForm.jsx for coupon UI. There is no checkout or payment execution boundary.
Deployment and Assets
The project is configured as a standard Next.js application through next.config.mjs and is demonstrated on Vercel. Product imagery and UI assets are repository-managed under public/products, public/images, and public/icons, making the application deployable without an asset CDN or runtime content dependency.
Main entry points: layout.js Root Layout · cart/page.js Cart · CartContext.jsx Cart Context · [id]/page.js Product Detail
Components 20
App Router
Route entry points and shared shell.
- Root Layout · Establishes shared shell and global styling.
src/app/layout.js - Global Styles
src/app/globals.css - Shared Chrome · Navigation, promotion banner, newsletter, and footer.
src/components/layout/Navbar.jsx - Home · Marketing and product discovery landing page.
src/app/page.js - Category Browse
src/app/category/page.js - Product Detail · Selects a catalog item by product ID.
src/app/product/[id]/page.js - Cart · Cart review and modification surface.
src/app/cart/page.js - Not Found · Handles missing routes or catalog items.
src/app/notFound.js - Home Sections · Hero, new arrivals, and top-selling sections.
src/components/home/Hero.jsx
Catalog Discovery
Local catalog and browsing state.
- Product Catalog · Static product records used throughout the storefront.
src/data/products.js - Product Context · Shares product-oriented selection and filter state.
src/contexts/ProductContext.jsx - Filter Sidebar · Frontend-only filter controls.
src/components/category/FilterSidebar.jsx - Product Grid · Responsive paginated catalog results and detail links.
src/components/category/ProductGrid.jsx
Cart State
Browser-persisted cart workflow.
- Cart Context · Owns cart mutations, quantities, and persistence.
src/contexts/CartContext.jsx - Browser LocalStorage · Persists cart state on the client.
- Cart Items · Updates quantities and removes line items.
src/components/carts/CartItems.jsx - Order Summary · Calculates and displays cart totals.
src/components/carts/OrderSummary.jsx - Coupon Form · Coupon UI only; no checkout execution.
src/components/carts/CouponForm.jsx
Static Assets
Repository-managed storefront media.
- Static Media · Product imagery and UI assets served locally.
public/products - Next.js Config · Standard Next.js application configuration.
next.config.mjs
Connections 25
- Root Layout → Global Styles: loads
- Root Layout → Shared Chrome: composes
- Root Layout → Home: hosts route
- Root Layout → Category Browse: hosts route
- Root Layout → Product Detail: hosts route
- Root Layout → Cart: hosts route
- Home → Home Sections: composes
- Home Sections → Product Catalog: features products
- Category Browse → Filter Sidebar: renders
- Category Browse → Product Grid: renders
- Product Catalog → Product Context: supplies catalog
- Product Context → Filter Sidebar: drives filters
- Product Context → Product Grid: supplies results
- Product Grid → Product Detail: links by ID
- Product Detail → Product Catalog: looks up item
- Product Detail → Cart Context: adds product
- Cart Context → Browser LocalStorage: synchronizes
- Cart → Cart Items: renders
- Cart → Order Summary: renders
- Cart → Coupon Form: renders
- Cart Context → Cart Items: provides cart state
- Cart Context → Order Summary: provides totals input
- Home Sections → Static Media: uses
- Product Grid → Static Media: renders imagery
- Next.js Config → Root Layout: configures application