This repo is a great starting point to deploy your Trigger.dev triggers to Render.com, if you don't already have a Node.js server to host your triggers.
Render.com is a super-fast way to deploy webapps and servers (think of it like a modern Heroku). Follow along with the directions below to deploy this repo as a Background Worker in your Render.com (or check out our full Render.com Quickstart guide for more info)
Currently this repo only has a single (very simple) trigger:
import { Trigger, customEvent } from "@trigger.dev/sdk";
import { z } from "zod";
new Trigger({
id: "render-example",
name: "Render Example",
on: customEvent({
name: "render.example",
schema: z.object({ foo: z.string() }),
}),
async run(event, ctx) {
await ctx.logger.info("Hello world from inside render");
return event;
},
}).listen();First, clone the repo and install dependencies:
git clone https://github.com/triggerdotdev/render-deploy-example.git
cd render-deploy-example
npm installThen create a .env file with your development Trigger.dev API Key:
echo "TRIGGER_API_KEY=trigger_development_dfSbP70wLueX" >> .envAnd finally you are ready to run the process:
npm run devYou should see a message like the following:
[trigger.dev] ✨ Connected and listening for events [render-example]
You'll first want to fork this repo into your own GitHub organization or user account so you'll be able to connect it with Render.com.
In your Render.com dashboard, create a new Background Worker and connect to the GitHub organization or user account you forked the repo in above.
Once you do that you'll be presented with the New Background Worker form, give it a name and keep everything the default except for 2 things:
- Update the Build Command to be
npm install && npm run buildinstead ofyarn - Click on the "Advanced" button and add your live Trigger.dev API key as an environment variable
Finally, click the Deploy button and your Trigger.dev code should be deployed in less than a minute!
Check out our full Render.com Quickstart guide for more info.