Ahmed Abdelaziz

Ecommerce Storefront & Admin ConsoleDesign Docs

Requirements

What customers and staff can do — in plain language, by role.

Last updated August 2026

Overview

Functional requirements in plain language — what customers and staff can do, split by role. Every entry maps to a real API endpoint; no screen invents behavior the backend does not grant.

How to read

Must = shipped and covered by real screens. Should = shipped. Planned = designed but not yet implemented.


Customer Requirements

IDRequirementStatus
FR-01Browse the catalog — listing with search, brand filter, sort (-created_at), pagination; category pages; product detail with ordered images (is_primary) and ACTIVE variants carrying computed final_priceMust
FR-02Pick an exact variant — color/size availability tied to inventory; gallery switches per variant; unavailable variants shown as out-of-stockMust
FR-03Maintain a server-side cart — add variant (merge-on-duplicate), update quantity (1–999), remove line, clear cart; live Decimal pricing resolved server-sideMust
FR-04Check out in three steps — choose a saved address, optionally apply a coupon (uppercased), watch shipping rules settle; POST /orders creates the order, payment record, shipment copy, and clears the cart in one transactionMust
FR-05View order history and order detail — status-filtered, paginated, with a timeline and immutable order_items / shipments snapshots (price, SKU, attributes, address frozen at purchase)Must
FR-06Leave reviews — one live review per product with rating (1–5), title, comment, and images via signed ImageKit uploads; edit or delete own review; read rating summariesMust
FR-07Register, log in, verify email (/verify-email link), resend verification, recover password via emailed link/OTP (/forgot-password wizard, POST /auth/password-reset + OTP verify)Must
FR-08Manage account — profile names, password change (with re-login), email change (link flow), phone change (OTP), account deletion behind a confirm dialogMust
FR-09Manage an address book — CRUD with per-type default flags; defaults promote the oldest remaining address when the current default is deleted; used at checkoutMust
FR-10Manage personal reviews and sessions — "My reviews" list with edit, and device session list with revoke-one / revoke-othersMust

Staff Requirements

IDRequirementStatus
FR-11See dashboard KPIs — order/revenue stats, status pipeline quick links, revenue trend chart — with super-admin-only P&L analytics split into overview / coupons / expensesMust
FR-12Manage the catalog — product CRUD (auto-slug -2 suffix, soft-delete with variant cascade), variant CRUD (SKU 80-char global uniqueness, status nullable), product and variant images with exactly-one-primary invariant and direct-to-ImageKit signed uploadsMust
FR-13Manage categories — CRUD with is_active visibility, idempotent product assign/unassign, transactional soft-deleteMust
FR-14Operate inventory — per-variant quantity_on_hand / quantity_reserved / reorder_level, manual adjust and manual reserve/release behind guarded endpointsMust
FR-15Fulfill orders through a legal transition matrix — order-status-actions.tsx renders only allowed next steps; each transition carries server-side stock/payment/coupon side effects asserted by affected-row countsMust
FR-16Moderate reviews, manage customers — user list, suspend/activate; role changes require SUPER_ADMIN; last SUPER_ADMIN is protectedMust
FR-17Manage coupons — CRUD with validity windows, global/per-user limits, max-discount caps; usage drawer shows coupon_usages per orderMust
FR-18Inspect the audit trail and admin roster — append-only audit_logs (actor, action, entity, redacted body, diff, IP/UA) and admin-account management under SUPER_ADMINMust
FR-19Upload images via signed ImageKit params — short-lived HMAC token/expire/signature from GET …/uploads/imagekit-auth; persisted URLs re-validated for host, folder allowlist, and extensionMust

Behavior that matters

  • Same-origin, always — every request flows through lib/api/axios-instance.ts (baseURL = /api/v1, withCredentials: true). The Next.js rewrite is the only network hop; CORS never appears.
  • No phantom stock — cart quantity inputs are clamped 1–999; 409 (insufficient stock) from POST /cart/items or PATCH /cart/items/{variant} surfaces inline.
  • Order history never lies — later catalog edits do not rewrite order_items or shipments; the detail screen reads frozen values.
  • Every admin mutation is visibleaudit_logs records who did what, with redacted bodies and diffs; the Audit viewer is super_admin only.

Out of scope (current version)

  • Real payment gateway — checkout stays on mock (Paymob tracked as T19 / T-081…T-087, marked won't do since 2026-08-25).
  • Loyalty, wishlist, recommendations.
  • Review purchase-verification — implemented behind REVIEWS_REQUIRE_PURCHASE on the API, currently off.
  • Client-side E2E suite — vitest unit harness + axios-mock-adapter only today.

Why it matters

Every gap is a documented decision with a task number — not an undocumented surprise.