CLI reference
CLI reference
Section titled “CLI reference”Mailify ships a single long-running binary (mailify) plus a handful of Cargo examples that stand in for ops subcommands. A first-class mailify CLI with subcommands (init, config check, config print) is on the roadmap — see TODO.md §3.3.
mailify
Section titled “mailify”The server binary. Takes no arguments — all configuration comes from Mailify.toml, dotenv, and env vars.
mailifyStartup order:
- Load dotenv (unless
MAILIFY_DOTENV=false). - Discover and merge
Mailify.toml(see config discovery). - Merge
MAILIFY_*env vars on top. - Initialize tracing (respects
RUST_LOG). - Ping Postgres with
SELECT 1and run apalis migrations. - Load
TemplateRegistryfromMAILIFY_TEMPLATES__PATH. - Maybe-bootstrap auth (generate ephemeral key if none configured).
- Spawn the queue worker.
- Start the axum HTTP server on
MAILIFY_SERVER__HOST:MAILIFY_SERVER__PORT.
Ops helpers (via Cargo examples)
Section titled “Ops helpers (via Cargo examples)”These are thin binaries kept as cargo run -p mailify-auth --example <name> so they share the crate’s code without needing a second published binary.
hash-key — argon2-hash an API key
Section titled “hash-key — argon2-hash an API key”cargo run -p mailify-auth --example hash-key -- <plaintext> <id>
# via Make:make hash-key KEY=my-secret-key ID=webPrints a MAILIFY_AUTH__API_KEYS__<ID>=<hash> line you can paste into your env source.
issue-token — mint a JWT offline
Section titled “issue-token — mint a JWT offline”cargo run -p mailify-auth --example issue-token -- <subject> <scopes-csv>
# via Make:make issue-token SUBJECT=dev SCOPES=mail:send,mail:adminUses the same JWT secret the server would — useful for scripted tests or for bootstrapping clients without round-tripping through /auth/token.
Make targets
Section titled “Make targets”The project’s Makefile is the canonical entry point for routine tasks.
make help # list every target with inline help textMost-used targets:
| Target | What it does |
|---|---|
make dev | cargo run --bin mailify — assumes deps are up. |
make build | cargo build --release |
make test | cargo test --workspace |
make check | cargo check --workspace --all-targets |
make clippy | cargo clippy --workspace --all-targets -- -D warnings |
make fmt / make fmt-check | rustfmt apply / verify |
make ci | Full CI parity: fmt-check + clippy + test |
make setup | bun install inside templates-parser/ (once) |
make gen | Regenerate .tsx + sidecars from scripts/templates.config.ts |
make build-templates | Full template pipeline (generate → export → post-build) |
make dev-templates | React Email preview server on :3000 |
make up | docker-compose up (postgres + mailpit + mailify) |
make up-deps | Just postgres + mailpit — for local make dev |
make down / make down-volumes | Tear down |
make docker-build | Build local image mailify:local |
make openapi | Curl running server’s /api-docs/openapi.json into ./openapi.json |
make hash-key KEY=… ID=… | argon2-hash an API key (see above) |
make issue-token SUBJECT=… SCOPES=… | Mint a JWT offline (see above) |
Running a single test
Section titled “Running a single test”cargo test -p <crate> <test_name>
# examples:cargo test -p mailify-auth jwt::tests::issues_and_validatescargo test -p mailify-config tests::user_config_dir_prefers_xdg