@andreyyolkin/keycloakify-vue
v0.1.2
Published
Vue Components for Keycloakify
Readme
@andreyyolkin/keycloakify-vue
Vue 3 components for building Keycloak login themes with Keycloakify.
@andreyyolkin/keycloakify-vue is a community Vue 3 port of Keycloakify's UI layer, mirroring the architecture of
@keycloakify/svelte. It reuses Keycloakify's
framework-agnostic build tooling and core logic via a peer dependency — only the Vue UI layer (layer 3)
is reimplemented here. You write your Keycloak theme in Vue; keycloakify handles the build + jar
packaging unchanged.
Status
| Theme | Status |
| ----------- | --------------------------------------------------------------------------------------------------------------------------- |
| Login | Complete — all 38 login pages ported, including register.ftl / UserProfileFormFields |
| Account | Complete — all 7 classic account pages ported (account, password, sessions, totp, applications, log, federatedIdentity) |
| Admin/Email | Out of scope |
Installation
npm install --save-dev @andreyyolkin/keycloakify-vuePeer dependencies: keycloakify ^11.15.1 and vue ^3.5.0 must be installed in your project.
The easiest way to get started is the official starter template:
- keycloakify-starter-vue — a ready-to-use
Vite + Vue project wired to
@andreyyolkin/keycloakify-vue, analogous tokeycloakify-starter-svelte.
What's Included
DefaultPage— top-level dispatcher component that routes all 38 loginpageIdvalues to the correct page component.Template— the outer page shell (header, info/error alerts, social providers, language switcher).- Per-page components — importable individually from
@andreyyolkin/keycloakify-vue/login/pages/*.vue(e.g.Login.vue,Register.vue,LoginOtp.vue, …). UserProfileFormFields— full dynamic user-profile form suite used byRegister,LoginUpdateProfile, andIdpReviewUserProfile.i18nBuilder— factory for wiring Keycloakify'snoJsxi18n engine into Vue (returnsmsg()/advancedMsg()that produce sanitizedVNodes).- Account theme — importable from
@andreyyolkin/keycloakify-vue/account: its ownDefaultPage+Template, the 7 account pages at@andreyyolkin/keycloakify-vue/account/pages/*.vue, and an accounti18nBuilder. binhandlers —_keycloakify-custom-handlerdelegatesupdate-kc-gen,eject-page,add-story, andinitialize-account-themeso thekeycloakifyCLI treats your project as a Vue theme.
Usage
Clone or scaffold from the starter for the
full wiring. At its core a consumer project has a KcPage.vue that looks like:
<script setup lang="ts">
import { DefaultPage } from '@andreyyolkin/keycloakify-vue';
import type { KcContext } from './KcContext';
import { useI18n } from './i18n';
import Template from '@andreyyolkin/keycloakify-vue/login/Template.vue';
const props = defineProps<{ kcContext: KcContext }>();
const { i18n } = useI18n({ kcContext: props.kcContext });
</script>
<template>
<DefaultPage
:kcContext
:i18n
:Template
/>
</template>How It Works / Relationship to Keycloakify
Keycloakify is built in three layers:
- Build tooling / CLI (
keycloakify/bin,keycloakify/vite-plugin) — framework-agnostic. Reads a built SPA, rewrites asset paths to FreeMarker variables, generates.ftltemplates, packages the theme.jar. - Core logic (
KcContexttypes,i18n/noJsx,getUserProfileApi,kcClsx,kcSanitize) — deliberately framework-agnostic. - UI components — the only framework-coupled layer.
@andreyyolkin/keycloakify-vue reuses layers 1 and 2 unchanged (via the keycloakify peer dependency) and
reimplements layer 3 in Vue 3.
Distribution: the package ships raw .vue single-file components plus .d.ts types. Your project's
Vite + @vitejs/plugin-vue compiles them — no pre-bundled JS is shipped.
Contributing
git clone https://github.com/AndreyYolkin/keycloakify-vue
git clone https://github.com/AndreyYolkin/keycloakify-starter-vue
cd keycloakify-vue
yarn install
yarn link-in-starter # links the built package into the starterChanges to the library are reflected in the starter after yarn build (or yarn watch).
Issues and pull requests are welcome at github.com/AndreyYolkin/keycloakify-vue.
License
MIT
