How haroon-rashed/quickcart works
Project type and purpose
• Full-stack, server-rendered React application (Next.js 13 “app” router).
• Purpose: e-commerce platform with separate buyer and seller flows (product catalog, cart, orders, seller dashboard).
File structure
• app/ → Next.js “app router” pages (buyer-facing: all-products, cart, my-orders, product/[id], add-address, order-placed; seller-facing: under app/seller).
• components/ → reusable UI pieces for buyer and seller.
• context/AppContext.jsx → React Context for global state (cart, user session).
• pages/api/ → Next.js API routes (e.g. inngest event handler).
• config/db.js, models/*.js → Database connection and Mongoose models (User, Order, Product).
• lib/authSeller.js, middleware.ts → authentication/authorization logic for seller routes.
• config/inngest.js → Inngest event definitions for async workflows (e.g. order-placed events).
• public, assets/ → static assets and data (productData).
• next.config.mjs, tailwind.config.mjs, postcss.config.mjs → build and styling configs.
README
• Confirms Next.js foundation, no external microservices except Inngest for event processing.
• Deployed on Vercel, uses next/font and Tailwind CSS.
Main components & interactions
a. Client Browser
• Sends HTTP requests to Next.js for page rendering & fetches data via client-side fetch/React.
b. Next.js Server (hosted on Vercel)
• App Router (React Server Components + Client Components)
• pages/api (Serverless Functions)
• Middleware (route protection)
• React Context Provider (AppContext)
• Static asset serving (public/, assets/)
c. Database (MongoDB or compatible)
• Accessed via config/db.js and Mongoose models.
d. Inngest Event System
• pages/api/inngest.js & config/inngest.js define and trigger background jobs (e.g., email notifications or order processing).
e. External Services (optional)
• Vercel CDN for static assets
• Potential payment gateway (not in tree but likely)
Architectural patterns & design principles
• Server-Side Rendering (SSR) and Static Site Generation (SSG) via Next.js.
• Component-based UI with clear separation of buyer vs seller sub-apps.
• Context API for global state.
• API-First: business logic exposed as serverless endpoints under pages/api.
• Event-Driven: asynchronous workflows via Inngest.
• Middleware for authorization (seller vs buyer).
Capturing essential elements
• Do not omit:
• Next.js App Router (buyer vs seller)
• React Context for state management
• API routes and middleware
• Database connection & models
• Inngest event system
• Static assets serving & deployment context