nid-inbox
v0.5.0
Published
Local email API, inbox, and webhook simulator for testing apps and AI agents.
Maintainers
Readme
nid
Local email API, inbox, and webhook simulator for testing apps and AI agents.
While you build or run tests, your app sends email to nid instead of real recipients. nid intercepts official email SDKs with zero app-code changes, validates requests with provider-shaped errors, triggers signed webhooks back to your app, and wakes waiting tests and AI agents when mail arrives. No email leaves your machine. nid calls out only to the webhook URLs you set.

Read the documentation, or start with the ten-minute tutorial.
Quick start
You need Node.js 22.13 or later.
Run your app with nid:
npx nid-inbox run -- npm run devnid runstarts nid in the background and redirects outbound HTTP calls for the Resend, Amazon SES, Brevo, SendGrid, Postmark, and Mailgun SDKs without changing your app code.Open http://127.0.0.1:4400 in your browser to see arrived messages, HTML previews, sign-in codes, links, refused requests, and webhook deliveries.
If your app runs outside nid run (such as Docker or another language), start nid on its own and point your email SDK or SMTP client at it:
npx nid-inbox serveSMTP listens on 127.0.0.1:1025, and HTTP provider APIs and the read API listen on http://127.0.0.1:4400.
Read mail in tests
Your tests can wait on mail with zero polling. In Playwright:
import { test, expect } from '@nid-inbox/client/playwright'
test('sign up, then resend the code', async ({ page, inbox }) => {
const email = inbox.address('signup')
await page.fill('#email', email)
await page.click('text=Send code')
const first = await inbox.waitFor(email, { hasCode: true })
await page.click('text=Resend code')
const second = await inbox.waitFor(email, { hasCode: true })
expect(second.code).not.toBe(first.code)
await page.fill('#code', second.code!)
})What sets nid apart
- Zero-code provider APIs and SDK error fidelity: Answers the HTTP APIs for Resend, Amazon SES (v2 JSON and v1 XML), Brevo, SendGrid, Postmark, and Mailgun, plus SMTP on port 1025. Redirects official Node SDKs via
nid runornid-inbox/interceptand returns provider-shaped 4xx validation errors. - Event-driven test helpers and rejection diagnostics:
@nid-inbox/clientand/api/waitwake over an internal event bus when mail arrives, with Playwright fixtures and automatic code and link extraction. When a wait times out, nid reports matching refused sends so failures explain why email never arrived. - Signed webhook simulation and fault injection: Triggers provider-signed webhooks (
delivered,bounced,deferred,complained,opened,clicked), supports--auto-webhookafter acceptance, and simulates rate limits, bounces, deferrals, complaints, and custom HTTP errors via magic addresses (ratelimit@,bounce@,defer@,complain@) or/api/faults. - Built-in MCP server for AI agents: Exposes
new_address,wait_for_email,get_code,get_links,get_message,list_messages,list_rejections,trigger_webhook, andclearover HTTP (/mcp) and stdio (nid mcp).
Packages
| Package | What it is |
| --- | --- |
| nid-inbox | The server, nid run / nid serve CLI, and nid-inbox/intercept preload hook. |
| @nid-inbox/client | Typed test client and Playwright fixture. |
| ghcr.io/oluwatobiadegoke/nid | The Docker image. |
Documentation
| Kind | Pages | | --- | --- | | Tutorial | Get started | | How-to guides | See your mail in the web view, Run nid (npm, Docker, Playwright, GitHub Actions), Point your app at nid, Read mail in tests, Test your webhook handler, Use the command line, Let an AI agent read your mail, Embed nid in your own code | | Reference | Command line, Configuration, Read API, Client library, Providers, MCP reference | | Explanation | How nid works, Security |
Contributing
Each provider is one file under packages/server/src/providers/, and docs change in the same pull request as the code. See CONTRIBUTING.md.
License
Apache-2.0.
