How joshibhaskar684/e-commerece-frontend works
1. Overall shape
- This is a Next.js App Router storefront organized around route segments under src/app.
- The repository is split into route-level pages/layouts, shared UI components, and a Redux-based client state layer.
- The architecture is front-end heavy: there is no obvious full backend in the tree beyond a few Next.js API routes for logout.
2. Route hierarchy and shell
- src/app/layout.js and src/app/globals.css define the global application shell and styling baseline.
- src/app/(public)/layout.jsx provides the main public-site frame, while src/app/(public)/(account)/layout.jsx wraps authenticated account pages.
- This separation suggests two major UI boundaries: public storefront browsing and signed-in account management.
3. Public storefront pages
- The public area includes the home page, product listing, product detail, search, and policy pages.
- Key routes:
- / via src/app/(public)/page.jsx
- /products and /products/[productid]
- /search
- /policy/privacy and /policy/terms
- This is the primary customer-facing navigation surface.
4. Product browsing and catalog flow
- Product-related route code lives in src/app/(public)/products.
- products.js appears to be the local catalog/source data used by the product pages.
- Supporting components under src/components/Products handle:
- product cards
- empty-state cards
- loading skeletons
- sidebar filters and sort options
- product detail hero sections
- The data flow is likely: catalog data → Redux products state / route page → product list/detail components → filters/sort UI.
5. Search and discovery
- src/app/(public)/search/page.jsx is a dedicated discovery route.
- Search/filtering is reinforced by the product sidebar components and by reusable list/card components.
- The architecture suggests that search results are rendered as another view over the same catalog, not a separate subsystem.
6. Account area
- The account section is grouped under src/app/(public)/(account)/account.
- Pages include:
- /account/cart
- /account/orders
- /account/orders/[orderId]
- /account/profile
- /account/wishlist
- These pages represent the user’s post-login workspace and likely depend heavily on Redux state for cart, user, orders, and wishlist.
7. State management boundary
- Global application state is centralized in src/redux-store.
- Slices exist for:
- cart
- user
- products
- wishList
- order
- checkout
- address
- Categories
- Each slice has its own action.js, actiontype.js, and reducer.js, with store.js assembling the root store and ReduxProvider exposing it to the app.
- This is the main data orchestration layer connecting UI, catalog data, checkout state, and user/account state.
8. Likely data flow through Redux
- UI components dispatch actions to mutate local app state and trigger async loading.
- Product browsing, cart management, wishlist updates, checkout, and order views are all modeled as separate state domains instead of being embedded in individual screens.
- That means the key architectural diagram should show route components consuming Redux slices, rather than each page owning its own isolated state.
9. Component organization
- Shared UI is grouped by feature under src/components, not by technical layer.
- Major feature folders include:
- Home for hero/category/collection sections
- Navbar for navigation and search
- Modal and ModalAi for overlays
- Cart, Orders, Products for commerce flows
- Login and signup for auth screens
- Footer for site-wide chrome
- This reflects a feature-first component architecture that maps directly to user journeys.
10. Home page composition
- The home screen is assembled from modular sections in src/components/Home/HomeComponent.
- There are multiple category/collection feature blocks such as:
- hero carousel
- featured
- collections
- category section
- product-themed sections like women’s, men’s, saree, cooking essentials, and smartphones
- This implies the home page is a merchandising surface composed from reusable content modules, not a single monolithic page.
11. Authentication and session handling
- Login, signup, and auth modal components exist, but the backend contract is intentionally thin in the visible tree.
- src/app/api/logout/route.js, logout-admin/route.js, and an extra logout copy route indicate server-side session termination endpoints within Next.js.
- The README mentions JWT authentication and protected routes, so the session boundary is likely handled through token-based auth plus route protection logic.
12. Routing protection and request mediation
- src/proxy.js suggests route-level request interception or middleware-style guarding.
- Combined with account layouts and logout routes, this implies protected account areas and session-aware navigation without a separate backend gateway in the repo.
13. SEO and platform metadata
- src/app/robots.js and src/app/sitemap.js show explicit SEO support.
- src/app/not-found.js handles the error boundary for missing routes.
- These are important architectural pieces because the app is intended to be indexable and production-deployable as a storefront.
14. Technology and deployment posture
- The repo is built for Next.js + React with Redux Toolkit state management, and the README calls out SSR, responsive UI, and deployment on Vercel/Netlify/custom server.
- Styling appears to use Tailwind/CSS modules/PostCSS based on the config files.
- Overall, the architecture is a single Next.js frontend application with routed pages, Redux-managed commerce state, and small API endpoints for session/logout rather than a large standalone backend.
Main entry points: (public)/layout.jsx Public layout · store.js Store · (account)/layout.jsx Account layout · layout.js Root layout
Components 34
App shell
Global Next.js shell, metadata, and request gating
- Root layout · Global app shell and providers entry
src/app/layout.js - Global styles · Application-wide styling foundation
src/app/globals.css - Route proxy · Request interception and route protection
src/proxy.js - Not found · Fallback for missing routes
src/app/not-found.js - Robots · Crawler directives
src/app/robots.js - Sitemap · Site index generation
src/app/sitemap.js
Public store
Browsing and discovery routes for the storefront
- Public layout · Main storefront frame
src/app/(public)/layout.jsx - Home · Merchandising landing page
src/app/(public)/page.jsx - Products layout · Catalog route frame
src/app/(public)/products/layout.jsx - Products · Product listing and filtering view
src/app/(public)/products/page.jsx - Product detail · Single product page
src/app/(public)/products/[productid]/page.jsx - Search · Catalog search results view
src/app/(public)/search/page.jsx - Privacy · Privacy policy route
src/app/(public)/policy/privacy/page.jsx - Terms · Terms policy route
src/app/(public)/policy/terms/page.jsx
Account area
Signed-in customer workspace
- Account layout · Authenticated account frame
src/app/(public)/(account)/layout.jsx - Cart · Basket and checkout entry point
src/app/(public)/(account)/account/cart/page.jsx - Orders · Order history listing
src/app/(public)/(account)/account/orders/page.jsx - Order detail · Single order view
src/app/(public)/(account)/account/orders/[orderId]/page.jsx - Profile · Customer profile settings
src/app/(public)/(account)/account/profile/page.jsx - Wishlist · Saved items view
src/app/(public)/(account)/account/wishlist/page.jsx
Redux state
Centralized client state and store wiring
- Redux provider · Exposes app state to React tree
src/redux-store/ReduxProvider/ReduxProvider.js - Store · Root store assembly
src/redux-store/store.js - Products slice · Catalog and product state
src/redux-store/products - Cart slice · Cart state and mutations
src/redux-store/cart - User slice · Auth and account state
src/redux-store/user - WishList slice · Saved item state
src/redux-store/wishList - Order slice · Orders and order details
src/redux-store/Order - Checkout slice · Checkout workflow state
src/redux-store/checkout - Address slice · Shipping address state
src/redux-store/address - Categories slice · Category browsing state
src/redux-store/Categories
Shared components
Feature-first reusable UI modules
- Home modules · Composed home page sections
src/components/Home/MainHomePage.jsx - Navbar · Top-level navigation and search
src/components/Navbar/page.jsx - Footer · Global footer component
src/components/Footer/page.jsx - Product list · Reusable product listing view
src/components/UniversalComponnets/ProductListComponent/ProductListComponent.jsx
Connections 46
- Root layout → Redux provider: wraps · Makes the store available to all routes
- Root layout → Global styles: loads · Applies global styling
- Root layout → Public layout: renders · Entrypoint into the storefront route tree
- Root layout → Robots: serves · SEO metadata endpoints
- Root layout → Sitemap: serves · SEO metadata endpoints
- Root layout → Not found: falls back to · Handles missing routes
- Public layout → Navbar: contains · Shared storefront navigation
- Public layout → Footer: contains · Shared storefront footer
- Public layout → Home: frames · Public browsing surfaces
- Public layout → Products layout: nests · Catalog route subtree
- Public layout → Account layout: nests · Authenticated account subtree
- Public layout → Search: routes to · Discovery view
- Public layout → Privacy: routes to · Policy page
- Public layout → Terms: routes to · Policy page
- Products layout → Products: frames · Catalog listing route
- Products layout → Product detail: frames · Single-product route
- Products → Product list: uses · Renders catalog results
- Products → Products slice: reads · Consumes catalog state
- Products → Categories slice: filters by · Category-driven browsing
- Product detail → Products slice: reads · Looks up the selected product
- Search → Product list: uses · Displays search results with shared list UI
- Home → Home modules: composes · Assembles merchandised sections
- Home → Categories slice: reads · Category landing content
- Account layout → Cart: contains · Customer workspace routes
- Account layout → Orders: contains · Customer workspace routes
- Account layout → Order detail: contains · Customer workspace routes
- Account layout → Profile: contains · Customer workspace routes
- Account layout → Wishlist: contains · Customer workspace routes
- Cart → Cart slice: reads · Cart state drives the view
- Cart → Checkout slice: advances to · Checkout handoff
- Cart → Address slice: uses · Shipping information
- Orders → Order slice: reads · Shows order history
- Order detail → Order slice: reads · Shows one order
- Profile → User slice: reads · Account profile state
- Wishlist → WishList slice: reads · Saved items state
- Redux provider → Store: provides · Binds the root store to React
- Store → Products slice: combines · Root reducer domain
- Store → Cart slice: combines · Root reducer domain
- Store → User slice: combines · Root reducer domain
- Store → WishList slice: combines · Root reducer domain
- Store → Order slice: combines · Root reducer domain
- Store → Checkout slice: combines · Root reducer domain
- Store → Address slice: combines · Root reducer domain
- Store → Categories slice: combines · Root reducer domain
- Route proxy → Account layout: protects · Gatekeeping for authenticated areas
- Route proxy → User slice: depends on · Session-aware routing