2.1 KiB
2.1 KiB
Directus CMS Setup
This directory contains configuration for Directus, the headless CMS powering Hotel Pi.
Quick Setup
-
Access Directus Admin:
http://localhost:8055 -
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:
# 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:
- Go to Settings → Roles & Permissions
- Create a "Public" role
- 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:
docker-compose exec postgres pg_dump -U directus directus > backup.sql
To restore:
docker-compose exec -T postgres psql -U directus directus < backup.sql