How to manually setup Trigger.dev in your Remix project
tr_dev_
).
.env
file at the root of your project and include your Trigger API key and URL like this:
ENTER_YOUR_DEVELOPMENT_API_KEY_HERE
with the actual API key obtained from the previous step.
<root>/app/trigger.ts
, where <root>
represents the root directory of your project.
Next, add the following code to the file which creates and exports a new TriggerClient
:
api.trigger.(ts/js)
within the app/routes/
directory.app/routes/api.trigger.(ts/js)
:jobs
inside your app
directoryjobs
folder, add a file named example.server.(ts/js)
..server
files are guaranteed to be excluded from the client-side build, so you can safely import server-only dependencies here.
Jobs
folder, exporting from the file and from the api.trigger route.
package.json
package.json
file, add the following configuration under the root object:
package.json
file might look something like this:
--port 3001
to the end--hostname <host>
. Example, in case your Remix is running on 0.0.0.0: --hostname 0.0.0.0
.'TriggerProvider' not found
remix.config.js
file and add the @trigger.dev/react
package to your list of serverDependenciesToBundle
:
[ERROR] Node builtin "buffer"
remix.config.js
file and add the browserNodeBuiltinsPolyfill
config: