Skip to content

MongoDB Data Model

VideoSphere stores application data in MongoDB via Mongoose models in lib/models/.

Collections

CollectionModelPurpose
user_profilesUserProfileAccounts, roles, preferences
draftsDraftUpload metadata drafts (document JSON string)
upload_jobsUploadJobR2 staging upload jobs linked to drafts
platform_uploadsPlatformUploadPer-platform distribution attempts and snapshots
connected_accountsConnectedAccountOAuth tokens and backup credentials (encrypted)
livestreamsLivestreamScheduled YouTube/Facebook livestream metadata
live_translation_channelsLiveTranslationChannelPer-user live audio translation credentials, languages, public slug, stream key hash + encrypted plaintext
youtube_import_jobsYoutubeImportJobYouTube URL import jobs (yt-dlp → R2 → distribute)
invitesInviteTokenAdmin invite tokens for signup
password_reset_tokensPasswordResetTokenPassword reset links

ID and Timestamp Conventions

  • Document IDs are strings (_id: String) to match existing app-level IDs.
  • Mongoose timestamps: true provides createdAt and updatedAt.
  • Shared API/repository output continues to expose $createdAt and $updatedAt as ISO strings for compatibility.

Draft and Platform Upload Document Payloads

  • drafts.document stores JSON string payload for draft metadata.
  • platform_uploads.document stores JSON snapshot captured at distribution time.

See draft-document-and-upload-testing.md for full payload shape and manual upload flow.

Encryption at Rest for Connected Account Secrets

Connected account tokens, SFTP credentials, SMB credentials, SermonAudio API keys, and live-translation OpenRouter / Groq / GCP service-account secrets (and the recoverable RTMP stream key) are encrypted before persistence.

Supported connected_accounts.platform values:

PlatformConnect method
youtubeOAuth
vimeoOAuth
google_driveOAuth
facebookOAuth (page/profile selection)
sftpForm (host, user, key or password)
smbForm (host, share, domain, credentials)
sermon_audioForm (API key)

Migration Notes

If you are migrating existing datasets, keep the same string IDs and unique constraints used by the models so route/repository behavior remains unchanged.