In this guide, we will add a Novu Bridge Endpoint to a Svelte application and send our first test workflow.


Run the Local Studio

The Local Studio is where you will build your notification workflows and craft the controls that will be exposed for your non-technical peers to maintain after your workflow is pushed to your Development or Production environments.

npx novu@latest dev

The dev command is your go-to command whenever you want to build and preview your changes before syncing to cloud. By default, it will start a secure tunnel that our durable cloud workflow engine will be able to communicate with, and the Local Studio web service listening on http://localhost:2022


Install Packages

npm install @novu/framework zod zod-to-json-schema

This will install the following packages

  • @novu/framework SDK Package
  • Zod (Recommended) - For end-to-end type safety for your Payload and Step Controls

Add a Novu API Endpoint

import { testWorkflow } from '$lib/novu/workflows';
import { serve } from '@novu/framework/sveltekit';

export const { GET, POST, OPTIONS } = serve({ workflows: [testWorkflow] });

Add a Novu Secret Key Environment Variable

Add NOVU_SECRET_KEY environment variable to your .env


Create your workflow definition

Add a novu folder in your lib folder as such src/lib/novu/workflows.ts that will contain your workflow definitions.

import { workflow } from '@novu/framework';
import { z } from 'zod';

export const testWorkflow = workflow('test-workflow', async ({ step, payload }) => {
    await'send-email', async (controls) => {
        return {
            subject: controls.subject,
            body: 'This is your first Novu Email ' + payload.userName,
        controlSchema: z.object({
            subject: z.string().default('A Successful Test on Novu from {{userName}}'),
    }, {
        payloadSchema: z.object({
            userName: z.string().default('John Doe'),

Start your application

To start your Svelte server with the Novu Endpoint configured, run the following command:

cd my-novu-app && npm run dev

Svelte application default port is 5173. For that to work, restart Novu Studio and point it to the right port:

npx novu@latest dev --port <YOUR_SVELTE_PORT>

Test your workflow

After your application is up and running, visit the Local Studio interface that was started on http://localhost:2022 by running the npx novu dev command on the first step.

The onboarding guide will guide you to send the newly created sample workflow to your e-mail address.


Deploy your application

Once you have finished refining your first workflow, it’s time to sync your local changes to Novu Cloud. Novu recommends deploying your workflows similarly to how you will deploy the features that generate those notifications using your CI/CD pipeline or our CLI command.

Read more about syncing your changes to the cloud.

Next Steps