呢個網站用緊 React SPA(Vite build)、Cloudflare CDN 同一個自己寫嘅 REST API,唔係 WooCommerce 或者 Shopify。 Frontend 用 window. INITIAL DATA 做 bootstrap,但只係 CSR 嘅預載數據,唔係真正嘅 Server Side Rendering,所以 SEO 有潛在風險。

Create a landscape editorial hero image for this Studio Global article: Bạn là bộ NÃO LẬP KẾ HOẠCH của một code agent. Bạn không trực tiếp truy cập máy; ENGINE sẽ thực thi đúng một lệnh JSON bạn in ra và trả kết. Article summary: {"tool":"write","args":{"path":"PHAN TICH KIEN TRUC ECOMMERCE.md","content":" Phân tích kiến trúc và hướng viết lại nền tảng e commerce\n\n Phạm vi và mức độ chắc chắn\n\nBáo cáo này phân biệt rõ ba loại kết luận:\n\n Dữ. Topic tags: general web, workflow, code, python, javascript. Style: premium digital editorial illustration, source-backed research mood, clean composition, high detail, modern web publication hero. Use reference image context only for broad subject, composition, and topical grounding; do not copy the exact image. Avoid: logos, brand marks, copyrighted characters, real person likenesses, fake screenshots, UI text, readable text, watermarks, char
今次分析嘅唔係一個普通嘅 WooCommerce 或者 Shopify 網站,而係一個用 React(Vite build)做前、自己寫 REST API 做後嘅 Custom E-commerce 平台。佢用 Cloudflare 做 CDN,有自己嘅 Catalog、CMS、Coupon、PayPal Checkout、Review、Newsletter 等功能。簡單講,成個系統係由頭砌起嘅,唔係靠現成平台。
呢篇文章會同你拆解佢嘅架構有咩好、有咩唔好、同做 SEO 嘅網站有咩要注意,最終會畀一個具體嘅升級建議。
呢個架構明顯係自己做嘅 Domain Design,唔係 WooCommerce 或者 WordPress Headless,因為 API 嘅 Route 同 Response Schema 都唔似嗰啲平台嘅預設格式。
當你打開 https://example.com/shop 嘅時候,Server 會 Return 一個好基本嘅 HTML App Shell(得個 #root Div 同幾個 Script Tag)。然後:
index-<hash>.js 呢類檔案。window.__INITIAL_DATA__ 或者 window.__RC_HP 呢類 Bootstrap Data,有就用,冇就 Call API。呢個就係典型嘅 Client-Side Rendering(CSR)。
要注意嘅地方:
Frontend 唔會將產品資料 Build 入 Bundle 入面,而係靠 API 拎:
GET /api/products?limit=500&active=1GET /api/products?q=...GET /api/products/<slug>GET /api/products/categories呢個做法嘅好處係:改產品價錢、庫存嘅時候,唔使重新 Build Frontend,Database 改完 Frontend 就見得到。
但係都有問題:
limit=500 係一個危險信號。如果得十幾個產品,一次過 Load 晒冇問題;但如果有幾千個 SKU,呢個 Request 嘅 Payload 會好大,Query Time 會好長,浪費頻寬同記憶體。長遠應該改用 Cursor Pagination 同 Field Projection。stock 喺 Product Level,但同時又有 variants;sizes、colors 呢啲 Option Strings 又唔統一(有 XXL 又有 2XL,有 ink navyInk Navy個 Homepage 係由 section_order 控制嘅 Block Composition。即係話,Marketing Team 可以喺 CMS 後面改次序、開關某啲 Section(Hero Banner、Product Grid、Promo Bar 等),而唔使 Frontend Developer 改 Code。
好處: 好 flexible,Marketing 可以自己玩。
壞處: 現有系統入面有啲 Key 唔統一,例如同時出現 ann 同 announcement,可能會令 CMS Configuration 同 Frontend Component 之間對唔齊,導致某啲 Block Render 唔到或者顯示錯咗。新系統應該用一個統一嘅 Block List,每個 Block 都有自己嘅 id、kind、enabled、position、payload,咁就唔會亂。
/api/layout 控制 Header、Footer、Navigation 呢啲全站通用嘅元素,而 /api/public/settings 就放 Branding、Logo、Social Links、Payment Methods、運費設定呢啲 Store Configuration。
好處: 將呢啲設定放喺 API,等 Frontend 可以動態更新,唔使靠 Config File 或者 Env Variable。
壞處: 呢個 Public Settings API 會一次過 Return 晒所有資料,包括 tax_id、公司地址、營運 Email 呢啲未必需要公開嘅資料。另外,呢類 Key-Value Store 冇 Type Checking,好易入錯 Data Type(例如 paypal_sandbox 入咗個字串 "true" 或者 1)。新系統應該將 Public Settings 同 Internal/Secret Settings 分開存放。
一個比較穩陣嘅 Checkout 流程應該係咁:
POST /api/paypal/create-orderPOST /api/paypal/capture而家有咩潛在風險?
呢啲功能令呢個 Backend 唔止係一個 Catalog API,而係一個完整嘅 Commerce Application。
Order #123POST /api/track
用 React 同 Custom API 唔代表就一定好。Custom 畀到你更高嘅 Control,但同時你都要承擔所有開發同維護嘅責任。效能、SEO、安全呢啲嘢,唔係用咗個「靚」Framework 就自動搞掂,而係取決於你點 Design 個 Data Model、點做 Rendering、點做 Cache、點做 Testing。
| Custom SPA (CSR) | WooCommerce 傳統 |
|---|---|
| 優點: 導航好流暢,因為只換 Data 唔換頁面;Static Assets 可以長 Cache。 | 優點: 第一次 Load 就有 HTML 內容,用戶同 Crawler 都即刻睇到 Product 名、描述。做 Full Page Cache 同 CDN 之後可以好快。 |
缺點: 第一次 Load 慢,要等 JS Download、Parse、Execute、再 Call API;如果用 limit=500 一次過 Load 晒,會係樽頸。 | 缺點: 如果 Plugin 裝得太多、Theme 寫得差、Database Query 冇 Index、PHP Worker 資源唔夠,TTFB 會好高。 |
結論: Custom 嘅潛在效能天花板係高啲(如果有做 SSR/SSG 同 Optimize),但 WooCommerce 嘅 Baseline 相對簡單易控制。唔好齋講用咩 Tech Stack,要睇 Real User Monitoring 嘅 Core Web Vitals(LCP、FID/INP、CLS)先係真。
呢個係最關鍵嘅分野。
WooCommerce 傳統: 預設就係 Server-side Rendering,HTML 入面有齊晒 Product Name、Description、Metadata,Googlebot 一嚟到就睇到晒,唔使等 JS。
Custom CSR SPA: 係 Google 嘅眼中,佢一開始只係見到一個 Empty Div。雖然 Google 識行 JS,但係有幾個風險:
/product/not-exist)因為 Catch-all Route 而 Return 200 OK,然後靠 React 喺 Client Side 顯示「404」,Google 可能會當呢個係 Soft 404,影響網站整體評分。Google 官方建議: 佢哋已經明確表示 Dynamic Rendering(對 Bot 俾 Pre-rendered HTML,對 User 俾 SPA)只係一個 Workaround,唔係長期解決方案。最佳做法係用 Server-Side Rendering (SSR)、Static Site Generation (SSG) 或者 Incremental Static Regeneration (ISR)。
| Custom | WooCommerce |
|---|---|
| 維護: Frontend、Backend、Database、Admin Panel、API Contract、Payments、Email Jobs、Cache、Deployment 全部要自己保養。好處係冇 Plugin Conflict,所有 Code 都係你需要嘅。 | 維護: Core Commerce 功能有人幫你搞,但你要 Update WordPress Core、WooCommerce、Theme、所有 Plugins。每次 Update 都要做 Regression Test,因為常有 Breaking Changes。 |
| 成本: 細流量嘅時候,工程團隊嘅人工係最大成本,多過 Server 費用。 | 成本: Hosting 平,但 Plugin License 同埋 Developer 嘅時間成本(做 Update)都要計。 |
Custom 嘅架構可以將 Frontend 同 Backend 獨立 Scale,CDN、API Workers、Database 可以各自加 Machine。不過,Scaling 嘅真正難題永遠係 Database Transaction、Inventory Reservation 同 Payment Idempotency,呢啲係 Architecture 問題,唔係加 Machine 搞得掂。WooCommerce 用 Managed Hosting 同好好嘅 Cache Strategy,亦可以應付可觀嘅 Traffic。
可以保留嘅係 Business Logic 同 Domain Knowledge(例如:產品有 Category、Homepage 有 Block、Checkout 有 Coupon 同 PayPal),但係要用全新、標準化、符合現代標準嘅架構去實作。唔可以抄現有 Bundle 入面嘅 Private Variable Name 或者 Module Structure。
404 Not Found200 OK<a href="...">onClick handler 去處理。如果目標係 快啲開到鋪、團隊細、商業流程標準,用 WooCommerce 配一個輕 Theme 同少 Plugin 係穩陣嘅選擇。
如果目標係 要完整嘅 Brand Experience、自己有 Developer Team、長遠想控製成個 Tech Stack,咁 Custom 方向係啱嘅,但係一定要升級做 SSR/ISR Hybrid Rendering,唔好再停留喺純 CSR 嘅階段。
最關鍵嘅建議: 唔好因為「聽落 Pro」就揀 Custom,亦唔好因為「怕煩」就揀 WooCommerce。要睇你嘅 Business Requirement、Team Capability、同埋長遠 Roadmap。
呢篇文章嘅分析係基於觀察到嘅 Frontend 同 API Behavior,Backend 嘅實際 Language 同 Framework 係要睇更多資訊(例如 Response Headers、Error Format、Deployment Config)先可以確定,現階段唔應該胡亂猜測。
Studio Global AI
Use this topic as a starting point for a fresh source-backed answer, then compare citations before you share it.
呢個網站用緊 React SPA(Vite build)、Cloudflare CDN 同一個自己寫嘅 REST API,唔係 WooCommerce 或者 Shopify。
呢個網站用緊 React SPA(Vite build)、Cloudflare CDN 同一個自己寫嘅 REST API,唔係 WooCommerce 或者 Shopify。 Frontend 用 window. INITIAL DATA 做 bootstrap,但只係 CSR 嘅預載數據,唔係真正嘅 Server Side Rendering,所以 SEO 有潛在風險。
Catalog API 用 limit=500 一次過拎晒所有產品,短期可以,但產品一多就會變成瓶頸;Product schema 嘅 variant 同 inventory 模型未標準化。