Skip to the content.

Database selection and request routing

The global hook selects BlogPostStore on every request; message handlers authenticate and separately select MessageStore. Invalid query/header values fall through. An empty/invalid allow-list skips the restriction. Switching does not copy data. The browser session starts at sqlite; the selector uses the configured default only if the current selection is disallowed. CDN selection chooses a sync source folder, not a bucket; DAM backend selection is separate.

sequenceDiagram
  actor U as Administrator
  participant D as Database selector
  participant S as Session state
  participant P as Blog or messages page
  participant F as adminFetch
  participant N as Nitro hook and handler
  participant C as Backend store cache
  U->>D: Select sqlite, postgres or dynamodb
  D->>S: setDatabase and persist
  S-->>P: Watcher fires
  P->>F: Reload current data
  F->>N: Request with X-Admin-Database
  N->>N: Valid query db, else header, else configured default
  N->>N: Check nonempty allowed database list
  N->>C: Lookup store by backend
  alt Cache miss
    C->>C: Factory with explicit dataBackend
    C->>C: Cache for process reuse
  end
  C-->>N: Selected adapter
  N->>N: Route authentication and service execution
  N-->>P: Data from selected backend

Source evidence