Appearance
Frontend installation (Nuxt)
The frontend is a Nuxt 4 application using SSR (nuxt build + Node server). It communicates with Laravel via Sanctum cookie authentication.
Step 1 — Install dependencies
bash
cd /path/to/frontend
npm installpnpm, yarn, or bun also work if you adapt lockfiles.
Step 2 — Environment file
Copy the example file included in the package:
bash
cp .env.example .envEdit frontend/.env:
ini
# Public URL where users open the Nuxt app (no trailing slash)
FRONTEND_URL=http://localhost:4000
# Laravel API origin (no trailing slash) — must match APP_URL on backend
API_URL=http://localhost:8000| Variable | Purpose |
|---|---|
FRONTEND_URL | Used in runtimeConfig.public.baseUrl |
API_URL | API requests + Sanctum CSRF/login (runtimeConfig.public.apiUrl) |
Production example:
ini
FRONTEND_URL=https://yourdomain.com
API_URL=https://api.yourdomain.comWARNING
API_URL must be the backend origin only, not /api. The app appends /api/... automatically.
Step 3 — Development server
bash
npm run devDefault script (package.json):
json
"dev": "nuxt dev -p 4000 --host"Open http://localhost:4000.
Step 4 — Production build
bash
npm run buildOutput is written to .output/.
Run production server locally
bash
npm run startUses:
text
HOST=0.0.0.0 PORT=3000 node .output/server/index.mjsSet PORT and HOST via environment on your host.
Step 5 — Sanctum / auth module
The project uses nuxt-auth-sanctum with cookie mode. Relevant settings in nuxt.config.ts:
| Setting | Value |
|---|---|
| Login endpoint | /api/auth/signin |
| Logout | /api/auth/logout |
| User | /api/user |
| CSRF | /sanctum/csrf-cookie |
After login, admins redirect to /admin; users to /dashboard (see pages/signin.vue).
Route protection: middleware/auth.global.ts guards /admin and /dashboard.
Step 6 — Verify frontend → API
- Open browser devtools → Network.
- Load the homepage — requests should go to
{API_URL}/api/.... - Sign in — you should see
sanctum/csrf-cookiethenapi/auth/signin. - Session cookie
laravel_session(name may vary) set on API domain.
If requests fail with CORS errors, fix CORS & Sanctum.
Robots & sitemap (Nuxt server routes)
The frontend serves:
/robots.txt— from admin SEO settings (proxied/fetched from API)/sitemap.xml— dynamic sitemap
Ensure your production reverse proxy forwards these routes to the Nuxt server.
Next step
- Database (if not done on backend)
- First admin account