How lilfanq/fang_store works
Shop Hip-Hop Ma Mị is a Next.js streetwear storefront with customer accounts, cart checkout, inventory, and an admin console. The main customer journey runs from product discovery to cart, order placement, and invoice; authentication can precede account actions. The graph also covers catalog and inventory APIs, administration, and the documented AI stylist and SEO capabilities. Source excerpts establish selected calls; README statements support documented but unsampled features, so some internal links are omitted where wiring was not shown.
Main entry points: create.js Order creation · auth.js JWT auth · prisma.js Application database · products Catalog UI
Components 28
Storefront
- Store pages
pages - Catalog UI
pages/products - Product detail
pages/product/[id].js - Discovery components
components - Catalog data
data/catalogProducts.js - AI stylist
pages/api/ai/stylist.js
Commerce
- Cart and checkout
pages/cart.js - Cart state
context/CartContext.js - Order creation
pages/api/orders/create.js - Order invoice
pages/order/[id].js - Coupon validation
pages/api/coupons/validate.js - Coupon rules
lib/coupon.js
Identity
- Account UI
components/AccountModal.js - Authentication APIs
pages/api/auth - JWT auth
lib/auth.js - Account profile
pages/api/account/profile.js
Operations
- Admin console
pages/admin/index.js - Admin APIs
pages/api/admin - Inventory APIs
pages/api/inventory - Inventory events
lib/inventoryEvents.js
Shared services
- Currency settings
context/CurrencyContext.js - API responses
lib/api.js - Email delivery
lib/email.js - Application database
lib/prisma.js
Other components
- Shopper
- Exchange-rate service
- Stripe
- SMTP
Connections 42
- Shopper → Store pages: browses
- Store pages → Discovery components: renders
pages/index.js - Shopper → Catalog UI: browses
- Catalog UI → Catalog data: reads
pages/products/index.js - Catalog UI → Discovery components: renders filters
pages/products/index.js - Catalog UI → Currency settings: formats prices
pages/products/index.js - Shopper → Product detail: selects product
- Product detail → Cart state: adds item
pages/product/[id].js - Product detail → Currency settings: formats price
pages/product/[id].js - Shopper → Cart and checkout: checks out
- Cart and checkout → Cart state: reads cart
pages/cart.js - Cart and checkout → Order creation: places order
- Order creation → Application database: reads and writes
pages/api/orders/create.js - Order creation → JWT auth: requires auth
pages/api/orders/create.js - Order creation → Coupon rules: calculates discount
pages/api/orders/create.js - Order creation → Inventory events: emits updates
pages/api/orders/create.js - Order creation → Email delivery: sends confirmation
pages/api/orders/create.js - Order creation → Stripe: creates payment intent
- Order creation → Order invoice: redirects after order
- Shopper → Account UI: signs in
- Account UI → Authentication APIs: authenticates
- Authentication APIs → JWT auth: uses tokens
pages/api/auth/register.js - JWT auth → Application database: looks up user
lib/auth.js - Shopper → Account profile: manages account
- Account profile → JWT auth: requires auth
pages/api/account/profile.js - Account profile → Application database: reads and writes
pages/api/account/profile.js - Shopper → Coupon validation: validates coupon
- Coupon validation → Coupon rules: calculates discount
pages/api/coupons/validate.js - Coupon validation → Application database: reads coupon
pages/api/coupons/validate.js - Shopper → Admin console: manages store
- Admin console → Admin APIs: requests operations data
- Admin APIs → Application database: reads and updates
pages/api/admin/coupons.js - Admin APIs → JWT auth: authorizes admin
pages/api/admin/coupons.js - Shopper → Inventory APIs: checks availability
- Inventory APIs → Application database: reads and updates
pages/api/inventory/update.js - Inventory APIs → JWT auth: authorizes updates
pages/api/inventory/update.js - Inventory APIs → Inventory events: publishes updates
pages/api/inventory/update.js - Shopper → AI stylist: asks stylist
- AI stylist → Catalog data: uses product catalog
pages/api/ai/stylist.js - Currency settings → Exchange-rate service: fetches rates
context/CurrencyContext.js - Account profile → API responses: formats errors
pages/api/account/profile.js - Order creation → SMTP: sends mail via