How to manually setup Trigger.dev in your NestJS project
Don't have a NestJS project yet to add Trigger.dev to? No problem, you can complete the Manual Setup using a blank NestJS 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.
app.module.ts
, and add the following inside your imports
:
TriggerDevModule
to your project, you will can have access to the TriggerClient
instance by using the @InjectTriggerDevClient()
decorator in the constructor.
Now, let's create an example job to test the integration.
job.controller.ts
alongside your app.module.ts
service
or controller
, we recommend you to
create specialized service
for each job you have for a better maintainability.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
.