---
description: Vue SPA bootstrap, router guards, feature modules, DataTable views
globs: resources/js/**/*
alwaysApply: false
---

# Maestro CORE — Vue SPA

## Entry

- **`bootCore.js`**: `hydrateAppSettings()`, **`createCoreRouter`**, PrimeVue (Aura preset + sky primary), optional **`configureRouter`** callback after CORE routes.
- **Module routes**: Example — `customerRoutes` from `resources/js/modules/customers/index.js` are **`addRoute('authenticated', …)`** so they sit under the authenticated **`AppLayout`**.

## Router guards (`router/index.js`)

| `meta` | Behavior |
|--------|----------|
| `requiresAuth` | Redirect guests to `login` with `redirect` query |
| `guest` | Redirect authed users away (e.g. to `/dashboard`) |
| `permission` | Requires string in `user.permissions` (normalized via `normalizePermissionList`) |
| **`module`** | Requires slug in **`user.enabled_module_slugs`** (`/api/user`); mismatches → `auth-access` |

Superadmin layout uses **`permission: "platform.superadmin"`** on the parent segment.

## New feature module (SPA)

1. **`resources/js/modules/{feature}/`** — `views/`, `composables/`, **`index.js`** exporting route array with **`meta.module`** slug matching backend **`MaestroModule`** / config.
2. Register routes in **`bootCore`** (or host `configureRouter`) under name **`authenticated`**.
3. Ensure backend enables the same module so **`enabled_module_slugs`** includes the slug.

## Settings DataTables

- Use **server mode** + **`resource-key`** matching PHP registry key; enable **export** only when backend resource supports it and realtime (`Echo`/Reverb) is configured — see **`docs/datatable-export-and-reverb.md`**.
- Shared client API: **`resources/js/services/dataTableService.js`**; notifications: composables under `composables/` (e.g. export/realtime hooks).
