Skip to main content
Docker compose is the easiest way to get started with self-hosted Novu. This guide will walk you through the steps to run all services in single virtual machine using docker compose. This guide uses latest docker images. If you are looking to self host 0.24.x version, checkout 0.24.x docs

Prerequisites

You need the following installed in your system:

Quick Start

Run the setup script to download the required files, generate secure secrets, and start Novu:
To install into a specific directory, set NOVU_DIR:
The script will:
  1. Download docker-compose.yml and .env.example into the target directory (defaults to ./novu)
  2. Generate cryptographically random values for JWT_SECRET, STORE_ENCRYPTION_KEY, and NOVU_SECRET_KEY
  3. Create a .env file with the generated secrets
  4. Start all Novu services via docker compose up -d
Once complete, visit http://localhost:4000 to start using Novu.
If you already have a .env file in the target directory, the script will only fill in any missing secret values without overwriting existing configuration.

Configure Environment

VPS Deployment

When deploying to a VPS, update your .env file with your server’s information:
Start Novu on your VPS:
Access your dashboard at http://vps-ip-address:4000.

Securing Your Setup

If you used the setup script, secure random secrets were generated automatically for JWT_SECRET, STORE_ENCRYPTION_KEY, and NOVU_SECRET_KEY. If you cloned the repository manually, update the .env file with your own secrets before going to production.

Required Variables:

  • JWT_SECRET: Used by the API to generate JWT keys.
  • STORE_ENCRYPTION_KEY: Used to encrypt/decrypt the provider credentials. It must be 32 characters long.
  • HOST_NAME: Host name of your installation:
    • To run in local machine: http://localhost
    • To run in VPS: Your server’s IP address (e.g., http://<vps-ip-address>) or domain name
  • REDIS_CACHE_SERVICE_HOST and REDIS_HOST can have same value for small deployments. For larger deployments, it is recommended to use separate Redis instances for caching and queue management.

Configuration

To keep the setup simple, we made some choices that may not be optimal for production:
  • the database is in the same machine as the servers
  • the storage uses localstack instead of S3
We strongly recommend that you decouple your database before deploying.

Setting Up the Inbox Component

This section explains how to integrate the Novu Inbox component into your application when using a self-hosted Novu deployment.

Install the required packages

Create the Inbox component

Create a component file (e.g., inbox.tsx) in your project:

Configure the environment URLs

Adjust the backendUrl and socketUrl based on your deployment:

Testing the connection

Once your application is running, you should see the bell icon in your navbar. Clicking it will open the notification inbox UI. To test notifications, create and trigger a workflow from your self-hosted Novu dashboard, selecting In-App as the channel. For more information on customizing the Inbox component, refer to the Inbox documentation.

Initializing the Server SDK

When using a self-hosted Novu deployment with your backend services, configure the server SDK to connect to your Docker-hosted Novu API instance.

Install the package

Initialize the SDK

Configure the SDK with your self-hosted backend URL:

Configure for different environments

Adjust the backendUrl based on your deployment:

Triggering events

Once initialized, you can trigger notification events:
For more information on using the server SDKs, refer to the Server-Side SDKs documentation.

Setting up local development and bridge application

Setting Up the bridge application

The bridge application is application where workflow definition are written using @novu/framework. Here’s how to set it up:
A Next.js bridge application with a sample @novu/framework workflow runs on the port you choose (for example http://localhost:4005). Visit http://localhost:4005/api/novu to verify the bridge endpoint.
The self-hosted Dashboard also runs on port 4000. Use a different port (such as 4005) for your bridge application to avoid a conflict.

Setting up local development

Local development with npx novu dev opens the Novu Dashboard in Local mode, so you can test and manage the workflows running on your machine. The setup varies based on your deployment:
if novu is run using above docker compose command in local machine, use below commmand
Following actions will occur:
  • Your self-hosted Dashboard will open in the Local environment,
  • Novu will generate a tunnel url that will forward the request to bridge application running on <bridge_application_port>
  • The Local environment will use http://localhost:4000 as dashboard url
Using bridge application url as bridge urlTo use bridge application url as bridge url, use below command:
In Windows OS, there are some additional steps:
  • stop the running docker compose process using ctrl + c
  • update the docker-compose.yml file and add below config with each service (api, dashboard, worker and ws)
  • start the docker compose process again using docker compose up
  • now you can use host.docker.internal as bridge url hostname inplace of localhost

Synchronizing Workflows

VPS Security Considerations

When deploying to a VPS, consider these additional security measures:
  1. Use a firewall to restrict access to only necessary ports
  2. Set up SSL/TLS certificates for HTTPS access
  3. Regularly update your Docker images and host system
  4. Use strong, unique secrets in your .env file
  5. Consider using a reverse proxy like Nginx for additional security layers

Triggering events with custom installation

When self-hosting Novu, configure your server SDK with the self-hosted serverURL (or server_url) before triggering events.

Caching

We are introducing the first stage of caching in our system to improve performance and efficiency. Caching is turned off by default, but can easily be activated by setting the following environment variables:
  • REDIS_CACHE_SERVICE_HOST
  • REDIS_CACHE_SERVICE_PORT
Currently, caching is applied in the most heavily loaded areas of the system: Inbox feed and unseen-count requests, as well as common DAL requests during the trigger-event flow.

Reverse-Proxy / Load Balancers

To implement a reverse-proxy or load balancer in front of Novu, you need to set the GLOBAL_CONTEXT_PATH for the base path of the application. This is the path that the application will be served from after the domain. For example: - company.com/novu This is used to set the base path for the application, and is used to set the base path for the API, Dashboard, and WebSocket connections. The following environment variables set the context path for each public service: API_CONTEXT_PATH, WS_CONTEXT_PATH, WEBHOOK_CONTEXT_PATH, and FRONT_BASE_CONTEXT_PATH. These can be set independently or together with GLOBAL_CONTEXT_PATH. For example, to serve Novu from company.com/novu, set GLOBAL_CONTEXT_PATH=novu, then set API_CONTEXT_PATH=api and WS_CONTEXT_PATH=ws. That produces:
  • API: company.com/novu/api
  • WS: company.com/novu/ws
You can also set a service context path without GLOBAL_CONTEXT_PATH. For example, API_CONTEXT_PATH=novu-api exposes the API at company.com/novu-api. The Dashboard container is served separately on its configured port (default 4000) and is not controlled by these API/WS context-path variables.
These env variables should be present on all services novu provides due to tight coupling.

FAQs

Novu uses a local tunnel as bridge url. It can be used as bridge url during local development (npx novu dev) and for testing purpose in development environment. It should not be used in production environment. It is recommended to use deployed application url as bridge url
If the customer’s application and the self-hosted Novu deployment are within the same network, there is no need for a local tunnel. In this case, the application can communicate directly with Novu through the internal network. Checkout Using bridge application url as bridge url section to learn more.
If the application and Novu deployment reside on different networks, you can still interact with your self-hosted Novu instance using the Novu CLI. The CLI allows you to specify the Dashboard URL and Bridge Endpoint Origin to enable communication across networks via the Novu Cloud Local Tunnel.For example, you can use the following command: