feat: config portability with generic entity resolver framework

Full configuration export/import system for Homarr with excellent DX:
- Export/import boards, apps, integrations (with re-encrypted secrets),
  users (with bcrypt hashes), groups (with permissions and memberships),
  search engines, and server settings
- Homepage services.yaml import with widget-type mapping
- Generic resolveEntities() utility eliminates per-entity boilerplate
- Declarative entity-fields.ts: adding a new user preference requires
  only one line change (no export/import/schema edits needed)
- User schema uses .catchall(z.unknown()) for forward-compatible prefs
- groupByKey() utility replaces manual Map-building
- CONFIG_ENTITY_KEYS as single source of truth for entity metadata
- Reuse existing entities (apps by name+icon+href, integrations by
  kind+name+url, users by email, groups by name, boards by name)
- Skip duplicates with warnings rather than failing
- Onboarding flow skips user creation step when config includes users
- Reuse existing admin group during onboarding after config import
This commit is contained in:
Thomas Camlong committed 2026-06-06 16:22:59 +02:00
1 parent 1f7b7f0516
commit f6a598b774
48 files changed
+1869 -1435

No files matched your search

@@ -0,0 +1,57 @@
import type { IntegrationKind } from "./integration";
import type { IntegrationSecretKind } from "./integration";
import type { WidgetKind } from "./widget";
export interface HomepageWidgetMapping {
integrationKind: IntegrationKind;
widgetKind: WidgetKind;
secretFieldMap: Record<string, IntegrationSecretKind>;
}
export const homepageWidgetMap: Record<string, HomepageWidgetMapping | null> = {
sonarr: { integrationKind: "sonarr", widgetKind: "downloads", secretFieldMap: { key: "apiKey" } },
radarr: { integrationKind: "radarr", widgetKind: "downloads", secretFieldMap: { key: "apiKey" } },
lidarr: { integrationKind: "lidarr", widgetKind: "downloads", secretFieldMap: { key: "apiKey" } },
readarr: { integrationKind: "readarr", widgetKind: "downloads", secretFieldMap: { key: "apiKey" } },
prowlarr: { integrationKind: "prowlarr", widgetKind: "indexerManager", secretFieldMap: { key: "apiKey" } },
bazarr: null,
jellyfin: { integrationKind: "jellyfin", widgetKind: "mediaServer", secretFieldMap: { key: "apiKey" } },
emby: { integrationKind: "emby", widgetKind: "mediaServer", secretFieldMap: { key: "apiKey" } },
plex: { integrationKind: "plex", widgetKind: "mediaServer", secretFieldMap: { key: "apiKey" } },
jellyseerr: {
integrationKind: "jellyseerr",
widgetKind: "mediaRequests-requestList",
secretFieldMap: { key: "apiKey" },
},
overseerr: {
integrationKind: "overseerr",
widgetKind: "mediaRequests-requestList",
secretFieldMap: { key: "apiKey" },
},
tautulli: null,
sabnzbd: { integrationKind: "sabNzbd", widgetKind: "downloads", secretFieldMap: { key: "apiKey" } },
nzbget: { integrationKind: "nzbGet", widgetKind: "downloads", secretFieldMap: { key: "apiKey" } },
deluge: { integrationKind: "deluge", widgetKind: "downloads", secretFieldMap: { password: "password" } },
transmission: {
integrationKind: "transmission",
widgetKind: "downloads",
secretFieldMap: { username: "username", password: "password" },
},
qbittorrent: {
integrationKind: "qBittorrent",
widgetKind: "downloads",
secretFieldMap: { username: "username", password: "password" },
},
pihole: { integrationKind: "piHole", widgetKind: "dnsHoleSummary", secretFieldMap: { key: "apiKey" } },
adguard: {
integrationKind: "adGuardHome",
widgetKind: "dnsHoleSummary",
secretFieldMap: { username: "username", password: "password" },
},
homeassistant: {
integrationKind: "homeAssistant",
widgetKind: "smartHome-entityState",
secretFieldMap: { key: "apiKey" },
},
proxmox: { integrationKind: "proxmox", widgetKind: "healthMonitoring", secretFieldMap: {} },
};
+1
View File
@@ -17,3 +17,4 @@ export * from "./emptysuperjson";
export * from "./hotkeys";
export * from "./docker-integration-match";
export * from "./integration-url-template";
export * from "./homepage-widget-map";