exa-js

Official TypeScript/JavaScript SDK for the Exa AI-native web search API

SDK
npm
v2.18.1
128stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
82/100Excellent
Development Activity96
Maintenance84
Community76
Maturity52
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
81/100Excellent
Architecture82
Code Quality80
Innovation78
Learning Curve85

exa-js is the official JavaScript and TypeScript client for Exa, a web search API purpose-built for AI applications and retrieval-augmented generation. It wraps Exa’s REST endpoints — neural and keyword search, content extraction, cited answers, streaming answers, and longer-running research and agent runs — behind a typed client that works the same way in Node.js and the browser.

Beyond basic search, the SDK exposes Exa’s higher-level surfaces: structured output schemas (via Zod or raw JSON Schema) for search and answer results, streaming variants for both search and answers, a Websets API for building and monitoring curated result sets over time, and an Agent Runs API for kicking off multi-step autonomous research tasks with polling helpers. It ships full TypeScript types for every method and response shape, making it a common building block in LLM tool-calling and RAG pipelines that need live web grounding.

What You Get

  • A single Exa client class covering search, findSimilar, getContents, answer, and streaming variants of search/answer
  • Structured output support on search and answer via Zod schemas or raw JSON Schema, so results come back as typed objects instead of free text
  • A Websets client for creating, monitoring, and enriching persistent, curated collections of search results over time
  • An Agent Runs API for launching and polling longer, multi-step autonomous research tasks with optional Exa Connect data-provider integrations
  • Full TypeScript definitions for every request option and response shape, plus isomorphic fetch handling so the client works in Node.js and browser environments alike

Common Use Cases

  • Giving an LLM agent or chatbot live web-search grounding instead of relying on stale training data
  • Building RAG pipelines that need semantic (neural) search plus clean extracted page text/highlights in one call
  • Generating cited, sourced answers to natural-language questions for research or Q&A features
  • Running scheduled or monitored Websets to keep a curated set of search results fresh (e.g. lead lists, competitor tracking)
  • Kicking off autonomous multi-step research agent runs that return structured JSON output against a caller-defined schema

Under The Hood

Architecture — The SDK centers on a single Exa class (src/index.ts, ~1,660 lines) constructed with an API key, which owns all core methods (search, findSimilar, getContents, answer, streamSearch, streamAnswer) plus sub-clients attached as properties: exa.websets (src/websets/, client + resource files for items, searches, enrichments, imports, monitors, webhooks, events), exa.research (src/research/), exa.agent/exa.beta (src/agent/), and exa.monitors (src/monitors/). Each sub-domain follows the same base-client pattern (base.ts handles auth headers and request plumbing, client.ts exposes the public methods, types.ts/openapi.ts hold generated or hand-written types), so new API surfaces are added as new sub-clients rather than by growing the root class indefinitely — the Websets openapi.ts (3,729 lines) is explicitly generated from Exa’s published OpenAPI spec via a generate:types:websets script.

Tech Stack — Pure TypeScript targeting both CJS and ESM output via tsup, built to dist/ with .d.ts types included. Runtime dependencies are deliberately minimal: cross-fetch (isomorphic fetch for Node/browser parity), zod and zod-to-json-schema (optional structured-output schema support), and dotenv for local API-key loading in examples/tests. openai appears as a dependency, used for typing/compatibility with OpenAI-style streaming chunk shapes rather than as an active client. Tooling is modern and consistent: tsup for bundling, vitest for tests (split into unit and integration configs), prettier for formatting, and ts-morph/tsx used in a docs-generation script.

Code Quality — Tests live under test/unit (search, websets — including validation/structure/error/imports/monitors variants, agent, research, monitors, request error handling) and test/integration (live-network tests for search, findSimilar, livecrawl), separated by dedicated Vitest configs so unit tests can run without network access. Error handling is centralized in a small ExaError class (src/errors.ts) carrying HTTP status code, timestamp, and request path, with readResponseBody/truncateResponseBody helpers in index.ts specifically guarding against API gateways returning HTML/text error pages instead of JSON — a detail that shows the maintainers hardened against real production failure modes rather than just the happy path. JSDoc comments are dense throughout the public API surface.

API Design — The client is deliberately low-ceremony: new Exa(apiKey) then exa.search(query, options) covers the common case in two lines, with optional fields (contents, filters, structured output schema) layered on rather than required upfront. Method names map directly to product concepts (search, findSimilar, getContents, answer), streaming variants are named consistently (streamSearch, streamAnswer) and yield OpenAI-style chunks so they slot into existing streaming UI code with little adaptation. TypeScript types are exported for every request/response shape, and the README leads with copy-pasteable quick-start snippets for each major feature (search, contents, answer, agent runs) rather than a reference-only doc style.

Used by 7 apps in this directory

TypeScript
88%
Other

AFFiNE

Productivity · Project Management · Note Taking

71,668

Write, draw, and plan in one infinite canvas — the open-source alternative to Notion and Miro that keeps your data yours.

View details
91
Repo Health
87
Technical
68
Dependency
Built with
TypeScript88%
Updated today
TypeScript
51%
MIT

Anarlog

Note Taking · AI Assistants · Productivity

9,087

Anarlog is an open-source, local-first AI meeting notetaker that records, transcribes, and summarizes meetings entirely on your device — no cloud lock-in, no mandatory account, and every note saved as a plain markdown file you own forever.

View details
86
Repo Health
77
Technical
69
Dependency
Built with
TypeScript51%
Rust38%
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
99%
Apache 2.0

Mastra Code

AI Code Assistants

27,294

"A coding agent that never compacts" — a terminal-based AI coding agent built on the Mastra framework, with Observational Memory instead of context compaction, multi-model support, and OAuth login for Claude Max or ChatGPT Plus.

View details
88
Repo Health
73
Technical
66
Dependency
Built with
TypeScript99%
Updated today
TypeScript
99%
Apache 2.0

Onlook

Design Tools · AI Design Tools

26,512

An open-source, AI-first visual editor that lets designers and developers build, style, and deploy React apps directly in code — no handoff required.

View details
66
Repo Health
80
Technical
68
Dependency
Built with
TypeScript99%
Updated 4 weeks ago
TypeScript
79%
Other

twenty

CRM

55,120

The open-source CRM you build, ship, and version like the rest of your stack — with customizable objects, AI agents, and a TypeScript SDK.

View details
92
Repo Health
82
Technical
67
Dependency
Built with
TypeScript79%
MDX17%
Updated today
TypeScript
52%
Other

World Monitor

Monitoring · Analytics

83,076

Real-time global intelligence dashboard that fuses AI-synthesized news, geopolitical risk scoring, and infrastructure tracking into one open-source situational awareness platform.

View details
86
Repo Health
89
Technical
71
Dependency
Built with
TypeScript52%
JavaScript45%
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