Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
N

nestjs-keycloak-admin

> 后端框架
Open source

Keycloak client and admin provider for Nest.js applications with built-in User Managed Access (UMA) and ACL support.

191 stars0 likes1 views
WebsiteGitHub

About

Keycloak client and admin provider for Nest.js applications with built-in User Managed Access (UMA) and ACL support.

Keycloak for Nest.js

Installation

Install using npm i --save nestjs-keycloak-admin or pnpm add nestjs-keycloak-admin

ESM restriction

  • Due to @keycloak/keycloak-admin-client package, nestjs-keycloak-admin can't support CommonJS at the moment. The team behind keycloak-admin-client made the decision to have a breaking change and support CommonJS. Please refer to this Github issue for more information about their decision-making process.
  • You need to switch to ESM to run this package without any issues. Please refer to this Github gist for more information.

Initialize KeycloakModule

Then on your app.module.ts

…

Resource Management using User Managed Access (UMA)

By default nestjs-keycloak-admin supports User Managed Access for managing your resources.

…

Decorators

typescript
@Get('/hello')
@Roles({roles: ['realm:admin'], mode: RoleMatchingMode.ANY})
sayHello(@User() user: KeycloakUser, @AccessToken() accessToken): string {
  return `life is short. -${user.email}/${accessToken}`
}

Here is the decorators you can use in your controllers.

Decorator Description
@User Retrieves the current Keycloak logged-in user. (must be per method, unless controller is request scoped.)
@AccessToken Retrieves the current access token. (must be per method, unless controller is request scoped.)
@DefineResource Define the keycloak application resource name.
@DefineScope Define the keycloak resource scope (ex: 'create', 'read', 'update', 'delete')
@EnforceResource
@FetchResources
@Public Allow any user to use the route.
@Roles Keycloak realm/application roles. Prefix any realm-level roles with "realm:" (i.e realm:admin)

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

TypeScriptjavascriptkeycloaknestnestjs

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category后端框架
PricingOpen source

> Related tools

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架