npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@arxis/api

v1.7.4

Published

Lightweight, type-safe Angular HTTP client wrapper for REST APIs. Simplifies HttpClient with base URL management, global headers, and full standalone/NgModule support.

Readme

@arxis/api

Lightweight, type-safe Angular HTTP client wrapper — simplify REST API calls with a clean service layer.

npm Angular

Stop writing repetitive HttpClient boilerplate. @arxis/api provides a typed, injectable ApiService that wraps Angular's HttpClient with a consistent interface for GET, POST, PUT, PATCH, and DELETE — with automatic base URL management, global headers, and full support for standalone and NgModule architectures.

Why use this?

  • Less boilerplate — No need to repeat this.http.get(baseUrl + '/endpoint') everywhere.
  • Global headers — Set auth tokens or API keys once, applied to every request automatically.
  • Type-safe — Full TypeScript generics for request and response types.
  • Standalone & NgModule — Works with provideApi() (Angular 14+) or ApiModule.forRoot() (Angular 10+).
  • Observable-based — Returns Observable<T>, Observable<HttpResponse<T>>, or Observable<HttpEvent<T>> depending on your needs.
  • Zero config — Just provide a base URL and start making requests.

Compatibility

| Angular Version | Support | |----------------|---------| | 10.x – 13.x | ApiModule.forRoot() | | 14.x – 21.x+ | ApiModule.forRoot() / provideApi() |

Installation

npm install @arxis/api

Configuration

Standalone apps (Angular 14+) — Recommended

Use provideApi() in your application config:

// app.config.ts
import { ApplicationConfig } from '@angular/core';
import { provideHttpClient } from '@angular/common/http';
import { provideApi } from '@arxis/api';

export const appConfig: ApplicationConfig = {
  providers: [
    provideHttpClient(),
    ...provideApi({ url: 'https://api.example.com' }),
  ],
};

You can pass additional providers (e.g. interceptors) as extra arguments:

provideHttpClient(withInterceptors([authInterceptor])),
...provideApi({ url: 'https://api.example.com' }),

NgModule apps (Angular 10+)

Use ApiModule.forRoot() in your root module:

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { ApiModule } from '@arxis/api';
import { AppComponent } from './app.component';

@NgModule({
  declarations: [AppComponent],
  imports: [
    BrowserModule,
    ApiModule.forRoot({ url: 'https://api.example.com' }),
  ],
  bootstrap: [AppComponent],
})
export class AppModule {}

EndPointConfig

interface EndPointConfig {
  url: string;
  globalHeaders?: Record<string, string | string[]>;
}

| Property | Type | Description | |-----------------|-----------------------------------------|--------------------------------------| | url | string | Base URL for all API requests. | | globalHeaders | Record<string, string \| string[]> | Headers injected into every request. |

Usage

Inject ApiService and use the HTTP methods:

import { ApiService } from '@arxis/api';

@Injectable()
export class UserService {
  constructor(private api: ApiService) {}

  getUsers() {
    return this.api.get<User[]>('users');
  }

  createUser(body: CreateUserDto) {
    return this.api.post<User>('users', body);
  }

  updateUser(id: string, body: Partial<User>) {
    return this.api.put<User>(`users/${id}`, body);
  }

  patchUser(id: string, body: Partial<User>) {
    return this.api.patch<User>(`users/${id}`, body);
  }

  deleteUser(id: string) {
    return this.api.delete<void>(`users/${id}`);
  }
}

Available methods

| Method | Signature | |----------|-----------| | get | get<T>(endpoint, params?, reqOpts?) | | post | post<T>(endpoint, body, reqOpts?) | | put | put<T>(endpoint, body, reqOpts?) | | patch | patch<T>(endpoint, body, reqOpts?) | | delete | delete<T>(endpoint, reqOpts?) |

All methods support observe: 'response' and observe: 'events' overloads.

Features in detail

Base URL management

Configure once, use everywhere. All endpoints are relative to the base URL:

// Configured with: { url: 'https://api.example.com' }
api.get('users');       // GET https://api.example.com/users
api.post('orders', {}); // POST https://api.example.com/orders

Global headers

Inject authentication tokens, API keys, or any header into every outgoing request:

provideApi({
  url: 'https://api.example.com',
  globalHeaders: {
    'Authorization': 'Bearer my-token',
    'X-Api-Key': 'key-123',
  },
})

Query parameters

Pass query params as a plain object or HttpParams:

api.get<User[]>('users', { role: 'admin', active: 'true' });
// GET https://api.example.com/users?role=admin&active=true

Response types

Control what the Observable emits:

// Body only (default)
api.get<User[]>('users');

// Full HTTP response (status, headers, body)
api.get<User[]>('users', null, { observe: 'response' });

// HTTP events (upload progress, etc.)
api.post<void>('upload', formData, { observe: 'events', reportProgress: true });

Keywords

angular http client, angular rest api service, angular api wrapper, angular httpclient wrapper, angular http service, angular api service, typed http client angular, angular standalone api provider, angular global headers, angular base url configuration

License

MIT