How shohan-nub/valorex-app works
1. This is a Next.js App Router ecommerce storefront with an embedded admin back office. The codebase is split between public shopping flows, authenticated account/order flows, and content management for products and media.
2. Routing is file-based under src/app, so the architecture is organized by page boundaries rather than feature modules. Major public routes include the home page, product detail pages, category listings, cart, checkout, login/signup, customer orders, and an auth callback endpoint. Dynamic routes are used for product IDs and category slugs.
3. The storefront layer is composed of reusable React components such as the navbar, footer, hero slideshow, category slideshow, product cards, promo popup, review section, and search modal. These are assembled into the landing page and supporting catalog pages to present the shopping experience.
4. The product browsing flow centers on catalog pages and product detail pages: users enter through the homepage or category pages, browse product cards and slideshows, then drill into products/[id] for an individual item. Search is handled via a modal component, suggesting client-side discovery layered over the catalog UI.
5. Cart state is handled in the app layer through Cartcontext.tsx, which acts as the shared client-side state boundary for cart interactions across product pages, cart, and checkout. That indicates the purchase funnel depends on a centralized in-memory/context store rather than page-local state.
6. Checkout and order history are separate concerns: checkout/page.tsx likely collects purchase details, while orders/page.tsx shows customer order records. There is also a server endpoint under api/meta/purchase, which suggests purchase events are emitted to an external tracking/marketing system during or after checkout.
7. Authentication and session handling are split from UI. The presence of login, signup, auth/callback/route.ts, and middleware.ts indicates a protected-route model where auth state is established through a callback route and enforced at the edge or request boundary via middleware. This likely gates account/order/admin access.
8. The admin subsystem is isolated under src/app/adminPanel with its own layout and pages for dashboard, products, product creation/editing, orders, hero slides, and review images. This is a distinct operational surface for managing storefront content and commerce data, separate from the customer-facing app.
9. The data/integration layer is anchored around Supabase and Cloudinary helpers in src/app/lib/supabase. The Supabase client/server split indicates both browser-side and server-side access paths, while the Cloudinary helper suggests image storage or media upload is externalized rather than kept in the Next.js app itself.
10. Marketing and analytics are treated as first-class integrations. FacebookPixel.tsx and lib/pixel.ts point to event tracking/advertising hooks, while the api/meta/purchase route likely posts purchase conversions. Combined with the hero/review/promo components, the app is optimized for conversion and retargeting.
11. Global app structure is handled by src/app/layout.tsx, globals.css, Tailwind config, and PostCSS config. That means styling and shell concerns are centralized, with page-specific content composed inside a shared app frame.
12. SEO and public-facing site infrastructure are also explicitly configured through robots.ts, sitemap.ts, and a Google verification file in public. This indicates the app is intended to be indexed as a commercial storefront, not just used behind authentication.
13. Static assets live in public, including imagery and verification artifacts. Together with the slideshow and review image management pages, this suggests the site blends fixed assets with admin-managed media content.
14. Overall, the architecture is a three-tier Next.js commerce app: client UI for shopping, server routes for auth and purchase/event callbacks, and external services for persistence/media/analytics. The most important diagram boundaries are storefront vs admin, public routes vs protected routes, and Next.js app code vs Supabase/Cloudinary/Meta integrations.
Main entry points: layout.tsx App Layout · page.tsx Admin Home · Cartcontext.tsx Cart State · supabase Supabase
Components 25
Storefront
Public shopping experience and shared commerce UI.
- Home · Landing page and entry into the shopping flow.
src/app/page.tsx - Product · Dynamic product detail page.
src/app/products/[id]/page.tsx - Category · Dynamic category listing page.
src/app/category/[slug]/page.tsx - Cart · Shopping cart screen.
src/app/cart/page.tsx - Checkout · Purchase checkout screen.
src/app/checkout/page.tsx - Orders · Customer order history page.
src/app/orders/page.tsx - Cart State · Shared cart context used across the purchase funnel.
src/app/Cartcontext.tsx - Store UI · Reusable storefront components for browsing and conversion.
- Hero Slides · Landing-page hero slideshow.
src/app/Herosection/HeroSlideshow.tsx
Admin Panel
Back-office screens for products, orders, and media.
- Admin Home · Admin panel landing page.
src/app/adminPanel/page.tsx - Products · Product management list and entry point.
src/app/adminPanel/products/page.tsx - Edit Product · Admin product creation and editing screens.
src/app/adminPanel/products/new/page.tsx - Admin Orders · Back-office order management page.
src/app/adminPanel/orders/page.tsx - Media Admin · Hero slide and review image management.
src/app/adminPanel/heroslides/page.tsx
Integrations
Auth, persistence, media, analytics, and external callbacks.
- Login · User sign-in page.
src/app/login/page.tsx - Signup · User registration page.
src/app/signup/page.tsx - Auth Callback · Authentication callback route.
src/app/auth/callback/route.ts - Purchase API · Purchase event callback for external tracking.
src/app/api/meta/purchase/route.ts - Supabase · Browser and server data access helpers for persistence.
src/app/lib/supabase - Cloudinary · External image storage and upload helper.
src/app/lib/supabase/cloudinary.ts - Tracking · Facebook pixel and marketing event wiring.
src/app/lib/pixel.ts - Pixel UI · Client-side pixel component used by the app shell.
src/app/component/FacebookPixel.tsx
App Shell
Global routing, styling, and site-wide metadata.
- App Layout · Global app shell and shared page frame.
src/app/layout.tsx - Global CSS · Global styling layer.
src/app/globals.css - SEO · Robots and sitemap configuration.
src/app/robots.ts
Connections 33
- App Layout → Home: renders · Shared shell wraps the home route.
- App Layout → Product: renders · Shared shell wraps product pages.
- App Layout → Category: renders · Shared shell wraps category pages.
- App Layout → Cart: renders · Shared shell wraps cart page.
- App Layout → Checkout: renders · Shared shell wraps checkout page.
- App Layout → Login: renders · Shared shell wraps login page.
- App Layout → Signup: renders · Shared shell wraps signup page.
- App Layout → Orders: renders · Shared shell wraps orders page.
- App Layout → Admin Home: renders · Shared shell wraps admin panel routes.
- App Layout → Store UI: composes · Global layout composes shared storefront UI.
- Store UI → Hero Slides: includes · Homepage hero carousel.
- Store UI → Cart State: uses · Shopping components share cart state.
- Home → Store UI: assembles · Landing page is built from reusable storefront components.
- Product → Cart State: uses · Product pages interact with shared cart state.
- Cart → Cart State: uses · Cart screen reads and updates the shared cart.
- Checkout → Cart State: uses · Checkout depends on the cart state boundary.
- Category → Store UI: uses · Category listings reuse catalog UI components.
- Admin Home → Products: navigates · Admin home links into product management.
- Admin Home → Admin Orders: navigates · Admin home links into orders.
- Admin Home → Media Admin: navigates · Admin home links into media management.
- Products → Edit Product: opens · Product list leads to create/edit flows.
- Media Admin → Cloudinary: uses · Media admin relies on external image handling.
- Products → Supabase: uses · Admin product data is backed by Supabase.
- Admin Orders → Supabase: uses · Order management reads from Supabase.
- Orders → Supabase: uses · Customer orders are loaded from Supabase.
- Login → Auth Callback: returns via · Sign-in flow completes through callback routing.
- Signup → Auth Callback: returns via · Registration flow completes through callback routing.
- Auth Callback → Supabase: authenticates · Callback establishes session against Supabase.
- Purchase API → Tracking: tracks · Purchase endpoint emits marketing/tracking events.
- Pixel UI → Tracking: loads · Client component wires analytics into the app.
- App Layout → Pixel UI: includes · Global shell mounts pixel integration.
- App Layout → Global CSS: applies · Shared layout loads global styles.
- App Layout → SEO: exposes · App shell provides indexing metadata.