mitt

Tiny (~200 byte) functional event emitter and pubsub for JavaScript and TypeScript

Library
npm
v3.0.1
11,900stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
45/100Fair
Development Activity0
Maintenance20
Community60
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
76/100Good
Architecture70
Code Quality78
Innovation62
Learning Curve92

mitt is an extremely small functional event emitter/pubsub library, weighing under 200 bytes gzipped, that gives JavaScript applications a familiar on/off/emit API modeled after Node’s EventEmitter. Unlike class-based emitters, mitt’s methods are purely functional and don’t rely on this, and it adds a wildcard '*' event type that listens to every emitted event.

Written in TypeScript, mitt provides strong generic typing for event maps when strict mode is enabled in a consuming project’s tsconfig.json, letting handlers infer their event payload types automatically. It has no dependencies, supports IE9+, and works in any JavaScript runtime, making it a common choice for decoupled component communication in frameworks like Vue and Preact as well as vanilla JavaScript applications.

What You Get

  • A functional on/off/emit event emitter API modeled after Node’s EventEmitter, with no reliance on this
  • A wildcard '*' event type that listens to every emitted event, receiving both the event type and payload
  • Strong TypeScript generics — define an Events type map and get inferred, type-checked handler and payload types
  • Direct access to the underlying all Map of event names to handler sets, for bulk operations like clearing all listeners
  • Zero dependencies and IE9+ support, usable in any JavaScript runtime (browser, Node.js, or bundled via ESM/CJS/UMD)

Common Use Cases

  • Decoupled communication between components in frameworks without a built-in event bus (e.g. Preact, Vue 3 which dropped its own $on/$off)
  • Implementing a lightweight application-wide event bus for cross-cutting concerns like analytics or notifications
  • Building small state or plugin systems that need publish/subscribe semantics without pulling in a full framework
  • Prototyping or teaching event-driven patterns where a minimal, readable emitter implementation is preferred over Node’s built-in EventEmitter in browser code

Under The Hood

Architecture - mitt is implemented as a single ~120-line TypeScript file (src/index.ts) exporting one factory function that creates an emitter instance backed by a Map<EventType, Handler[]>; on, off, and emit are plain functions closing over that map rather than class methods, which is what allows the entire implementation to be so small and to avoid this-binding footguns. Tech Stack - Pure TypeScript with no runtime dependencies, compiled to ESM, CommonJS, and UMD builds for universal consumption; the UMD build is distributed via unpkg for direct <script> tag usage. Code Quality - The repository includes a dedicated index_test.ts covering core emitter behavior and a test-types-compilation.ts file specifically verifying the TypeScript generic inference works as documented — an unusually thorough test investment for a library this small, reflecting how central correct typing is to its value proposition. API Design - The three-method surface (on, off, emit) plus the wildcard '*' convention is deliberately tiny and immediately familiar to anyone who has used Node’s EventEmitter, while the TypeScript generics let consumers get compile-time safety on event names and payload shapes with minimal ceremony — a rare combination of minimalism and type safety.

Used by 17 apps in this directory

TypeScript
94%
MIT

Actual

Invoicing Finance

28,224

Local-first personal finance with envelope budgeting, end-to-end encryption, and multi-device sync — no subscription required.

View details
93
Repo Health
85
Technical
77
Dependency
Built with
TypeScript94%
Updated yesterday
PHP
72%
MIT

Bagisto

Analytics · Ecommerce

27,983

Open-source Laravel eCommerce platform for building multi-vendor marketplaces, B2B stores, headless commerce, and AI-powered storefronts.

View details
93
Repo Health
75
Technical
69
Dependency
Built with
PHP72%
Blade22%
Updated today
Python
68%
Other

Baserow

No Code Platforms · Databases

5,635

Open-source no-code platform to build databases, apps, automations, and AI agents — self-hosted or cloud, with full data ownership.

View details
89
Repo Health
84
Technical
68
Dependency
Built with
Python68%
JavaScript15%
Vue12%
Updated today
Ruby
49%
Other

Chatwoot

Customer Support

35,974

Open-source omnichannel customer support platform with AI-powered agents, live chat, and self-hosting — a full Intercom and Zendesk alternative.

View details
95
Repo Health
78
Technical
72
Dependency
Built with
Ruby49%
Vue26%
JavaScript22%
Updated today
Java
78%
GPL 3.0

DataEase

Analytics · Data Engineering · AI Assistants

24,346

Open-source BI tool with drag-and-drop dashboards, 20+ data source connectors, and AI-powered natural language queries — a self-hosted alternative to Tableau.

View details
94
Repo Health
71
Technical
66
Dependency
Built with
Java78%
Vue22%
Updated today
TypeScript
50%
Other

Dify

No Code Platforms · AI Development · Developer Tools

152,883

Visual LLM workflow platform with RAG pipelines, agent capabilities, and model management for building production AI applications.

View details
92
Repo Health
85
Technical
71
Dependency
Built with
TypeScript50%
Python47%
Updated today
TypeScript
80%
Other

Directus

CMS · Low Code Platforms

37,462

Connect any SQL database and get instant REST and GraphQL APIs, a visual management Studio, and a native MCP server for AI agents — free for most organizations.

View details
93
Repo Health
82
Technical
78
Dependency
Built with
TypeScript80%
Vue18%
Updated yesterday
TypeScript
95%
AGPL 3.0

Docmost

Productivity · Note Taking · Collaboration

21,411

Self-hosted collaborative wiki and knowledge base with real-time editing, diagrams, AI assistance, and enterprise access controls — a modern alternative to Confluence and Notion.

View details
89
Repo Health
70
Technical
71
Dependency
Built with
TypeScript95%
Updated yesterday
TypeScript
55%
Other

Jaaz

AI Design Tools · AI Agents

6,552

Open-source AI creative agent that turns visual sketches and canvas gestures into images and videos — no text prompts required.

View details
45
Repo Health
59
Technical
71
Dependency
Built with
TypeScript55%
Python34%
JavaScript10%
Updated 5 months ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search