Title here
Summary here
You have Pionia Shop’s Moonlight API running on port 8000 and want a React or Vue storefront that calls product.list and customer.login — same origin in production, proxied /api during local dev.
frontend:scaffold vs composer create-project … --react-ts:5173) proxies to Pionia (:8000)public/) and how SPA fallback worksproduct.list returns data on 8000customer.login in the SPAPionia ships optional Vite scaffolding so Pionia Shop can have a React or Vue storefront calling product.list over the same origin in production.
flowchart LR Dev["Vite :5173"] -->|proxy /api| API["Pionia :8000"] API --> Moonlight["POST product.list"] Build["frontend:build"] --> Public["public/index.html + assets"] Browser[Production browser] --> Public Public --> Moonlight2["same-origin /api/v1/"]
| Page | What you build |
|---|---|
| Vite integration | Dev proxy, build to public/, SPA fallback |
Quick start:
php pionia frontend:scaffold --framework=react-ts --yes
php pionia serve # terminal 1 — API on :8000
php pionia frontend:dev # terminal 2 — Vite on :5173php pionia serve — API calls to /api fail with connection errorshttp://127.0.0.1:8000 in frontend fetch URLs — use relative /api/v1/ so production same-origin worksfrontend:build before deploy — production serves from public/, not frontend/[cors] for :5173 when testing auth headers from the browserScaffold, dev, build, and CORS setup.
apiVersionPath() for frontend config.
Send Bearer JWT from the SPA.