I'm building Warpix alone. It's customer feedback software for small B2B SaaS teams, with a Go API, one Postgres database and one VPS. In November I shipped two integrations, Slack and Linear, in the same week.

Before writing either one, I had one rule. The code that handles feature requests, votes and roadmap items must not know Slack or Linear exist. If I add Jira next year, I don't want to edit request code to do it.

This post covers the four design choices that made that work. They suit any small team with Postgres that wants integrations without adding a message queue.

1. Let the database write the events

The usual approach is to call a "publish event" function after each change. That has two problems. Every core package now imports the event code. And if the transaction rolls back after you publish, the event goes out for a change that never happened.

Instead, Postgres triggers write the events. An AFTER INSERT OR UPDATE trigger on each core table adds a row to an integration_outbox table, inside the same transaction as the change:

CREATE TRIGGER integration_outbox_feedback_trigger AFTER INSERT OR UPDATE ON feedback FOR EACH ROW EXECUTE FUNCTION integration_outbox_feedback(); 

The trigger function decides which event it is (request.created, request.status_changed, request.merged and so on) and calls one helper:

INSERT INTO integration_outbox(tenant_id, workspace_id, event_type, subject_id, payload, origin, actor_identity_id) VALUES (p_tenant, p_workspace, p_event, p_subject, COALESCE(p_payload, '{}'::jsonb), NULLIF(current_setting('warpix.event_origin', true), ''), p_actor); 

Three details matter here:

  • The helper returns early when the workspace has no active connection. For teams without integrations, the cost is one indexed lookup per change.
  • Payloads hold IDs and changed fields only. No names, emails or revenue. The provider reads current data when it delivers, so a slow retry never sends stale or deleted data.
  • A rolled-back change leaves no event, because the event was part of the same transaction.

2. Stop loops with an "origin" setting

Linear can move a Warpix roadmap item: when a linked issue starts, the item moves to In Progress. That move fires the roadmap trigger, which creates an event. Without care, Warpix would then tell Linear about a change Linear just caused.

The fix is the warpix.event_origin setting in the insert above. When the Linear code changes Warpix data, it marks its transaction first:

SELECT set_config('warpix.event_origin', 'linear', true); 

The trigger stores that origin with the event. The dispatcher never delivers an event back to the provider named in its origin.

The true makes the setting local to the transaction, like SET LOCAL. It ends with the transaction, so the origin can't leak into the next request on the same pooled connection.

3. One dispatcher, claimed with SKIP LOCKED

There is no queue service. A dispatcher loop inside the API process reads the outbox, fans each event out to the connections that want it, and runs the deliveries.

Each delivery is claimed just before it runs:

UPDATE integration_deliveries d SET status = 'in_progress', locked_until = $2, attempts = d.attempts + 1, claim_seq = d.claim_seq + 1 WHERE d.id = ( SELECT q.id FROM integration_deliveries q WHERE (q.status IN ('pending', 'retrying') AND q.next_attempt_at <= $1) OR (q.status = 'in_progress' AND q.locked_until < $1) ORDER BY q.next_attempt_at LIMIT 1 FOR UPDATE OF q SKIP LOCKED ) RETURNING d.id, d.provider, d.payload, d.idempotency_key, d.attempts, d.claim_seq; 

SKIP LOCKED lets several workers pull from the same table without blocking each other. The claim also sets a two-minute lease (locked_until). If the process crashes mid-delivery, the lease runs out, and the second half of the WHERE lets another worker pick the delivery up again.

A lease can expire while the first worker is still running, so a delivery can run twice. Two things handle that. Every delivery has an idempotency key, and providers must treat a repeat as a no-op. And each claim gets a sequence number. Only the latest claim may record the result, so a slow, stale worker can't overwrite a newer outcome.

Failures retry with exponential backoff, from 30 seconds up to 6 hours, with some random jitter. The dispatcher honours a provider's Retry-After header. After 8 attempts, or a permanent error such as revoked access, the delivery is marked dead. Admins see dead deliveries in the dashboard and can retry them.

One more rule saved me from a bad surprise: events the dispatcher reaches more than an hour late are dropped. If Slack is down for a day, nobody wants 200 messages about yesterday's votes when it comes back.

4. Enforce the boundary with a test

Rules in a design doc fade. A test doesn't. This Go test runs go list -deps on every core package and fails if any of them depends on the integrations code:

func TestCorePackagesDoNotDependOnIntegrations(t *testing.T) { for _, core := range corePackages { deps := goList(t, "-deps", "-f", "{{.ImportPath}}", module+core) for _, dep := range deps { if dep == module+"integrations" || strings.HasPrefix(dep, module+"integrations/") { t.Errorf("core package %s depends on %s", core, dep) } } } } 

A second test checks the other direction. Provider packages (Slack, Linear) may not import core packages. They read Warpix data through one Host interface instead. So swapping one provider for another doesn't touch core code, and a provider can't reach into tables it shouldn't see.

Inbound webhooks: verify, store, then work

Linear webhooks take a simple path. The handler reads the raw body once, capped at 1 MiB, and asks the provider to check its signature and timestamp. If the check passes, the webhook is stored as an inbound delivery and the handler returns 200 right away. The dispatcher does the real work later, with the same retries as outbound deliveries.

Each webhook is stored once per delivery ID, and once per SHA-256 hash of its signed body. The second key catches a captured webhook replayed with a new delivery header. Slack requests get a similar replay check, keyed on a hash of their signature.

What I'd tell another solo founder

  • An outbox written by triggers gives you correct events with no extra infrastructure. Postgres already does the hard part.
  • Pick an idempotency key and a loop-prevention rule before you write the first provider. Both are painful to add later.
  • Put architectural rules in tests. A boundary that only lives in a design doc won't survive the next late-night fix.

The integrations are live in Warpix today. If you want to see what they connect to, there's a live demo with sample data that needs no sign-up. I'm happy to answer questions about the design in the comments.