
Security News
Feross on the 10 Minutes or Less Podcast: Nobody Reads the Code
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.
@servlyadmin/runtime-vue
Advanced tools
Vue 3 wrapper for Servly runtime renderer. Render Servly components in your Vue applications with full slot support, state management, and reactive updates.
npm install @servlyadmin/runtime-vue
# or
yarn add @servlyadmin/runtime-vue
# or
pnpm add @servlyadmin/runtime-vue
<template>
<!-- That's it! Components are fetched from Servly's registry automatically -->
<ServlyComponent
id="my-component-id"
:props="{ title: 'Hello World' }"
/>
</template>
<script setup lang="ts">
import { ServlyComponent } from '@servlyadmin/runtime-vue';
</script>
Components are fetched from Servly's production registry by default:
https://core-api.servly.app/v1/views/registryTo use a custom registry:
import { setRegistryUrl } from '@servlyadmin/runtime-vue';
setRegistryUrl('https://your-api.com/v1/views/registry');
The runtime supports three caching strategies:
| Strategy | Description | Persistence | Best For |
|---|---|---|---|
localStorage | Persists across browser sessions | Yes | Production (default) |
memory | In-memory cache, cleared on refresh | No | Development, SSR |
none | No caching, always fetches fresh | No | Testing, debugging |
<template>
<!-- Default: localStorage caching -->
<ServlyComponent id="my-component" />
<!-- Explicit cache strategy -->
<ServlyComponent id="my-component" cache-strategy="memory" />
<!-- No caching -->
<ServlyComponent id="my-component" cache-strategy="none" />
</template>
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | required | Component ID from the registry |
version | string | 'latest' | Version specifier (exact, range, or "latest") |
props | object | {} | Props to pass to the component |
cacheStrategy | 'localStorage' | 'memory' | 'none' | 'localStorage' | Caching strategy |
retryConfig | object | undefined | Retry configuration for failed fetches |
eventHandlers | object | undefined | Event handlers keyed by element ID |
showSkeleton | boolean | true | Show loading skeleton |
enableStateManager | boolean | false | Enable built-in state management |
initialState | object | undefined | Initial state for state manager |
| Event | Payload | Description |
|---|---|---|
load | ComponentData | Emitted when component loads successfully |
error | Error | Emitted when component fails to load |
stateChange | StateChangeEvent | Emitted when state changes (if enabled) |
ready | void | Emitted when component is fully rendered |
<template>
<ServlyComponent id="my-component">
<!-- Custom loading state -->
<template #fallback>
<div>Loading...</div>
</template>
<!-- Custom error state -->
<template #error="{ error, retry }">
<div>
<p>Error: {{ error.message }}</p>
<button @click="retry">Retry</button>
</div>
</template>
<!-- Named slots for component content -->
<template #header>
<h1>Custom Header</h1>
</template>
<template #footer>
<p>Custom Footer</p>
</template>
</ServlyComponent>
</template>
<template>
<ServlyComponent
id="counter-component"
:props="{ count }"
enable-state-manager
:initial-state="{ count: 0 }"
@state-change="onStateChange"
/>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { ServlyComponent } from '@servlyadmin/runtime-vue';
const count = ref(0);
const onStateChange = (event) => {
if (event.key === 'count') {
count.value = event.value;
}
};
</script>
<template>
<ServlyComponent
id="form-component"
:event-handlers="handlers"
/>
</template>
<script setup lang="ts">
import { ServlyComponent } from '@servlyadmin/runtime-vue';
const handlers = {
'submit-btn': {
click: (event) => {
console.log('Button clicked!', event);
},
},
'email-input': {
change: (event) => {
console.log('Email changed:', event.target.value);
},
},
};
</script>
<template>
<ServlyComponent
ref="servlyRef"
id="my-component"
/>
<button @click="reload">Reload</button>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { ServlyComponent } from '@servlyadmin/runtime-vue';
const servlyRef = ref();
const reload = () => {
servlyRef.value?.reload();
};
// Other exposed methods:
// servlyRef.value?.getSlotElement('header')
// servlyRef.value?.getSlotNames()
// servlyRef.value?.getStateManager()
// servlyRef.value?.update({ newProp: 'value' })
</script>
<template>
<!-- Exact version -->
<ServlyComponent id="my-component" version="1.2.3" />
<!-- Caret range (compatible with) -->
<ServlyComponent id="my-component" version="^1.0.0" />
<!-- Tilde range (approximately) -->
<ServlyComponent id="my-component" version="~1.2.0" />
<!-- Latest version (default) -->
<ServlyComponent id="my-component" />
</template>
Full TypeScript support is included:
import type {
ServlyComponentProps,
BindingContext,
ComponentData,
StateChangeEvent,
} from '@servlyadmin/runtime-vue';
For convenience, common utilities are re-exported:
import {
// Fetching
fetchComponent,
prefetchComponents,
setRegistryUrl,
DEFAULT_REGISTRY_URL,
// Caching
invalidateCache,
clearAllCaches,
// State management
StateManager,
// Event system
EventSystem,
getEventSystem,
} from '@servlyadmin/runtime-vue';
MIT
FAQs
Vue wrapper for Servly runtime renderer
We found that @servlyadmin/runtime-vue demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.