# Contributing to Textal

Thank you for helping improve Textal. This project is a server-driven SPA: Laravel owns routing, auth,
validation, and business logic; Inertia and Vue render the UI.

## Development setup

### Requirements

- PHP **8.3+** (CI uses 8.3)
- Node **22** LTS
- Composer 2

On Windows with WAMP, the default `php` on PATH may be 8.2. Use [Laravel Herd](https://herd.laravel.com/)
PHP 8.4 for local artisan/composer commands:

```bash
export PATH="/c/Users/Hamza Computer/.config/herd/bin/php84:$PATH"
php "/c/Users/Hamza Computer/.config/herd/bin/composer.phar" install
```

MySQL on WAMP often listens on port **3308**; set `DB_PORT=3308` and `DB_ENGINE=InnoDB` when using MySQL.

### Install, build, test

```bash
make install
make build
make test
```

Equivalent:

```bash
composer setup
npm run build
php artisan test
npm test
```

## Code style

- PHP: Laravel Pint (`vendor/bin/pint --dirty`)
- PHP types: Larastan (`composer types:check`)
- JS/Vue: vite-plus (`npm run check`, `npm run types:check`)
- ESLint: `npx eslint resources/js` (see `eslint.config.js`)

Run the full gate before opening a PR:

```bash
composer ci:check
```

## Architecture

- Business logic in `app/Actions/` and `app/Services/`
- Controllers stay thin; every mutating route has a Form Request and policy check
- No client-side router or global store; use Inertia props and Wayfinder for URLs
- See `.cursor/rules/` and `CLAUDE.md` for domain conventions

## Tests

- Add or update Pest tests for backend behaviour (`tests/Feature`, `tests/Unit`)
- Add Vitest tests for non-trivial `resources/js/lib` and composable logic
- Include a case where another team cannot access tenant data for feature tests

## Commits

Use [Conventional Commits](https://www.conventionalcommits.org/) when possible:

- `feat:` new behaviour
- `fix:` bug fix
- `docs:` documentation only
- `test:` tests only
- `chore:` tooling, deps, CI

Keep commits focused (one logical change per commit when practical).

## Pull requests

- Describe what changed and why
- Confirm CI passes (GitHub Actions `tests` workflow)
- Do not commit `.env`, secrets, or generated Wayfinder output under `resources/js/actions` (regenerate locally with `php artisan wayfinder:generate`)
