# Domains

Product features live in `laravel/app/Domains/{Feature}/` so they can be added or removed without affecting other features.

## Folder contract

```
laravel/app/Domains/{Feature}/
  DomainServiceProvider.php
  Models/
  Actions/
  Http/Controllers/
  Http/Requests/
  Policies/
  Events/              # optional
  routes/web.php       # optional
  routes/api.php       # optional
```

## Rules

- Depend on platform only (`User`, `Team`, auth) — not on other domains.
- No cross-domain model imports or shared product tables.
- Register routes, policies, and bindings only in that domain’s `DomainServiceProvider`.
- Mirror tests at `laravel/tests/Feature/Domains/{Feature}/`.
- Document the feature at `docs/features/{feature}.md`.
- Keep domain schema normalised (3NF); see [Database](../conventions/database.md).

## Add checklist

1. Create the domain folder and provider.
2. Register the provider (bootstrap / config) for this domain only.
3. Add wiki page from [`features/_template.md`](../features/_template.md) and link it in [`README.md`](../README.md).
4. Add Feature tests.
5. Run `cd laravel && php artisan test`.

## Remove checklist

1. Unregister the provider / routes.
2. Delete the domain folder, wiki page (and index link), and Feature tests.
3. Confirm remaining tests pass.
