Skip to main content

Getting started

Quick start

postboi init picks a provider, collects credentials, writes your env vars, and installs Postboi.


One command, fully set up. The CLI picks a provider, asks for credentials, optionally sets defaults, writes your env vars, and installs postboi if it isn’t already there.

bunx postboi init
bunx postboi init
npx postboi init
npx postboi init
pnpm dlx postboi init
pnpm dlx postboi init
yarn dlx postboi init
yarn dlx postboi init

What it does

  • Prompts you to choose one of the supported providers.
  • Collects that provider’s credentials (e.g. an API key, plus a domain for Mailgun).
  • Optionally sets POSTBOI_FROM / POSTBOI_TO and other defaults applied to every send.
  • Writes POSTBOI_PROVIDER, the credentials, and any defaults to your env file.
  • Installs postboi if it isn’t installed yet.
  • Optionally scaffolds a postboi.settings.ts for shared hooks and behaviour.

After it finishes, send() reads those env vars on every call — no further wiring needed.

import { send } from 'postboi';

await send({ to: 'contact@example.com', subject: 'Hi', body: '<p>Hello</p>' });
import { send } from 'postboi';

await send({ to: 'contact@example.com', subject: 'Hi', body: '<p>Hello</p>' });

Prefer to do it yourself?

Skip the CLI and set POSTBOI_PROVIDER plus the provider credential env vars by hand, or construct a provider instance directly. See Manual setup and Providers.