Hogsend

Getting Started

Learn how to set up Hogsend for code-first email automation with PostHog and Resend.

What is Hogsend?

Hogsend is a code-first lifecycle orchestration engine for teams using PostHog and Resend. It lets you define user journeys as TypeScript code — with durable execution, event-driven triggers, and built-in email delivery.

Key Concepts

  • Journeys — Define user flows as code using defineJourney(). Each journey is a durable task that runs reliably, survives restarts, and tracks state automatically.
  • Events — PostHog events trigger journey enrollment. Webhook sources and the ingest API let you push events from any system.
  • Email — Resend integration with React Email templates, bounce tracking, and unsubscribe management built in.
  • Conditions — Composable condition engine for enrollment guards, exit conditions, and in-journey branching.

Quick Example

import { defineJourney, days, hours } from "@hogsend/core";

const onboarding = defineJourney({
  meta: {
    id: "onboarding-welcome",
    trigger: { event: "user:signed_up" },
    entryLimit: "once",
  },
  async run(user, ctx) {
    await sendEmail({ to: user.email, template: "welcome" });

    await ctx.sleep({ duration: days(1) });

    const { found } = await ctx.event.check({
      userId: user.id,
      event: "feature:first_use",
    });

    if (!found) {
      await sendEmail({ to: user.email, template: "getting-started" });
    }
  },
});

Next Steps

On this page