# Directus CMS Setup This directory contains configuration for Directus, the headless CMS powering Hotel Pi. ## Quick Setup 1. **Access Directus Admin:** ``` http://localhost:8055 ``` 2. **Create Collections:** - Log in with your credentials - Navigate to Settings → Data Model - Create the following collections: ### Restaurants Collection Create a new collection with these fields: | Field | Type | Notes | |-------|------|-------| | `id` | UUID | Primary key (auto) | | `name` | String | Required | | `description` | Text | Optional | | `cuisine_type` | String | E.g., "Italian", "Asian" | | `website_url` | String | Optional | | `phone` | String | Optional | | `image` | Image | File upload | | `status` | Status | Default: "published" | ### Attractions Collection Create a new collection with these fields: | Field | Type | Notes | |-------|------|-------| | `id` | UUID | Primary key (auto) | | `name` | String | Required | | `description` | Text | Optional | | `category` | String | E.g., "Museum", "Park" | | `distance_km` | Number (decimal) | Optional | | `image` | Image | File upload | | `website_url` | String | Optional | | `hours` | Text | Operating hours | | `status` | Status | Default: "published" | ## API Access Once collections are created, they're automatically available via REST API: ```bash # Get all restaurants curl http://localhost:8055/items/restaurants # Get all attractions curl http://localhost:8055/items/attractions # With images curl http://localhost:8055/items/restaurants?fields=*,image.* ``` ## Authentication For public access, configure roles and permissions: 1. Go to Settings → Roles & Permissions 2. Create a "Public" role 3. Grant read access to restaurants and attractions collections ## File Storage By default, Directus stores uploads in `uploads/` directory. In Docker, this is a mounted volume. ## Backups To backup your Directus data: ```bash docker-compose exec postgres pg_dump -U directus directus > backup.sql ``` To restore: ```bash docker-compose exec -T postgres psql -U directus directus < backup.sql ```