Provision With Handles, Not Request Plumbing
Start from a realm and move through users, groups, roles, clients, identity providers, organizations, workflows, and authentication flows with resource-scoped handles.
Keycloak Fluent turns the official admin client into a fluent DSL for realms, users, clients, authentication flows, organizations, and operational endpoints. The docs now track the real API surface exercised in `src` and `tests`.
import KeycloakAdminClientFluent from '@egose/keycloak-fluent';
const kc = new KeycloakAdminClientFluent({
baseUrl: 'http://localhost:8080',
realmName: 'master',
});
await kc.simpleAuth({
username: 'admin',
password: 'admin', // pragma: allowlist secret
});
const realm = await kc.realm('demo').ensure({
displayName: 'Demo Realm',
});
const user = await realm.user('alice').ensure({
email: 'alice@example.com',
enabled: true,
});
await realm.organization('acme').ensure({ name: 'Acme Corp' });
await realm.authenticationFlow('browser-copy').copy('browser-copy-v2');
await realm.cache().clearUserCache();
await kc.whoAmI('master').get();Why teams use it
Start from a realm and move through users, groups, roles, clients, identity providers, organizations, workflows, and authentication flows with resource-scoped handles.
Use ensure and discard to write repeatable setup code for local environments, CI jobs, migrations, and tenant provisioning.
The fluent layer also covers cache maintenance, attack detection, user storage provider sync, client policies, server info, and who-am-i lookups.
Current coverage
The landing page and docs now line up with the actual codebase. That includes the resource handles people expect, plus the operational endpoints that usually force teams back into raw admin client calls.
Install the package, authenticate with `simpleAuth`, and create your first realm-scoped handles.
Jump straight into root helpers, realm handles, identity provider mappers, workflows, and system endpoints.
Start from an overview, then jump into focused walkthroughs for realm bootstrap, identity setup, clients, and mappers.
Readable automation
Use the fluent handles for day-to-day provisioning, and drop down to the underlying client whenever you need something lower level. The library stays close to Keycloak instead of inventing a parallel model.