@microsoft/fetch-event-source

A fetch()-powered client for Server-Sent Events that supports headers, request bodies, and retries

Library
npm
v2.0.1
2,867stars
MIT License

Repository Health

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

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
70/100Good
Architecture70
Code Quality66
Innovation65
Learning Curve78

@microsoft/fetch-event-source replaces the browser’s built-in EventSource with an implementation built on fetch(), removing that API’s restriction to GET requests with no custom headers or body. It streams and parses Server-Sent Events (SSE) the same way EventSource does, but lets callers set arbitrary headers (for auth tokens), send a POST body, control retry/backoff behavior, and cleanly cancel an in-flight stream via AbortController.

What You Get

  • An fetchEventSource() function with the same event callbacks as native EventSource (onopen, onmessage, onclose, onerror) plus full control over method, headers, and body
  • Automatic reconnect-with-backoff on connection drops, matching the SSE spec’s retry semantics, with a hook to override or disable it
  • First-class AbortController/signal support so a caller can cancel a stream cleanly instead of leaking an open connection
  • A standards-compliant SSE parser (parse.ts) that handles multi-line data fields, comments, and the retry:/id: control fields per spec

Common Use Cases

  • Streaming token-by-token completions from an LLM API (OpenAI, Azure OpenAI) that requires a POST body and bearer-token header
  • Building a live-updating dashboard or notification feed that needs SSE but must attach an auth header the native EventSource can’t send
  • Replacing polling with a long-lived streamed connection for progress updates on a long-running server-side job
  • Any browser client that needs SSE semantics with the flexibility of fetch() — custom retry logic, request cancellation, or non-GET methods

Under The Hood

Architecture The library is deliberately small: fetch.ts (154 lines) wraps the browser’s native fetch() call, wires it to an AbortController, and manages the retry/backoff loop and event-callback dispatch, while parse.ts (183 lines) implements a dedicated line-based SSE parser that incrementally consumes the streamed response body and emits parsed {event, data, id, retry} messages. index.ts simply re-exports the public fetchEventSource function. Tech Stack Pure TypeScript with zero runtime dependencies, compiled to both CJS (lib/cjs) and ESM (lib/esm) output via two separate tsconfig targets, keeping the published bundle framework-agnostic and usable in any environment with a fetch and ReadableStream implementation. Code Quality The parser has a dedicated Jasmine spec file (parse.spec.ts, 353 lines) exercising SSE parsing edge cases (multi-line fields, comments, partial chunks) in detail, though the higher-level fetch.ts reconnect/backoff logic itself has no equivalent test coverage — test depth is concentrated on the parsing layer, the part most prone to subtle spec-compliance bugs. API Design The API is intentionally a drop-in shape match for the native EventSource callbacks (onopen/onmessage/onerror/onclose), so migrating existing SSE consumer code mostly means swapping the import and adding a fetch-style options object (method, headers, body, signal) — there’s no new mental model to learn, just an extended options surface.

Used by 9 apps in this directory

TypeScript
72%
AGPL 3.0

APITable

Low Code Platforms · Databases

15,526

API-first collaborative spreadsheet-database platform that auto-generates REST APIs and lets teams build internal tools, CRMs, and dashboards without code.

View details
53
Repo Health
77
Technical
60
Dependency
Built with
TypeScript72%
Java22%
Updated 9 months ago
JavaScript
95%
MIT

AnythingLLM

Developer Tools · Automation · AI Assistants

64,914

The all-in-one AI platform for private document chat, no-code agents, and local LLMs with zero setup friction.

View details
91
Repo Health
78
Technical
68
Dependency
Built with
JavaScript95%
Updated today
TypeScript
62%
Other

Flowise

Developer Tools · Automation · No Code Platforms

55,379

Drag-and-drop visual builder for AI agents, RAG pipelines, and multi-agent systems—deploy anywhere in minutes.

View details
91
Repo Health
77
Technical
64
Dependency
Built with
TypeScript62%
JavaScript27%
Updated 6 days ago
TypeScript
53%
Apache 2.0

Flowsint

Automation · Developer Tools

7,669

A privacy-first, graph-based OSINT investigation platform with 30+ automated enrichers for mapping relationships between domains, IPs, people, and organizations.

View details
84
Repo Health
71
Technical
70
Dependency
Built with
TypeScript53%
Python45%
Updated 1 weeks ago
JavaScript
98%
Other

Markdrop

Note Taking

358

Visual drag-and-drop markdown editor with GitHub-specific blocks, cloud sync, and offline PWA support

View details
38
Repo Health
57
Technical
69
Dependency
Built with
JavaScript98%
Updated 4 months ago
Python
55%
Other

PostHog

Analytics · Monitoring · Developer Tools

37,777

The all-in-one open source product platform combining analytics, session replay, feature flags, error tracking, AI observability, and a built-in data warehouse in a single self-hostable stack.

View details
92
Repo Health
80
Technical
67
Dependency
Built with
Python55%
TypeScript36%
Updated today
Rust
67%
Apache 2.0

Rivet

AI Agents · Developer Tools

6,065

Stateful actors as a primitive for AI agents, real-time collaboration, and durable execution — with in-memory state, WebSockets, queues, and scheduling built in.

View details
86
Repo Health
81
Technical
66
Dependency
Built with
Rust67%
TypeScript29%
Updated today
Python
76%
AGPL 3.0

Skyvern

AI Agents · Automation

22,785

Skyvern (YC S2023) automates browser-based workflows by pairing LLMs with computer vision, letting agents click, fill, and extract data on sites they've never seen, without brittle XPath selectors that break on every layout change.

View details
89
Repo Health
82
Technical
71
Dependency
Built with
Python76%
TypeScript22%
Updated today
JavaScript
59%
AGPL 3.0

ToolJet

Low Code Platforms · No Code Platforms · AI Agents

40,458

Open-source AI-native platform to build and deploy internal tools, workflows, and AI agents with a visual drag-and-drop builder and 80+ data source integrations.

View details
94
Repo Health
81
Technical
65
Dependency
Built with
JavaScript59%
TypeScript33%
Updated today

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