mitt

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

Library
npm
v3.0.1
11,910 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
45 /100 Fair
Development Activity 0
Maintenance 20
Community 60
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
76 /100 Good
Architecture 70
Code Quality 78
Innovation 62
Learning Curve 92

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
95%
MIT

Actual

Invoicing Finance

29,186

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
73
Dependency
Built with
TypeScript 95%
Updated 4 days ago
PHP
73%
MIT

Bagisto

Analytics · Ecommerce

28,186

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
67
Dependency
Built with
PHP 73%
Blade 21%
Updated 1 weeks ago
Python
68%
Other

Baserow

Databases · No Code Platforms

6,012

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
Python 68%
JavaScript 16%
Vue 11%
Updated 5 days ago
Ruby
50%
Other

Chatwoot

Customer Support

37,254

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
69
Dependency
Built with
Ruby 50%
Vue 25%
JavaScript 22%
Updated 5 days ago
Java
70%
GPL 3.0

DataEase

AI Assistants · Analytics · Data Engineering

24,558

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
65
Dependency
Built with
Java 70%
Vue 29%
Updated 4 days ago
TypeScript
50%
Other

Dify

AI Development · Design Tools · Developer Tools

157,364

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

View details
92
Repo Health
85
Technical
66
Dependency
Built with
TypeScript 50%
Python 47%
Updated 4 days ago
TypeScript
79%
Other

Directus

CMS · Low Code Platforms

37,987

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
92
Repo Health
82
Technical
76
Dependency
Built with
TypeScript 79%
Vue 19%
Updated 1 weeks ago
TypeScript
95%
AGPL 3.0

Docmost

CMS · Collaboration · Note Taking

21,801

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
69
Dependency
Built with
TypeScript 95%
Updated 5 days ago
TypeScript
55%
Other

Jaaz

AI Agents · AI Design Tools

6,670

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

View details
48
Repo Health
59
Technical
71
Dependency
Built with
TypeScript 55%
Python 34%
JavaScript 10%
Updated 7 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