Digital Sanctuary Data Model

This document describes the backend data model for Digital Sanctuary. It is intended to guide the first database build from the local-first MVP toward a hosted product with users, walls, sharing, NFC links, uploaded media, folders, and playlists.

Modeling Principles

Entity Overview

Tables

users

Stores the person who owns walls.

FieldTypeNotes
idUUIDPrimary key.
emailTextUnique when using email auth.
display_nameTextUser-facing name.
avatar_asset_idUUID nullableReferences assets.id.
created_atTimestampCreation time.
updated_atTimestampLast profile update.

MVP notes:

walls

Stores the wall itself, its atmosphere settings, ownership, and visibility.

FieldTypeNotes
idUUIDPrimary key.
owner_user_idUUIDReferences users.id.
titleTextWall name.
slugText nullableOptional human-readable URL segment.
visibilityEnumprivate, public, later unlisted or invite_only.
mode_defaultEnumUsually visit for shared links, edit for owner sessions.
materialTextCurrent MVP values include hearth, smoke-hearth, smoke-garden, smoke-moonroom, light, greenhouse, brick, concrete, gallery, plaster, wood.
location_labelTextFreeform "Where is this?" value.
window_positionTextleft, center, right, none.
lightingTextCurrent MVP values include morning, golden, night, spotlight.
time_of_dayText nullableOptional product-level value if it differs from lighting.
window_view_typeEnumpreset, prompt, image, or none.
window_view_presetText nullableSelected outside-window preset. Live MVP values: city (New York skyline), ocean, mountain, farmland (stored as wallConfig.windowView).
window_view_promptText nullableUser prompt for outside-window scene.
window_view_asset_idUUID nullableReferences generated/uploaded assets.id.
grid_sizeIntegerDefault snap-grid size.
canvas_widthInteger nullableOptional canonical wall coordinate width.
canvas_heightInteger nullableOptional canonical wall coordinate height.
created_atTimestampCreation time.
updated_atTimestampLast wall metadata update.
deleted_atTimestamp nullableSoft delete.

MVP notes:

wall_items

Stores every object positioned on the wall.

FieldTypeNotes
idUUIDPrimary key.
wall_idUUIDReferences walls.id.
typeEnumartwork, quote, note, shelf, lamp, plant, folder, music_player, later more.
catalog_item_idUUID nullableReferences object_catalog_items.id if created from catalog.
titleTextDisplay title.
body_textText nullableQuote/note text or object description.
meaningText nullableWhy this belongs on the wall.
variantTextStyle variant, such as frame or folder style.
colorTextHex color or design token.
xNumericWall coordinate.
yNumericWall coordinate.
widthNumericRender width.
heightNumericRender height.
z_indexIntegerStacking order.
rotationNumericOptional later support.
is_lockedBooleanPrevent accidental movement.
metadataJSONType-specific state that does not deserve first-class columns yet.
created_atTimestampCreation time.
updated_atTimestampLast item update.
deleted_atTimestamp nullableSoft delete.

MVP notes:

assets

Tracks uploaded, linked, or generated files.

FieldTypeNotes
idUUIDPrimary key.
owner_user_idUUIDReferences users.id.
source_typeEnumupload, external_url, generated, imported_data_url.
kindEnumimage, audio, video, document, other.
storage_keyText nullablePath/key in object storage.
external_urlText nullableOriginal URL when not stored locally.
mime_typeText nullableContent type.
file_nameText nullableOriginal file name.
file_size_bytesInteger nullableFile size.
widthInteger nullableImage/video width.
heightInteger nullableImage/video height.
promptText nullablePrompt used for generated assets.
alt_textText nullableAccessibility description.
created_atTimestampCreation time.

MVP notes:

wall_item_assets

Connects assets to wall items.

FieldTypeNotes
idUUIDPrimary key.
wall_item_idUUIDReferences wall_items.id.
asset_idUUIDReferences assets.id.
roleEnumprimary_image, thumbnail, attachment, reference, window_view.
sort_orderIntegerOrdering for multiple attachments.
created_atTimestampCreation time.

MVP notes:

folders

Stores folder-specific state for a wall item of type folder.

FieldTypeNotes
idUUIDPrimary key.
wall_item_idUUIDUnique reference to wall_items.id.
folder_typeEnumwork_in_progress, project, moodboard, manifestation, custom.
descriptionText nullableOptional folder summary.
created_atTimestampCreation time.
updated_atTimestampLast folder update.

MVP notes:

folder_pages

Stores pages or entries inside a folder.

FieldTypeNotes
idUUIDPrimary key.
folder_idUUIDReferences folders.id.
titleTextPage title.
visionText nullableMain notes, intention, or draft description.
remindersText nullableNext steps or reminders.
linksText nullableMVP-compatible newline-separated links. Later this can normalize to folder_page_links.
moodText nullableCurrent MVP values include hopeful, calm, focused, energized, nostalgic.
image_asset_idUUID nullableReferences assets.id.
image_urlText nullableTemporary external visual reference URL.
sort_orderIntegerPage ordering.
metadataJSONTemplate-specific fields.
created_atTimestampCreation time.
updated_atTimestampLast page update.
deleted_atTimestamp nullableSoft delete.

MVP notes:

playlists

Stores a playlist associated with either a wall or a specific music-player item.

FieldTypeNotes
idUUIDPrimary key.
wall_idUUIDReferences walls.id.
wall_item_idUUID nullableReferences wall_items.id for item-specific playlists.
titleTextPlaylist name.
active_track_idUUID nullableReferences playlist_tracks.id.
created_atTimestampCreation time.
updated_atTimestampLast playlist update.

MVP notes:

playlist_tracks

Stores tracks for a playlist.

FieldTypeNotes
idUUIDPrimary key.
playlist_idUUIDReferences playlists.id.
titleTextTrack title.
artistText nullableArtist or channel.
urlTextSource URL.
providerEnumyoutube, spotify, soundcloud, external, unknown.
provider_track_idText nullableProvider-specific ID when parsed.
embed_urlText nullableCached embed URL if supported.
sort_orderIntegerTrack ordering.
created_atTimestampCreation time.
updated_atTimestampLast track update.

MVP notes:

share_links

Stores stable share URLs for walls or specific wall items.

FieldTypeNotes
idUUIDPrimary key.
wall_idUUIDReferences walls.id.
target_typeEnumwall, wall_item, folder_page.
target_idUUID nullableID of item/page when not sharing the whole wall.
tokenTextUnique opaque URL token.
modeEnumvisit, later edit_invite.
is_activeBooleanCan disable a shared link.
created_by_user_idUUIDReferences users.id.
created_atTimestampCreation time.
expires_atTimestamp nullableOptional expiration.
last_accessed_atTimestamp nullableUseful for analytics/debugging.

MVP notes:

nfc_links

Stores NFC sticker bindings.

FieldTypeNotes
idUUIDPrimary key.
wall_idUUIDReferences walls.id.
share_link_idUUID nullableReferences share_links.id.
target_typeEnumwall, wall_item, folder_page.
target_idUUID nullableDestination when linking to a specific object/page.
labelText nullableUser-facing sticker name, such as Bedroom wall NFC.
tokenTextUnique opaque NFC URL token.
is_activeBooleanCan deactivate a lost sticker.
created_atTimestampCreation time.
last_scanned_atTimestamp nullableLast successful open.

MVP notes:

object_catalog_items

Defines the object types and variants the user can add from the catalog.

FieldTypeNotes
idUUIDPrimary key.
typeEnumMatches wall_items.type.
variantTextStyle variant key.
labelTextCatalog label.
descriptionText nullableOptional internal/product description.
default_widthNumericDefault item width.
default_heightNumericDefault item height.
default_colorTextHex color or token.
default_metadataJSONDefault type-specific state.
is_activeBooleanHide/show in catalog.
sort_orderIntegerCatalog ordering.
created_atTimestampCreation time.
updated_atTimestampLast catalog update.

MVP notes:

wall_events

Optional activity stream for sync, debugging, undo history, or future collaboration.

FieldTypeNotes
idUUIDPrimary key.
wall_idUUIDReferences walls.id.
user_idUUID nullableActor, if known.
event_typeTextExamples: item_created, item_moved, visibility_changed, share_link_created.
entity_typeText nullableAffected entity type.
entity_idUUID nullableAffected entity ID.
payloadJSONEvent details.
created_atTimestampCreation time.

MVP notes:

Relationships

Recommended MVP Build Order

1. users 2. walls 3. wall_items 4. assets 5. wall_item_assets 6. folders 7. folder_pages 8. playlists 9. playlist_tracks 10. share_links 11. nfc_links

Defer object_catalog_items and wall_events unless the first backend also needs remote-configurable catalog data or history.

Important Enums

Suggested starting values:

Data To Migrate From Local MVP

Current localStorage wall state can map into backend records like this:

Open Backend Decisions