A declarative, decorator-based HTTP client library for JavaScript/TypeScript that mimics Android's Retrofit pattern, built on top of axios. Current stable version is 2.0.2. Release cadence is low, with infrequent updates. Key differentiators: uses ES decorators for defining API endpoints, supports path parameters, headers, and body annotations, integrates with axios interceptors. Compared to alternatives like fetch or raw axios, it provides a structured, annotation-driven approach suitable for TypeScript projects seeking a Retrofit-like experience.
npm install axios-retrofitNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows a basic Retrofit-style service definition with GET decorator, path parameter, and header injection, then builds and calls it.
Add "experimentalDecorators": true and "emitDecoratorMetadata": true in tsconfig.json compilerOptions.
Ensure method signatures include return type Promise<Response<T>> and type assertion as shown. Do not add implementation.
Consider migrating to a maintained alternative like angular or fetch-based wrapper if modern features are needed.
Update import to 'axios-retrofit' and reinstall.
Ensure you have 'import { BaseService } from "axios-retrofit"' and not a default import.Enable 'experimentalDecorators' in tsconfig.json and ensure decorators are applied to class methods.
Use ES import syntax: import { GET } from 'axios-retrofit' instead of const { GET } = require('axios-retrofit').