Manual Installation

@servicestack/vue can be added to existing Vue SPA Apps by installing via npm:

npm install @servicestack/vue

Where it will also install its vue and @servicestack/client dependencies.

Installation-less option

Alternatively you can take advantage of modern browsers JS Modules support to use these libraries without installation by registering an importmap to define where it should load the ESM builds of these libraries from, e.g:

<script type="importmap">
    "imports": {
        "vue":                  "",
        "@servicestack/client": "",
        "@servicestack/vue":    ""

For intranet Web Apps that need to work without internet access, save and reference local copies of these libraries, e.g:

<script type="importmap">
    "imports": {
        "vue":                  "/lib/mjs/vue.mjs",
        "@servicestack/client": "/lib/mjs/servicestack-client.mjs",
        "@servicestack/vue":    "/lib/mjs/servicestack-vue.mjs"


Razor Pages or MVC Apps can use the Html.ImportMaps() to use local debug builds during development and optimal CDN hosted minified production builds in production:

    ["vue"]                  = ("/lib/mjs/vue.mjs",                 ""),
    ["@servicestack/client"] = ("/lib/mjs/servicestack-client.mjs", ""),
    ["@servicestack/vue"]    = ("/lib/mjs/servicestack-vue.mjs",    "")

It's recommended to use exact versions to eliminate redirect latencies and to match the local version your App was developed against

Polyfill for Safari

Unfortunately Safari is the last modern browser to support import maps which is only now in Technical Preview. Luckily this feature can be polyfilled with the pre-configured ES Module Shims:

@if (Context.Request.Headers.UserAgent.Any(x => x.Contains("Safari") && !x.Contains("Chrome")))
    <script async src=""></script>


Then register the @servicestack/vue component library with your Vue app with:

import { JsonApiClient } from "@servicestack/client"
import ServiceStackVue from "@servicestack/vue"

const client = JsonApiClient.create()

const app = createApp(component, props)
app.provide('client', client)


The client instance is used by API-enabled components to call your APIs using the /api predefined route. ServiceStack Apps not running on .NET 6+ or have the /api route disabled should use JsonServiceClient instead:

const client = new JsonServiceClient()

Not using Vue Router

Non SPA Vue Apps that don't use Vue Router should register a replacement <router-link> component that uses the browser's native navigation in navigational components:

app.component('RouterLink', ServiceStackVue.component('RouterLink'))