@nestjs/axios

Official NestJS module that wraps Axios as an injectable, Observable-based HTTP client

SDK
npm
v4.0.1
248stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
79/100Good
Development Activity100
Maintenance84
Community52
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
72/100Good
Architecture78
Code Quality62
Innovation55
Learning Curve92

@nestjs/axios is the official NestJS integration module for the Axios HTTP client. It wraps Axios inside NestJS’s dependency-injection system, exposing an injectable HttpService whose request methods (get, post, put, patch, delete, and their *Form variants) return RxJS Observables instead of Promises, matching the reactive style used throughout the Nest ecosystem.

The module supports both static (HttpModule.register()) and async (HttpModule.registerAsync()) configuration, so Axios instance options like base URL, headers, and timeouts can be sourced from NestJS’s ConfigService or other providers at bootstrap time. It also exposes the raw underlying Axios instance via axiosRef for cases needing direct Axios API access outside the Observable wrapper.

What You Get

  • An injectable HttpService with Axios-equivalent methods that return RxJS Observable<AxiosResponse>
  • HttpModule.register() and HttpModule.registerAsync() for static or dependency-driven Axios configuration
  • Automatic request cancellation tied to Observable unsubscription via Axios cancel tokens
  • Direct access to the underlying Axios instance through HttpService.axiosRef when the Observable wrapper isn’t needed
  • A global module option to register HttpModule once and inject HttpService anywhere without repeated imports

Common Use Cases

  • Calling third-party REST APIs from a NestJS service using the framework’s standard DI patterns instead of importing Axios directly
  • Centralizing HTTP client configuration (base URL, auth headers, timeouts) via registerAsync sourced from ConfigService
  • Composing outbound HTTP calls with RxJS operators (retry, timeout, catchError) alongside other reactive streams in a Nest app
  • Building typed API client services that other NestJS providers inject and call

Under The Hood

Architecture The module is a small DI wrapper: HttpModule (in lib/http.module.ts) registers an AXIOS_INSTANCE_TOKEN provider backed by a plain Axios.create(config) instance, and HttpService (in lib/http.service.ts) injects that instance and exposes Axios’s request methods, each wrapped through a makeObservable helper that turns the underlying Axios Promise into an RxJS Observable with automatic CancelToken-based cancellation on unsubscribe.

Tech Stack TypeScript module built against @nestjs/common/@nestjs/core as peer dependencies, with axios and rxjs as required peers rather than bundled dependencies, keeping version resolution in the consuming app’s control. Tooling is oxlint for linting, release-it for releases, and Vitest configured (via vitest.config.mts) to run specs from a tests/ directory.

Code Quality The cloned repository does not contain a tracked tests/ directory despite package.json’s test:e2e script and vitest.config.mts pointing at one, so no test coverage is visible in the current default branch snapshot. The source itself is compact (two files under 150 lines total), consistently typed, and follows NestJS’s established module/service/token conventions used across all official @nestjs/* packages.

API Design The API deliberately mirrors Axios’s own method names and signatures (get, post, put, etc.) so anyone familiar with Axios can use HttpService with no new API to learn, while axiosRef provides an escape hatch to the raw Axios instance for anything the Observable wrapper doesn’t cover. Static vs. async module registration follows the exact same pattern used by every other official NestJS module (e.g. @nestjs/config, @nestjs/typeorm), so the learning curve is close to zero for existing Nest developers.

Used by 8 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
TypeScript
96%
Other

Cal.diy

Scheduling

47,796

The 100% MIT-licensed, community-driven scheduling platform — self-host your own booking infrastructure with no enterprise strings attached.

View details
93
Repo Health
86
Technical
66
Dependency
Built with
TypeScript96%
Updated 1 weeks ago
TypeScript
98%
Other

Hexabot

AI Development · Automation

1,186

Build and run agentic workflows across channels with YAML, tools, and RAG

View details
79
Repo Health
76
Technical
70
Dependency
Built with
TypeScript98%
Updated yesterday
TypeScript
71%
Other

highlight.io

Developer Tools · Analytics · Monitoring

9,367

Open-source full-stack monitoring that unifies session replay, error tracking, logging, and distributed tracing so you can stop context-switching between tools.

View details
69
Repo Health
78
Technical
66
Dependency
Built with
TypeScript71%
Go16%
Updated yesterday
TypeScript
98%
Other

Novu

Developer Tools

39,615

Open-source communication infrastructure that connects your products and AI agents to every channel your users live on — Inbox, Email, SMS, Push, Chat, and more.

View details
93
Repo Health
80
Technical
65
Dependency
Built with
TypeScript98%
Updated today
TypeScript
99%
Other

Teable

Databases · No Code Platforms

21,665

A no-code PostgreSQL database with spreadsheet UX, real-time collaboration, and native AI agents — built for teams that outgrow Airtable.

View details
79
Repo Health
76
Technical
64
Dependency
Built with
TypeScript99%
Updated today
TypeScript
79%
MIT

Trench

Analytics · Data Engineering · Monitoring

1,661

Open-source event tracking infrastructure built on Kafka and ClickHouse that handles thousands of events per second on a single node, with full Segment API compatibility and no cookies.

View details
46
Repo Health
81
Technical
73
Dependency
Built with
TypeScript79%
MDX15%
Updated 4 months 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

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