# Auto-Generated API Docs

Turista includes Laravel Request Docs, which generates interactive API documentation from your routes and Form Request classes.

## What it covers

Laravel Request Docs can display:

- All registered routes.
- HTTP methods and paths.
- Request validation rules derived from Form Requests.
- Middleware applied to each route.
- Bearer token authentication support for testing endpoints.

## Enabling the docs

Set the environment variable:

```env
REQUEST_DOCS_ENABLED=true
```

Then clear the config cache if running in production:

```bash
php artisan config:clear
```

## Accessing the docs

When enabled, visit:

```
https://{your-domain}/request-docs
```

The UI allows you to authenticate with a bearer token and make test requests against the API.

## Generating static files

Laravel Request Docs can generate `api.json` and `routes.json` for external consumers. To regenerate them:

```bash
php artisan route:docs
```

> Check the package documentation for the exact command if this differs.

## Security

Keep `REQUEST_DOCS_ENABLED=false` in production. The generated `api.json` and `routes.json` files reveal endpoint structure, middleware, and controllers. Consider adding them to `.gitignore` and generating them only in build pipelines.

## Manual docs vs. auto-generated docs

The documentation in this `docs/api/` directory explains concepts, roles, and workflows. Laravel Request Docs provides the exhaustive endpoint-level schemas. Use both together: start here for context, then use Request Docs for precise payloads.
