# Maestro CORE

Composer package **`maestro/core`** and npm package **`@maestro/core`**: a Laravel + Vue + PrimeVue SPA foundation for internal applications (auth session API, organization profile, users & roles with Spatie Permission, activity log route, shared layout and settings shell).

## Requirements

- PHP **8.3+**
- Laravel **13+** (via your host application)
- Node **20+** recommended for the SPA toolchain

## Consume in a Laravel app

```bash
composer require maestro/core
php artisan core:install
php artisan migrate
php artisan db:seed   # when your DatabaseSeeder calls Maestro\UserSeeder (see stubs)
npm install @maestro/core
```

Use a thin `App\Models\User` that extends `Maestro\Core\Models\User` (see [`stubs/app/Models/User.php`](stubs/app/Models/User.php)). Your `auth.providers.users.model` must stay in sync with route model binding so Spatie `model_has_roles.model_type` matches the logged-in user class.

### Microsoft SSO (optional)

Entra ID (Azure AD) sign-in uses Laravel Socialite and `socialiteproviders/microsoft`. Set `MICROSOFT_*` and `FRONTEND_URL` in `.env` (see `.env.example`). Users must already exist in your database with `microsoft_user_id` set to their Azure object id (oid); unknown accounts are rejected (no just-in-time provisioning).

Register **one** SPA catch-all in the host app ([`stubs/routes/web.php`](stubs/routes/web.php)); this package intentionally does **not** register a duplicate global `/{any?}` (see [`routes/core.php`](routes/core.php)).

Bootstrap the frontend from your `resources/js/app.js`:

```javascript
import { bootCore } from "@maestro/core";
void bootCore(/* optional router extend callback */).catch(console.error);
```

## Develop this repository

```bash
composer install
npm install
composer test     # PHPUnit (Orchestra Testbench + Feature tests)
composer run check-style   # Pint
npm run build   # package asset build
```

## Release

[`release.sh`](release.sh) bumps Composer and npm versions, commits, tags, pushes, runs `npm publish`, and rebuilds Satis on the configured Forge host. Prefer `npm run release -- <version>` so the version is forwarded to the shell script.

## License

MIT
