influx

A zero-dependency TypeScript client for InfluxDB 1.x, built for Node.js and the browser

SDK
npm
v5.12.0
864stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
51/100Fair
Development Activity20
Maintenance20
Community76
Maturity60
Momentum28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
62/100Good
Architecture66
Code Quality62
Innovation58
Learning Curve60

influx is the community-maintained InfluxDB client for InfluxDB 1.x, providing a typed, promise-based API for writing points, running InfluxQL queries, and managing databases and retention policies from Node.js or the browser. It ships a fluent query builder for constructing InfluxQL without hand-built strings, along with an optional schema layer that validates measurement fields and tags at write time to catch type mismatches before they reach the server.

The library has no runtime dependencies, connection-pools across multiple InfluxDB hosts with configurable failover and backoff, and exposes low-level escaping/grammar helpers for teams that need to compose raw queries. It targets InfluxDB 1.x specifically; users on InfluxDB 2.x are pointed to the official client instead.

What You Get

  • A promise-based client covering writes, InfluxQL queries, and database/retention-policy management
  • A fluent query builder (b.* helpers) for composing InfluxQL expressions safely
  • An optional schema system that validates measurement fields/tags and coerces types on write
  • Multi-host connection pooling with configurable failover, backoff, and request timeouts
  • Zero runtime dependencies and full TypeScript typings out of the box
  • Browser compatibility alongside the Node.js runtime

Common Use Cases

  • Ingesting application or IoT sensor metrics into InfluxDB 1.x from a Node.js backend
  • Building internal dashboards or reporting tools that query time-series data via InfluxQL
  • Writing batched points from monitoring/telemetry pipelines with retry-safe connection pooling
  • Validating write payloads against a defined schema before they hit the database

Under The Hood

Architecture — The client centers on an InfluxDB class (src/index.ts, ~1,600 lines) that composes a Pool (src/pool.ts) for HTTP transport across one or more hosts, a grammar/builder layer (src/grammar, src/builder.ts) for InfluxQL construction and escaping, and a Schema layer (src/schema.ts) for optional field/tag coercion. Writes flow: schema coercion (if configured) → line-protocol serialization via grammar helpers → pooled HTTP POST with retry/backoff; queries flow the reverse, with results.ts parsing InfluxDB’s JSON response shape into typed rows. Tech Stack — Pure TypeScript with zero runtime dependencies; builds via tsc, tests with Mocha/Chai run through tsx, linting/formatting via Prettier, and docs generated with ESDoc. Browser support is achieved without bundler-specific shims, relying on standard fetch-adjacent HTTP primitives. Code Quality — Unit tests live under test/unit (builder, grammar, pool, schema, results) alongside a separate test/integrate suite that exercises a live InfluxDB instance, plus a small test/bench benchmark directory; the split between unit and integration tests is a deliberate quality signal, though the project’s low recent commit velocity (~1 commit/month) suggests contributions have slowed. API Design — The public surface favors a fluent builder (b.*) over raw string queries and exposes strongly-typed config interfaces (ISingleHostConfig, IClusterConfig), giving good editor autocomplete; the tradeoff is a fairly large single index.ts entry point that concentrates most of the client’s public methods rather than splitting them across smaller modules.

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