Hogsend
CLI Reference

hogsend init

Connect to a Railway project, configure environment variables, create a PostHog webhook, and verify the full pipeline.

Usage

hogsend init [--force]

Run this after deploying the Railway template. The init wizard connects to your Railway project, sets environment variables on both the API and Worker services, creates a PostHog webhook destination, and verifies the full event pipeline.

What it does

The init flow has three stages:

Stage 1: Collect

The wizard prompts for:

  1. Project name -- a human-readable label for this deployment (e.g. "ACME Corp")
  2. Railway API token -- generate one at railway.com/account/tokens
  3. Railway project -- selected from your available projects
  4. PostHog personal API key -- must start with phx_, generated at PostHog > Settings > Personal API Keys
  5. PostHog region -- US, EU, or a custom self-hosted URL
  6. PostHog project -- selected from your available projects
  7. Resend "from" email -- the sender address for lifecycle emails
  8. Journeys -- multi-select from the available journey library

The CLI authenticates with Railway, discovers the API and Worker services by name, and finds (or generates) the API domain.

Stage 2: Provision

With your inputs collected, the CLI:

  • Generates a BETTER_AUTH_SECRET (64-char hex), POSTHOG_WEBHOOK_SECRET (32-char hex), and ADMIN_API_KEY (32-char hex)
  • Sets environment variables on the API service (NODE_ENV, PORT, BETTER_AUTH_SECRET, POSTHOG_API_KEY, POSTHOG_HOST, POSTHOG_WEBHOOK_SECRET, ADMIN_API_KEY, RESEND_FROM_EMAIL, ENABLED_JOURNEYS, etc.)
  • Sets environment variables on the Worker service (NODE_ENV, RESEND_FROM_EMAIL, ENABLED_JOURNEYS, POSTHOG_API_KEY, POSTHOG_HOST)
  • Creates a PostHog webhook destination pointing to https://<domain>/v1/webhooks/posthog, configured with the events required by your selected journeys
  • Redeploys both the API and Worker services

Stage 3: Verify

The CLI waits up to 3 minutes for the API to become healthy, then sends a hogsend:init_test event and checks for it in the events store (3 retries at 2-second intervals). If health or verification fails, the config is still saved -- you can check later with hogsend status.

Flags

FlagDescription
--forceRe-run init even if .hogsend.yaml already exists

Without --force, running hogsend init on a project that's already initialized returns an error with the current project name and slug.

Output

On success, the CLI saves .hogsend.yaml to the current directory and prints a summary card with the API URL, webhook URL, PostHog project link, Railway dashboard link, config file path, and admin key location.

Requirements

  • A Railway project created from the Hogsend deploy template
  • A Railway API token with access to that project
  • A PostHog personal API key (phx_...) with project read access
  • A verified Resend sending domain

On this page