Using Multiple Realms in NodeJS App

I need to divide users into different realms but the documentation around setting up the Keycloak NodeJS Adapter seems to be written as if the app is meant to use only one realm. In my use case, I won’t know which realm the user belongs to until they try to log in, at which point it’s too late to register the Keycloak middleware. I can probably find a way around this, but it feels like I’m working against the library. Is there some documentation or guidance around supporting multiple realms in an app? The motivation around having separate realms is so that IDPs can be scoped to specific realms.