> For AI agents: the complete documentation index is available at /en/llms.txt, the full documentation bundle is available at /en/llms-full.txt.

# Backend Overview

The backend is a Laravel 13 application requiring PHP 8.3. It follows Laravel conventions while adding attribute routes, shared responses, and system management models as a foundation for admin development.

## Main layers

| Location                      | Responsibility                                                                       |
| ----------------------------- | ------------------------------------------------------------------------------------ |
| `app/Http/Controllers/Admin/` | Admin endpoints for users, roles, departments, dictionaries, files, settings, and AI |
| `app/Http/Controllers/Api/`   | Endpoints for other clients                                                          |
| `app/Http/Requests/Admin/`    | Admin form validation and request handling                                           |
| `app/Models/`                 | Eloquent models and relationships                                                    |
| `app/Services/`               | Business services such as file handling                                              |
| `app/Trait/RequestJson.php`   | Success, error, warning, and notification responses                                  |
| `database/migrations/`        | System, user, job, and AI table definitions                                          |
| `database/seeders/`           | Initial accounts, roles, menu permissions, and site settings                         |

## Authentication and user model

The project uses Laravel Sanctum personal access tokens. `AppServiceProvider` configures `SysAccessToken` as the token model, while `SysUserModel` is the default authenticated user. The frontend reads the token from local storage and sends it as a Bearer token.

## Base controller capabilities

`BaseController` provides shared list-query logic:

- Field filters and quick keyword searches;
- Date-range queries;
- Frontend sorter conversion;
- Controller-level `searchField` and `quickSearchField` declarations.

Business controllers remain responsible for model operations, validation, and responses, while `RequestJson` creates the shared response envelope.

## Next steps

- [Attribute Routes & Permissions](/en/backend/routing.md): Declare paths, HTTP methods, and permission keys.
- [API Response Conventions](/en/backend/api-conventions.md): Understand `success`, `data`, `msg`, and `showType`.
