How amuthavanmoorthi/taiwan-mobile-client works
Purpose and Runtime
This is a Next.js frontend for a marketplace/catalog of physical items with buyer accounts, bids, checkout/orders, and staff administration. It runs on port 3000 and depends on a separately running backend API, configurable through NEXT_PUBLIC_API_URL. The App Router shell originates at src/app/layout.tsx; public discovery begins at src/app/page.tsx and src/app/products/page.tsx.
Application Routing and UI Shell
Route pages compose reusable client-facing UI for catalog browsing, product detail, authentication, account management, and checkout. Shared navigation and global styling establish the site-wide presentation boundary in src/components/HeaderNav.tsx, src/app/layout.tsx, and src/app/globals.css. Product and order detail routes are parameterized under src/app/products/[id]/page.tsx and src/app/orders/[id]/page.tsx.
Catalog, Listings, and Bidding
The buyer flow is: browse/filter product listings, inspect a product, view its media/model, place bids, then proceed to checkout and order views. Core UI components are src/components/ProductCard.tsx, src/components/FilterRail.tsx, and src/components/BidPanel.tsx. Local Next API boundaries for bid and order operations are src/app/api/bids/route.ts and src/app/api/orders/route.ts; these likely proxy or adapt requests to the required backend rather than owning persistence.
Authentication, Session, and Account
Authentication is exposed through login/register/logout API routes and corresponding screens, while session handling is centralized in src/lib/session.ts. Main boundaries are src/app/api/auth/login/route.ts, src/app/api/auth/register/route.ts, and src/app/account/page.tsx. Account profile changes use src/app/api/account/route.ts; UI should rely on this API/session boundary rather than directly managing backend credentials.
Staff and Admin Operations
A protected staff area supports inventory, order oversight, FAQ management, verification, and team administration. The staff dashboard and inventory workflows start at src/app/staff/page.tsx, src/app/staff/inventory/page.tsx, and src/app/staff/inventory/[id]/review/page.tsx. Server endpoints separate staff capabilities by domain: inventory CRUD/model upload at src/app/api/staff/inventory/route.ts and src/app/api/staff/inventory/[id]/model/route.ts, FAQ management at src/app/api/staff/faqs/route.ts, and admin team/password management at src/app/api/admin/team/route.ts.
3D/AR Asset Pipeline
Catalog items can be presented in browser viewers and mobile AR handoff flows. Viewer and measurement surfaces are implemented in src/components/ProductViewer.tsx, src/components/ModelViewer.tsx, and src/components/ArRuler.tsx. Static GLB and USDZ assets are served directly from public/models/, enabling Android-oriented GLB and iOS-oriented USDZ delivery; asset placeholders are regenerated by scripts/make-placeholder-glb.mjs and scripts/usdz.mjs.
Integration Boundaries and Shared Domain Utilities
src/lib/api.ts is the primary client/server API integration seam to the external backend. Shared domain and presentation concerns are separated into category data (src/lib/categories.ts), locale/i18n (src/lib/locale.ts, src/lib/i18n.ts), and server-aware district/theme utilities (src/lib/district.server.ts, src/lib/theme.server.ts). Next configuration resides in next.config.ts; there is no database or backend implementation in this repository.
Main entry points: [id]/page.tsx Product detail · api.ts Backend API client · layout.tsx App shell · products/page.tsx Catalog discovery
Components 18
Buyer experience
- App shell · Global navigation and styling boundary.
src/app/layout.tsx - Catalog discovery · Home and product listing entry points.
src/app/products/page.tsx - Catalog controls · Product cards and filtering compose catalog browsing.
src/components/ProductCard.tsx - Product detail · Shows item details, media, bidding, and viewer surfaces.
src/app/products/[id]/page.tsx - Bid panel
src/components/BidPanel.tsx - Checkout and orders · Includes parameterized order views.
src/app/orders/[id]/page.tsx - Account and auth · Buyer login, registration, and profile management.
src/app/account/page.tsx
Staff operations
- Staff dashboard · Entry point for operational workflows.
src/app/staff/page.tsx - Inventory review · Staff review workflow for individual inventory items.
src/app/staff/inventory/[id]/review/page.tsx
Next API boundary
Routes adapt requests to the external backend.
- Staff management APIs · Inventory/model, FAQ, and team administration endpoints.
src/app/api/staff/inventory/route.ts - Auth and account APIs · Login, registration, logout, and profile boundary.
src/app/api/auth/login/route.ts - Bid and order APIs · Local bid and order operation boundary.
src/app/api/bids/route.ts - Session handling
src/lib/session.ts - Backend API client · Primary seam to the separately deployed backend API.
src/lib/api.ts
3D and AR assets
- 3D viewer and AR ruler · Browser model viewing, measurement, and AR handoff surfaces.
src/components/ProductViewer.tsx - GLB and USDZ models · GLB supports Android-oriented viewing; USDZ supports iOS handoff.
- Asset placeholder generation · Generates placeholder GLB and USDZ assets.
scripts/make-placeholder-glb.mjs
Other components
- External backend API · Configured through NEXT_PUBLIC_API_URL; persistence is outside this repository.
Connections 21
- App shell → Catalog discovery: hosts
- App shell → Account and auth: hosts
- App shell → Staff dashboard: hosts
- Catalog discovery → Catalog controls: composes
- Catalog discovery → Product detail: select item
- Product detail → Bid panel: offers bidding
- Product detail → 3D viewer and AR ruler: renders model
- Bid panel → Bid and order APIs: places bid
- Product detail → Checkout and orders: proceeds to checkout
- Checkout and orders → Bid and order APIs: creates or reads orders
- Account and auth → Auth and account APIs: authenticates and updates profile
- Auth and account APIs → Session handling: establishes session
- Staff dashboard → Inventory review: opens inventory workflow
- Inventory review → Staff management APIs: reviews and uploads models
- Staff management APIs → Session handling: authorizes staff access
- Auth and account APIs → Backend API client: uses
- Bid and order APIs → Backend API client: uses
- Staff management APIs → Backend API client: uses
- Backend API client → External backend API: backend requests
- 3D viewer and AR ruler → GLB and USDZ models: loads GLB or USDZ
- Asset placeholder generation → GLB and USDZ models: generates placeholders