Vue.js Integration

Add In-App Notifications to Your Vue.js SaaS

One script tag in your index.html. No Vue SDK or npm package needed. Works with Vue 2, Vue 3, and Nuxt.js. Real-time delivery via SSE.

Why No SDK?

No Vue package needed. Seriously.

Notilayer loads as an external script and renders inside a Shadow DOM. It does not touch your Vue component tree, your build pipeline, or your node_modules.

No npm install

Zero dependencies added to your package.json. No version conflicts, no lock file changes, no security audit entries.

No build step changes

No Vite plugins, no Webpack config updates. The script loads externally and stays out of your build pipeline entirely.

Works with Vue 2 + 3

Not coupled to any Vue version. Options API, Composition API, or <script setup> — it all works.

Shadow DOM isolation

Widget renders in its own Shadow DOM. Your scoped styles, Tailwind classes, and global CSS will never conflict with it.

Step 1

Add the script tag to index.html

Add the Notilayer widget script to your index.html file. For Vite-based projects, this is in the project root. For Vue CLI projects, it is in the public/ folder. The script loads asynchronously with defer so it will not block rendering.

1

Open your index.html

Located at the project root (Vite) or public/ (Vue CLI).

2

Paste the script tag

Add it before the closing </body> tag. Pass your App ID via data-app-id.

3

Bell appears on load

The widget renders a bell icon with an inbox. No Vue component needed.

index.html

index.html
<!-- public/index.html (Vue CLI) or index.html (Vite) -->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>My Vue App</title>
  </head>
  <body>
    <div id="app"></div>
    <script
      src="https://api.notilayer.com/widget/widget.js"
      data-app-id="YOUR_APP_ID"
      defer
    ></script>
  </body>
</html>

App.vue

App.vue
// App.vue (Vue 3 Composition API)
<script setup>
import { onMounted } from 'vue'

onMounted(() => {
  // Widget auto-initializes after script loads
  // Use onMounted to identify the current user
  if (window.Notilayer) {
    window.Notilayer.init({
      projectId: 'YOUR_APP_ID',
      userId: currentUser.id,
    })
  }
})
</script>

<template>
  <div id="app">
    <router-view />
  </div>
</template>

Step 2

Initialize in your Vue component

Use the onMounted lifecycle hook to call window.Notilayer.init() with your project ID and the current user's ID. This connects the widget to the right user and opens the real-time SSE connection.

  • Works with Vue 3 Composition API and <script setup>
  • For Vue 2, use the mounted() lifecycle hook instead
  • SSE connection opens automatically after initialization

Step 3

Send notifications from your backend

Use the Notilayer REST API to send notifications from any backend — Node.js, Python, Go, or any language that supports HTTP. Notifications are delivered to the user's widget in real-time via SSE. No WebSocket setup required.

Simple REST API

One POST request sends a notification. No message queues, no pub/sub infrastructure to manage.

Real-time via SSE

Notifications appear instantly in the user's widget. Server-Sent Events are simpler and more reliable than WebSockets.

User segmentation

Target specific users by ID, or send to segments. Built into the API with no extra configuration.

server.js

server.js
// Send a notification from your Node.js backend
const response = await fetch(
  'https://api.notilayer.com/v1/notifications',
  {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer YOUR_API_KEY',
    },
    body: JSON.stringify({
      userId: 'user_123',
      title: 'New message',
      body: 'You have a new message from your team.',
    }),
  }
);

What You Get

Everything your Vue.js app needs for notifications

A complete notification widget that works out of the box. No custom UI to build, no state management to wire up.

Bell icon

A customizable bell icon that appears in your app. Click to open the notification inbox. Positioned automatically.

Notification inbox

A full inbox UI with notification list, timestamps, and read/unread states. No custom components to build.

Unread badge

A red badge on the bell icon showing the unread count. Updates in real-time as new notifications arrive.

Real-time delivery

Notifications appear instantly via Server-Sent Events. No WebSocket setup, no polling, no complex infrastructure.

User segmentation

Send notifications to specific users or segments. Target by user ID, role, plan, or custom attributes.

Shadow DOM isolation

Widget styles are fully encapsulated. No CSS conflicts with your Vue components, scoped styles, or Tailwind.

Compatibility

Works with the entire Vue.js ecosystem

The widget is framework-agnostic by design. One script tag works across every Vue.js setup.

V2

Vue 2

Options API

V3

Vue 3

Composition API

Nx

Nuxt.js

Nuxt 2 + Nuxt 3

Vi

Vite

Default build tool

CLI

Vue CLI

Webpack-based

FAQ

Vue.js integration questions

Do I need a Vue SDK or npm package for Notilayer?
No. Notilayer works with a single script tag added to your index.html file. There is no Vue-specific SDK, no npm package to install, and no build configuration changes required. The script tag approach works with any Vue.js app regardless of version or build tool.
Does Notilayer work with Vue 2 and Vue 3?
Yes. Because Notilayer loads as an external script and renders inside a Shadow DOM, it is completely independent of your Vue version. It works with Vue 2 (Options API), Vue 3 (Composition API and Options API), and all major Vue meta-frameworks like Nuxt.js.
Will the notification widget conflict with my Vue component styles?
No. The Notilayer widget renders inside a Shadow DOM, which provides full CSS isolation. Your scoped styles, Tailwind classes, or global CSS will not leak into the widget, and the widget styles will not affect your Vue components. This works regardless of your styling approach.
Can I use Notilayer with Nuxt.js?
Yes. For Nuxt.js, add the Notilayer script tag in your nuxt.config file using the head configuration, or place it directly in your app.html template. The widget loads on the client side after hydration, so there are no SSR conflicts. It works with both Nuxt 2 and Nuxt 3.

Add Notifications to Your Vue.js App

One script tag. No npm package. Works with Vue 2, Vue 3, and Nuxt.js. Free plan included.