Prerequisites
You need the following installed in your system:- Docker and docker-compose
curlandopenssl(pre-installed on most systems)
Quick Start
Run the setup script to download the required files, generate secure secrets, and start Novu:NOVU_DIR:
- Download
docker-compose.ymland.env.exampleinto the target directory (defaults to./novu) - Generate cryptographically random values for
JWT_SECRET,STORE_ENCRYPTION_KEY, andNOVU_SECRET_KEY - Create a
.envfile with the generated secrets - Start all Novu services via
docker compose up -d
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:
Securing Your Setup
If you used the setup script, secure random secrets were generated automatically forJWT_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
- To run in local machine:
REDIS_CACHE_SERVICE_HOSTandREDIS_HOSTcan 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
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.,notification-center.tsx) in your project:
Configure the environment URLs
Adjust thebackendUrl 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 Node SDK
When using a self-hosted Novu deployment with your backend services, you need to configure the Node SDK to connect to your Docker-hosted Novu instance.Install the package
Initialize the SDK
Configure the SDK with your self-hosted backend URL:Configure for different environments
Adjust thebackendUrl based on your deployment:
Triggering events
Once initialized, you can trigger notification events:Setting Up local studio 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:
@novu/framework will be running on http://localhost:4000, Go to http://localhost:4000/api/novu to see status.
Setting Up Novu Studio
Novu Local Studio is a development environment that allows you to test and manage your workflows. The setup varies based on your deployment:- Local
- VPS
if novu is run using above docker compose command in local machine, use below commmandFollowing actions will occur:
- Novu local studio will be started on default port 2002,
- Novu will generate a tunnel url that will forward the request to bridge application running on
<bridge_application_port> - Studio will use
http://localhost:4000as dashboard url
Synchronizing Workflows
- Local
- VPS
VPS Security Considerations
When deploying to a VPS, consider these additional security measures:- Use a firewall to restrict access to only necessary ports
- Set up SSL/TLS certificates for HTTPS access
- Regularly update your Docker images and host system
- Use strong, unique secrets in your
.envfile - Consider using a reverse proxy like Nginx for additional security layers
Triggering events with custom installation
When self-hosting Novu, in order to trigger an event you must first create a newNovu object and configure it with the proper backendUrl.
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
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 are used to set the context path for each public service that Novu provides: API_CONTEXT_PATH WIDGET_CONTEXT_PATH WS_CONTEXT_PATH DASHBOARD_CONTEXT_PATH These allow you to set the context path for each service independently or dependently of the GLOBAL_CONTEXT_PATH. For example, if I was using a reverse proxy to serve Novu from company.com/novu, I would set the GLOBAL_CONTEXT_PATH to novu, and then set the API_CONTEXT_PATH to api, the WIDGET_CONTEXT_PATH to widget, the WS_CONTEXT_PATH to ws, and the DASHBOARD_CONTEXT_PATH to Dashboard. This would produce the following urls: - API: company.com/novu/api - WIDGET: company.com/novu/widget - WS: company.com/novu/ws - DASHBOARD: company.com/novu/dashboard However the Service context path can be used entirely independently of the GLOBAL_CONTEXT_PATH. For example, if I wanted to expose the api as novu-api, I would set the API_CONTEXT_PATH to novu-api without setting the GLOBAL_CONTEXT_PATH. This would producte the following url: - API: company.com/novu-apiThese env variables should be present on all services novu provides due to tight coupling.
FAQs
Local Tunnel and Self-Hosted Deployments
Local Tunnel and Self-Hosted Deployments
Novu uses a local tunnel as bridge url. It can be used as bridge url with local studio 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
When is Local Tunnel Not Required?
When is Local Tunnel Not Required?
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.When is Local Tunnel Required?
When is Local Tunnel Required?
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: