mitt

Tiny (~200 byte) functional event emitter / pub-sub library for JavaScript. Mitt provides emit, on, and off methods for typed event handling in both browser and Node.js. No classes, no inheritance — just a factory function. Popular in Preact, Vue, and micro-frontends where event-bus patterns connect decoupled components without framework state management.

Evaluated Mar 06, 2026 (0d ago) v3.x
Homepage ↗ Repo ↗ Developer Tools event-emitter pub-sub tiny javascript browser node 200-bytes typed
⚙ Agent Friendliness
68
/ 100
Can an agent use this?
🔒 Security
98
/ 100
Is it safe for agents?
⚡ Reliability
93
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

MCP Quality
--
Documentation
90
Error Messages
75
Auth Simplicity
100
Rate Limits
100

🔒 Security

TLS Enforcement
100
Auth Strength
100
Scope Granularity
100
Dep. Hygiene
98
Secret Handling
92

200 byte library with zero dependencies — minimal attack surface. Event payloads are in-memory only — no persistence or external transmission.

⚡ Reliability

Uptime/SLA
100
Version Stability
95
Breaking Changes
95
Error Recovery
82
AF Security Reliability

Best When

You need a tiny, typed, dependency-free event emitter for simple pub-sub in JavaScript apps without framework overhead.

Avoid When

You need wildcards, namespacing, once() support, ordered handlers, or error propagation — use a fuller EventEmitter implementation.

Use Cases

  • Implement lightweight pub-sub event bus for agent micro-frontends that need decoupled component communication without Redux/Vuex overhead
  • Add typed event emitters to agent modules using mitt's TypeScript generic types for safe event payload typing
  • Create cross-frame or cross-component event communication in agent UIs where a shared event bus replaces prop drilling
  • Build simple agent workflow event notification systems where tasks emit events and multiple handlers subscribe to state changes
  • Replace Node.js EventEmitter with mitt for browser-compatible, typed event emission in isomorphic agent libraries

Not For

  • Complex event systems with ordering guarantees, priorities, or middleware — use EventEmitter3 or RxJS for more features
  • Distributed event streaming — mitt is in-process only; use NATS, Kafka, or Redis pub-sub for distributed events
  • Framework-idiomatic event handling — use Vue's $emit, React's callback props, or Angular EventEmitter for framework-native patterns

Interface

REST API
No
GraphQL
No
gRPC
No
MCP Server
No
SDK
Yes
Webhooks
No

Authentication

Methods: none
OAuth: No Scopes: No

No authentication — tiny local pub-sub library.

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

mitt is open source and free.

Agent Metadata

Pagination
none
Idempotent
Full
Retry Guidance
Not documented

Known Gotchas

  • mitt has no 'once()' handler — implement once() manually with a wrapper that calls off() after first invocation, or use mitt + a wrapper
  • Emitting events with no listeners is silently ignored — no error, no warning; typos in event names cause silent no-ops
  • mitt all events ('*') handler receives all events — useful for debugging but don't use in production if handlers have performance overhead
  • TypeScript event map must be defined upfront — mitt<Events>() where Events = {eventName: payload} provides type safety but requires planning all events at creation
  • Multiple mitt instances are independent — events emitted on one instance don't propagate to another; use a singleton for cross-module communication
  • No built-in error handling in handlers — exceptions in event handlers propagate up to emit() caller; wrap handlers in try/catch for resilient event systems

Alternatives

Full Evaluation Report

Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for mitt.

$99

Scores are editorial opinions as of 2026-03-06.

5211
Packages Evaluated
26151
Need Evaluation
173
Need Re-evaluation
Community Powered