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
- core/admin/app/components/AdminDatabaseSelector.vue:39 — const onChange
- packages/web-layer-admin/app/composables/useAdminSession.ts:9 — export const useAdminSession
- packages/web-layer-admin/app/utils/admin-fetch.ts:67 — export function adminFetchOptions
- core/admin/server/utils/admin-database.ts:60 — export const resolveAdminDatabase
- core/admin/server/utils/admin-database.ts:137 — const messageStoreCache
- core/admin/server/plugins/admin-blog.ts:19 — nitroApp.hooks.hook(‘request’
- packages/web-layer-admin/app/pages/admin/blog/index.vue:93 — const loadPosts
- core/admin/app/pages/admin/messages/index.vue:62 — const loadMessages