SvelteKit Quickstart
Get started with Novu Framework in a SvelteKit application
In this guide, we will add a Novu Bridge Endpoint to a Svelte application and send our first test workflow.
Start Local Studio
Start the Local Studio by running:
npx novu dev
The Local Studio will be available at http://localhost:2022. This is where you can preview and test your workflows.
Install Required Packages
Install the Novu Framework package:
npm install @novu/framework
This package provides all the necessary tools to build and manage your notification workflows.
Add Your Secret Key
Add your Novu Secret Key to your environment variables:
# .env
NOVU_SECRET_KEY=your_secret_key
Add a novu
folder in your lib folder as such src/lib/novu/workflows.ts
that will contain your workflow definitions.
To start your Svelte server with the Novu Endpoint configured, run the following command:
Svelte application default port is 5173. For that to work, restart Novu Studio and point it to the right port:
Test Your Workflow
Test your workflow by triggering it from the Local Studio or using the Novu API:
curl -X POST https://api.novu.co/v1/events/trigger \
-H 'Authorization: ApiKey YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"name": "my-workflow",
"to": "subscriber-id",
"payload": {}
}'
You should see the notification being processed in your Local Studio.
Deploy Your App
Deploy your application to your preferred hosting provider. Make sure the /api/novu
endpoint is accessible from the internet.
For local development and testing, you can use tools like ngrok to expose your local server to the internet.
Next Steps
Now that you have your first workflow running, you can:
- Learn about Workflow Controls to expose no-code editing capabilities
- Explore different Channel Steps like Email, SMS, Push, and more
- Set up Action Steps like Delay and Digest
- Check out our React Email integration for building beautiful email templates