Channels
Receive webhooks with signature checks, dedupe and retry, and send messages from any server code, through one named Channel.
Adapters
One adapter for each Channel. An Agent answers the messages of the Channels that it lists.
Deploys on
- Node
- Docker
- Cloudflare
- Vercel
server/channels/stripe.ts
import { defineChannel } from 'vite-hub/channels'
import { stripe } from 'vite-hub/channels/adapters'
import { sendQueue } from 'vite-hub/queue'
// The file name makes this the "stripe" Channel.
export default defineChannel({
// Checks Stripe-Signature with STRIPE_WEBHOOK_SECRET
adapter: stripe(),
on: {
// Runs once per Stripe event ID, after ViteHub stores it.
// A failed Result retries the event.
'checkout.session.completed': event =>
sendQueue('fulfil', event.data),
},
})One file for each connection
Add a file to
server/channels. Its name is the Channel name for both directions.Webhooks that run once
ViteHub checks the signature, stores the delivery, drops duplicates by delivery ID, and retries the target.
A target for each event
Send an event to a handler, a Queue, a Workflow, or the Agent that lists the Channel.