Decisions
One bucket with a prefix per hotel
All hotels share one S3 compatible bucket. Each hotel's files live under its own prefix.
Status: accepted, November 2026
Context
Hotels have logos, QR posters and exports that need storage.
Decision
One bucket, a folder prefix per hotel, and access always resolved from the hotel id.
How it works
- Every hotel key starts with
hotels/<hotelId>/(after the preview prefixpr-<n>/on previews). Keys are built only byhotelPrefixandhotelPublicPrefixin@le-hoetel/storage, from the hotel id of the session, never from input. - Public files (logos) live in
hotels/<hotelId>/public/. Everything else under a hotel is private. - Logo upload is three calls:
hotel.logo.uploadUrl(type and size checked, returns a 5 minute presigned PUT), the browser PUTs the file straight to the bucket (the bucket needs a CORS rule allowing PUT from the dashboard origin), thenhotel.logo.setchecks the key is in that hotel's public folder, reads the stored type and size (PNG, JPEG or WebP, 1 MB at most, anything else is deleted) and saveshotel_settings.logo_key.logoKeycan't be set throughhotel.update. /files/<key>is unauthenticated and only redirects for avatars andhotels/<id>/public/keys. Another hotel's private prefix is a 404.
Why
- Less operations work: one bucket to back up, monitor and secure.
- A bucket per client adds cost and setup for no gain unless a hotel asks for data separation.
Why not
- A bucket per client: stronger separation, more to run.
Consequences
- Every storage call must be scoped by hotel id. Isolation is enforced in code, not by the bucket.
- We can move one hotel into its own bucket later if it asks.
Revisit when
A hotel requires physical data separation.