Mail

Set up, configure, and run the Reloop mail microservice locally.

Complete Base Setup First

Ensure you've finished the Setup — before proceeding.

Service Overview

Outbound transactional email API — send requests, template compilation, tracking, and SMTP handoff.

PropertyValue
Directoryapps/backend/mail
Port8015
Local URLhttps://local.reloop.sh/api/mail
Swagger UIhttps://local.reloop.sh/api/mail/openapi
StackElysiaJS PostgreSQL Redis NATS BullMQ

Quick Start

Run from the monorepo root (requires SMTP via Docker):

bun be:mail:dev

The service starts with hot reloading on port 8015.

Environment Configuration

Variables live in apps/backend/mail/.env. Running bun env:setup from the root auto-populates this file.

PG_URL=postgresql://reloop:reloop123@localhost:5432/reloop
REDIS_URL=redis://:reloop123@localhost:6379
PORT=8015
BASE_URL="https://local.reloop.sh"
NATS_URL=nats://localhost:4222
KUMOMTA_HTTP_URL=http://localhost:8020
TRACKING_SECRET=reloop_tracking_secret_default_123
NODE_ENV=development

Reference Table

VariableRequiredDefault
PG_URLYESpostgresql://...
REDIS_URLYESredis://...
PORTYES8015
KUMOMTA_HTTP_URLYEShttp://localhost:8020
TRACKING_SECRETNoreloop_tracking_secret_default_123 — signs tracked link and open-pixel tokens
NATS_URLYESnats://localhost:4222

Development Commands

CommandDescription
bun be:mail:devStart dev server with hot reloading
bun run --filter=mail buildCompile production bundle
bun run --filter=mail startRun compiled production build
bun run --filter=mail check-typesTypeScript type-check

Architecture

LayerDetail
Send pipelineValidates API keys, compiles templates, injects tracking links.
QueuesBullMQ workers dispatch via Redis (mail-queue, mail-retry-queue).
MTA handoffDelivers to the SMTP engine on port 8020.
Schemaemail_log in packages/db/src/schema/email.ts.

Was this page helpful?

Edit this page