The easiest way to generate documents, reports, and presentations from your data! This example is free for most use cases.
Advantages of using Trigger.dev + Fileforge:
- Stack agnostic: Trigger.dev runs your functions in a runtime compatible with Fileforge. You can trigger your functions from any language or platform, including Python, Node.js, Ruby, Go, Java, and more.
- No infrastructure: rendering documents is a heavy task that requires a lot of resources. Trigger.dev and Fileforge take care of all the infrastructure for you.
- Use React: even if you do not have a React stack, you can use React to generate your documents.
- Easy to monitor: Trigger.dev provides a dashboard where you can see the status of your functions and logs.
Head to Trigger.dev and create an account. You will also be prompted to create a project. If you already are a Trigger.dev user, you can just create a project or use an existing one.
Head to Fileforge and create an account. Your API key will be displayed on the dashboard.
Start by cloning this repository:
git clone https://github.com/onedoclabs/fileforge-triggerdev.git
cd fileforge-triggerdev
Then, install the dependencies:
npm install
You can copy and rename the .env.example
file to .env
:
cp .env.example .env
Then, open the .env
file and fill in the TRIGGERDEV_API_KEY
and FILEFORGE_API_KEY
variables.
TRIGGERDEV_API_KEY
can be found in the Trigger.dev dashboard, on the left hand side, underAPI Keys
.FILEFORGE_API_KEY
can be found in the Fileforge dashboard, in the dark box at the top.
You can find the project ID in the Trigger.dev dashboard, on the left hand side, under Projects
.
Then, open the trigger.config.ts
file and replace the triggerProjectID
value with your project ID.
const triggerProjectID = "your-project-id";
This command will start the Trigger dev server. This server will respond to test requests from the Trigger.dev dashboard.
npm run dev
Then, head over to the Trigger.dev dashboard and click on the Test
button. You should see the function.
When clicking on the function, you can set a payload value and run the test.
You can now view the logs and your generated document by using the URL logged in the console.
NB: the URL in the return preview is truncated. You should use the console URL to view the full document.
You can now view the document generated by the function.
Head to your Trigger.dev dashboard and set the FILEFORGE_API_KEY
environment variable (under Environment Variables
) to the value of your Fileforge API key.
To deploy the function, use the following command:
npm run deploy