2026-01-28 14:15:33 +00:00
|
|
|
# CLAUDE.md
|
|
|
|
|
|
|
|
|
|
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
2026-01-26 20:39:56 +00:00
|
|
|
|
|
|
|
|
## Architecture
|
|
|
|
|
|
2026-01-28 14:15:33 +00:00
|
|
|
Modular monolith using Core PHP Framework (Laravel 12). Modules live in `app/Mod/{Name}/Boot.php` and register via events.
|
2026-01-26 20:39:56 +00:00
|
|
|
|
|
|
|
|
**Event-driven registration:**
|
|
|
|
|
```php
|
|
|
|
|
class Boot
|
|
|
|
|
{
|
|
|
|
|
public static array $listens = [
|
|
|
|
|
WebRoutesRegistering::class => 'onWebRoutes',
|
|
|
|
|
ApiRoutesRegistering::class => 'onApiRoutes',
|
|
|
|
|
AdminPanelBooting::class => 'onAdminPanel',
|
|
|
|
|
];
|
2026-01-28 14:15:33 +00:00
|
|
|
|
|
|
|
|
public function onWebRoutes(WebRoutesRegistering $event): void
|
|
|
|
|
{
|
|
|
|
|
$event->routes(fn() => require __DIR__.'/Routes/web.php');
|
|
|
|
|
$event->views('blog', __DIR__.'/Views');
|
|
|
|
|
}
|
2026-01-26 20:39:56 +00:00
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2026-01-28 14:15:33 +00:00
|
|
|
**Module paths:** `app/Core/`, `app/Mod/`, `app/Website/` (configured in `config/core.php`)
|
|
|
|
|
|
2026-01-26 20:39:56 +00:00
|
|
|
## Commands
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-01-28 14:15:33 +00:00
|
|
|
# Development
|
|
|
|
|
php artisan serve # Laravel dev server
|
|
|
|
|
npm run dev # Vite with HMR
|
|
|
|
|
composer dev:packages # Use local packages (composer.local.json)
|
|
|
|
|
|
|
|
|
|
# Module creation
|
|
|
|
|
php artisan make:mod Blog --all # Full module (web, api, admin)
|
|
|
|
|
php artisan make:mod Blog --web # Web routes only
|
|
|
|
|
php artisan make:mod Blog --api # API routes only
|
|
|
|
|
|
|
|
|
|
# Testing
|
|
|
|
|
vendor/bin/pest # Run all tests
|
|
|
|
|
vendor/bin/pest tests/Feature # Run feature tests only
|
|
|
|
|
vendor/bin/pest --filter="test name" # Run single test by name
|
|
|
|
|
vendor/bin/pest path/to/TestFile.php # Run single test file
|
|
|
|
|
|
|
|
|
|
# Code quality
|
|
|
|
|
vendor/bin/pint --dirty # Format changed files only
|
|
|
|
|
vendor/bin/pint # Format all files
|
2026-01-26 20:39:56 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Module Structure
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
app/Mod/Blog/
|
2026-01-28 14:15:33 +00:00
|
|
|
├── Boot.php # Event listeners (required)
|
2026-01-26 20:39:56 +00:00
|
|
|
├── Models/ # Eloquent models
|
|
|
|
|
├── Routes/
|
|
|
|
|
│ ├── web.php # Web routes
|
|
|
|
|
│ └── api.php # API routes
|
2026-01-28 14:15:33 +00:00
|
|
|
├── Views/ # Blade templates (namespaced as 'blog::')
|
2026-01-26 20:39:56 +00:00
|
|
|
├── Livewire/ # Livewire components
|
2026-01-28 14:15:33 +00:00
|
|
|
├── Migrations/ # Auto-discovered migrations
|
2026-01-26 20:39:56 +00:00
|
|
|
└── Tests/ # Module tests
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Packages
|
|
|
|
|
|
2026-01-28 14:15:33 +00:00
|
|
|
| Package | Namespace | Purpose |
|
|
|
|
|
|---------|-----------|---------|
|
|
|
|
|
| `host-uk/core` | `Core\` | Framework core, events, module discovery |
|
|
|
|
|
| `host-uk/core-admin` | `Core\Admin\` | Admin panel, Livewire modals |
|
|
|
|
|
| `host-uk/core-api` | `Core\Api\` | REST API, scopes, rate limiting, webhooks |
|
|
|
|
|
| `host-uk/core-mcp` | `Core\Mcp\` | Model Context Protocol for AI agents |
|
2026-01-26 20:39:56 +00:00
|
|
|
|
|
|
|
|
## Conventions
|
|
|
|
|
|
2026-01-28 14:15:33 +00:00
|
|
|
**Language:** UK English (colour, organisation, centre, behaviour, licence/license)
|
|
|
|
|
|
|
|
|
|
**PHP:**
|
|
|
|
|
- `declare(strict_types=1);` in all files
|
|
|
|
|
- Full type hints on parameters and return types
|
|
|
|
|
- PSR-12 formatting (Laravel Pint)
|
|
|
|
|
- Pest for testing (not PHPUnit syntax)
|
|
|
|
|
|
|
|
|
|
**Naming:**
|
|
|
|
|
- Models: Singular PascalCase (`Post`)
|
|
|
|
|
- Tables: Plural snake_case (`posts`)
|
|
|
|
|
- Livewire Pages: `{Feature}Page`
|
|
|
|
|
- Livewire Modals: `{Feature}Modal`
|
|
|
|
|
|
|
|
|
|
**UI Stack:**
|
|
|
|
|
- Livewire 3 for reactive components
|
|
|
|
|
- Flux Pro for UI components (not vanilla Alpine)
|
|
|
|
|
- Font Awesome Pro for icons (not Heroicons)
|
|
|
|
|
- Tailwind CSS for styling
|
2026-01-26 20:39:56 +00:00
|
|
|
|
|
|
|
|
## License
|
|
|
|
|
|
|
|
|
|
- `Core\` namespace and vendor packages: EUPL-1.2 (copyleft)
|
2026-01-28 14:15:33 +00:00
|
|
|
- `app/Mod/*`, `app/Website/*`: Your choice (no copyleft)
|