trigger-adapters
v0.5.1
Published
A library for creating trigger adapters.
Readme
trigger-adapters
Framework adapters for Trigger.dev - easily integrate background jobs into your favorite web frameworks.
Installation
npm install trigger-adapters
# or
bun add trigger-adapters
# or
yarn add trigger-adaptersQuick Start
Next.js (App Router)
// app/api/trigger/[id]/route.ts
import { handler } from "trigger-adapters/nextjs";
export const { POST } = handler();Next.js (Pages Router)
// pages/api/trigger/[id].ts
import { handler } from "trigger-adapters/nextjs";
export default handler().handle;Hono
import { Hono } from "hono";
import { handler } from "trigger-adapters/hono";
const app = new Hono();
app.post("/trigger/:id", handler());Express
import express from "express";
import { handler } from "trigger-adapters/express";
const app = express();
app.post("/trigger/:id", handler());Fastify
import fastify from "fastify";
import { handler } from "trigger-adapters/fastify";
const app = fastify();
app.post("/trigger/:id", handler());Features
- 🚀 Simple Integration - One-line setup for each framework
- 🔧 Type Safe - Full TypeScript support
- 📦 Lightweight - Minimal dependencies
- 🎯 Framework Agnostic - Works with all major Node.js frameworks
- ⚡ Fast - Optimized for performance
Supported Frameworks
- ✅ Next.js (App Router & Pages Router)
- ✅ Hono
- ✅ Express
- ✅ Fastify
- 🚧 Elysia (Coming Soon)
- 🚧 SvelteKit (Coming Soon)
How It Works
Each adapter:
- Extracts the task ID from the request URL
- Gets the request payload
- Triggers the task using Trigger.dev SDK
- Returns the result in the appropriate format for each framework
Development
Setup
bun installTesting
bun testBuilding
bun run buildLicense
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
