refactor(backend): reorganize domains into Core, Commerce, Ticketing and Shared
This commit is contained in:
48
AGENTS.md
48
AGENTS.md
@@ -8,18 +8,22 @@
|
||||
|
||||
## Architecture
|
||||
|
||||
This project uses a domain-oriented structure under `app/Domains`.
|
||||
This project uses a domain-oriented structure grouped by business area under
|
||||
`app/Domains`. Cross-cutting modules live under `app/Shared`.
|
||||
|
||||
Each domain must live in:
|
||||
Business domains must live in:
|
||||
|
||||
```text
|
||||
app/Domains/<DomainName>/
|
||||
app/Domains/<Area>/<DomainName>/
|
||||
```
|
||||
|
||||
The current areas are `Core`, `Commerce`, and `Ticketing`. Cross-cutting
|
||||
modules live in `app/Shared/<ModuleName>/`.
|
||||
|
||||
Supported folders inside each domain:
|
||||
|
||||
```text
|
||||
app/Domains/<DomainName>/
|
||||
app/Domains/<Area>/<DomainName>/
|
||||
├── Models/
|
||||
├── Controllers/
|
||||
├── Requests/
|
||||
@@ -34,22 +38,28 @@ app/Domains/<DomainName>/
|
||||
|
||||
- Root API routes live in `routes/api.php`.
|
||||
- `routes/api.php` should act as an aggregator only.
|
||||
- Each domain defines its own routes in `app/Domains/<DomainName>/routes/api.php`.
|
||||
- Each business domain defines its own routes in
|
||||
`app/Domains/<Area>/<DomainName>/routes/api.php`.
|
||||
- Shared modules that expose routes define them in
|
||||
`app/Shared/<ModuleName>/routes/api.php`.
|
||||
|
||||
## Namespaces
|
||||
|
||||
Use this namespace pattern:
|
||||
|
||||
```php
|
||||
App\Domains\<DomainName>\Models
|
||||
App\Domains\<DomainName>\Controllers
|
||||
App\Domains\<DomainName>\Requests
|
||||
App\Domains\<DomainName>\Resources
|
||||
App\Domains\<DomainName>\Services
|
||||
App\Domains\<DomainName>\Policies
|
||||
App\Domains\<DomainName>\Exceptions
|
||||
App\Domains\<Area>\<DomainName>\Models
|
||||
App\Domains\<Area>\<DomainName>\Controllers
|
||||
App\Domains\<Area>\<DomainName>\Requests
|
||||
App\Domains\<Area>\<DomainName>\Resources
|
||||
App\Domains\<Area>\<DomainName>\Services
|
||||
App\Domains\<Area>\<DomainName>\Policies
|
||||
App\Domains\<Area>\<DomainName>\Exceptions
|
||||
```
|
||||
|
||||
For cross-cutting modules, use `App\Shared\<ModuleName>\...`. Reusable enums
|
||||
and rules live directly under `App\Shared`.
|
||||
|
||||
## Responsibilities
|
||||
|
||||
- `Models/`: Eloquent models and model relationships.
|
||||
@@ -80,13 +90,19 @@ App\Domains\<DomainName>\Exceptions
|
||||
- Namespace, folder, and class names must stay aligned.
|
||||
- Route files should be named `api.php`.
|
||||
|
||||
## Current Domains
|
||||
## Current Areas and Modules
|
||||
|
||||
- `Tenant`
|
||||
- `Product`
|
||||
- `Core`: `Administrator`, `Auth`, `Authorization`, `Bootstrap`, `Client`,
|
||||
`Menu`, `Staff`, `Tenant`.
|
||||
- `Commerce`: `Cart`, `Catalog`, `Purchase`, `Sale`.
|
||||
- `Ticketing`: `Desfile`, `Event`, `FiestaFutbolInfantil`, `Ticket`.
|
||||
- `Shared`: `Attachable`, `Forms`, `Integration`, `Logging`, `MailTest`,
|
||||
`Notification`, `StorageTest`, plus shared enums and rules.
|
||||
|
||||
## Notes For Future Changes
|
||||
|
||||
- New features should be added inside the corresponding domain first.
|
||||
- If a concern does not belong to an existing domain, create a new domain under `app/Domains`.
|
||||
- Add new business features to the appropriate area under `app/Domains`.
|
||||
- Keep generic reusable code in `app/Shared`; do not use it as a catch-all for
|
||||
business features.
|
||||
- Avoid placing new business code in `app/Http/Controllers` or `app/Models`.
|
||||
|
||||
Reference in New Issue
Block a user