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

aziosxjs

v1.0.2

Published

πŸš€ Advanced HTTP client featuring request monitoring, auth management, plugins, middleware, and universal runtime support

Downloads

354

Readme

Aziosxjs

npm version npm downloads npm downloads per week License: MIT TypeScript Node.js PRs Welcome

πŸš€ Advanced HTTP client with request monitoring, built-in auth, plugins, middleware, and universal runtime support

Aziosxjs is a modern, lightweight, and highly extensible HTTP client for JavaScript/TypeScript applications. Built for production, featuring intelligent request monitoring, native authentication management, and a powerful plugin architecture.


🌟 Why Aziosxjs?

| Feature | Aziosxjs | Axios | Fetch | |---------|----------|-------|-------| | Request Monitoring | βœ… Built-in dashboard | ❌ 3rd party | ❌ No | | Auth Manager | βœ… Native + auto-refresh | ❌ Manual | ❌ No | | Plugin System | βœ… Full lifecycle | ❌ No | ❌ No | | Middleware | βœ… Koa-style | ❌ No | ❌ No | | Interceptors | βœ… Request/Response | βœ… Yes | ❌ No | | Retry Logic | βœ… Exponential backoff | ❌ No | ❌ No | | Caching | βœ… TTL-based | ❌ No | ❌ No | | Rate Limiting | βœ… Built-in | ❌ No | ❌ No | | TypeScript | βœ… Full support | βœ… Yes | βœ… Partial | | Universal Runtime | βœ… Node/Browser/Deno | ❌ Node/Browser | βœ… Universal |


πŸš€ Quick Start

Installation

npm install aziosxjs

Basic Usage

import azios from 'aziosxjs'

// GET request
const user = await azios.get('https://api.example.com/users/1')
console.log(user.data)

// POST request
const post = await azios.post('https://api.example.com/posts', {
  title: 'Hello World',
  body: 'My first post'
})

// PUT request
await azios.put('https://api.example.com/posts/1', {
  title: 'Updated Title'
})

// DELETE request
await azios.delete('https://api.example.com/posts/1')

✨ Key Features

1. πŸ“Š Request Monitoring & Debug Dashboard

Monitor all HTTP requests with real-time debugging:

import azios from 'aziosxjs'

// Enable monitoring
azios.monitor.enable()

// Make requests...
await azios.get('https://api.example.com/users')

// View request history
console.log(azios.monitor.getHistory())

// Get statistics
console.log(azios.monitor.getStats())
// { totalRequests: 5, totalErrors: 1, averageDuration: 245, ... }

// Export for analysis
const json = azios.monitor.exportJSON()
const csv = azios.monitor.exportCSV()

// Filter and analyze
const errors = azios.monitor.getErrors()
const getRequests = azios.monitor.getByMethod('GET')

2. πŸ” Built-in Authentication Manager

Enterprise-grade authentication with automatic token refresh:

import azios, { createAuthPlugin } from 'aziosxjs'

// Setup auth
const authPlugin = createAuthPlugin({
  refreshUrl: 'https://api.example.com/auth/refresh',
  logoutUrl: 'https://api.example.com/auth/logout'
})

await azios.installPlugin(authPlugin)

// Now all requests:
// βœ… Attach Authorization headers
// βœ… Detect 401 responses
// βœ… Refresh token automatically
// βœ… Retry with new token

3. πŸ”Œ Plugin System

Extend functionality with a clean plugin architecture:

import azios, { AziosPlugin } from 'aziosxjs'

const loggingPlugin: AziosPlugin = {
  name: 'logger',
  version: '1.0.0',
  hooks: {
    beforeRequest: (config) => {
      console.log(`πŸ“‘ ${config.method} ${config.url}`)
      return config
    },
    afterResponse: (response) => {
      console.log(`βœ… Status: ${response.status}`)
      return response
    }
  }
}

await azios.installPlugin(loggingPlugin)

4. βš™οΈ Middleware Pipeline

Koa-style middleware for request processing:

azios.use(async (ctx, next) => {
  console.log('Before request')
  await next()
  console.log('After response')
})

5. πŸ”„ Interceptors

Intercept and transform requests/responses:

azios.interceptors.request.use(
  (config) => {
    config.headers.Authorization = `Bearer ${token}`
    return config
  }
)

azios.interceptors.response.use(
  (response) => response,
  (error) => {
    if (error.response?.status === 401) {
      // Handle unauthorized
    }
    return Promise.reject(error)
  }
)

6. ⚑ Performance Features

Retry with Exponential Backoff

await azios.get('/api/data', {
  retry: 3,         // Retry 3 times
  retryDelay: 1000  // 1s, 2s, 4s delays
})

Response Caching

await azios.get('/api/users', {
  cache: true,      // Enable caching
  cacheTTL: 60000   // Cache for 60 seconds
})

Rate Limiting

await azios.post('/api/data', payload, {
  rateLimit: 1000   // 1 request per second
})

Request Deduplication

// Both use the same network call
const [data1, data2] = await Promise.all([
  azios.get('/api/users/1'),
  azios.get('/api/users/1')
])

πŸ“– Complete Examples

Example 1: Simple GET/POST

import azios from 'aziosxjs'

async function main() {
  const users = await azios.get('https://jsonplaceholder.typicode.com/users')
  console.log(users.data)

  const post = await azios.post('https://jsonplaceholder.typicode.com/posts', {
    title: 'My Post',
    body: 'Content',
    userId: 1
  })
  console.log(post.data)
}

Example 2: With Request Monitoring

azios.monitor.enable()

await azios.get('https://api.example.com/users')
await azios.post('https://api.example.com/data', { /* data */ })

console.log(azios.monitor.getSummary())
console.log(azios.monitor.getStats())

Example 3: With Authentication

const authPlugin = createAuthPlugin({
  refreshUrl: 'https://api.example.com/refresh',
  logoutUrl: 'https://api.example.com/logout'
})

await azios.installPlugin(authPlugin)

// Requests automatically handle auth and token refresh
const data = await azios.get('https://api.example.com/protected')

Example 4: Custom Instances

import { createInstance } from 'aziosxjs'

const api = createInstance({
  baseURL: 'https://api.example.com',
  timeout: 10000,
  headers: {
    'X-Custom-Header': 'value'
  }
})

const data = await api.get('/users')

Example 5: Advanced Configuration

const response = await azios.request({
  url: '/api/users',
  method: 'GET',
  baseURL: 'https://api.example.com',
  headers: { Authorization: 'Bearer token' },
  params: { page: 1, limit: 10 },
  timeout: 5000,
  retry: 2,
  retryDelay: 500,
  cache: true,
  cacheTTL: 30000,
  rateLimit: 1000
})

πŸ”§ Configuration

Request Config API

interface AziosRequestConfig {
  url?: string
  method?: string
  baseURL?: string
  headers?: Record<string, any>
  params?: Record<string, any>
  data?: any
  timeout?: number
  responseType?: string
  signal?: AbortSignal
  retry?: number
  retryDelay?: number
  cache?: boolean
  cacheTTL?: number
  rateLimit?: number
}

πŸ“¦ TypeScript Support

Full TypeScript support with complete type safety:

import azios, { 
  AziosInstance, 
  AziosRequestConfig, 
  AziosResponse,
  RequestLog,
  TokenConfig
} from 'aziosxjs'

const response: AziosResponse = await azios.get('/api/users')

🌍 Universal Runtime Support

Works across different JavaScript runtimes:

import { detectRuntime, currentRuntime } from 'aziosxjs'

console.log(currentRuntime) // 'node' | 'browser' | 'deno' | 'bun'

Supported: Node.js, Browser, Deno, Bun


🎯 API Reference

Monitoring API

azios.monitor.enable()              // Enable tracking
azios.monitor.disable()             // Disable tracking
azios.monitor.getHistory()          // Get all logs
azios.monitor.getStats()            // Get statistics
azios.monitor.getErrors()           // Get failed requests
azios.monitor.getByMethod(method)   // Filter by HTTP method
azios.monitor.getByUrl(pattern)     // Filter by URL
azios.monitor.exportJSON()          // Export as JSON
azios.monitor.exportCSV()           // Export as CSV
azios.monitor.getSummary()          // Get formatted summary
azios.monitor.clear()               // Clear all logs

Auth Manager API

const auth = new AuthManager()

auth.initialize(endpoints)          // Setup endpoints
auth.setToken(token)                // Store token
auth.getToken()                     // Get stored token
auth.getAccessToken()               // Get access token string
auth.hasToken()                     // Check if token exists
auth.isTokenExpired()               // Check expiration
auth.refreshAccessToken()           // Refresh token
auth.attachAuthHeader(config)       // Add auth header
auth.handle401(config)              // Handle 401 response
auth.logout()                       // Logout and clear
auth.getStatus()                    // Get auth status

πŸ›‘οΈ Best Practices

Security

// βœ… DO: Use secure token storage
const authPlugin = createAuthPlugin({
  refreshUrl: 'https://api.example.com/auth/refresh',
  logoutUrl: 'https://api.example.com/auth/logout'
})

// ❌ DON'T: Store tokens in localStorage
// localStorage.setItem('token', sensitiveToken)

Error Handling

import { AziosError } from 'aziosxjs'

try {
  await azios.get('/api/users')
} catch (error) {
  if (error instanceof AziosError) {
    console.log(`[${error.response?.status}] ${error.message}`)
  }
}

Production Monitoring

if (process.env.NODE_ENV === 'development') {
  azios.monitor.enable()
}

setInterval(() => {
  const stats = azios.monitor.getStats()
  if (stats.totalErrors > 10) {
    alerting.warn('High error rate!')
  }
}, 60000)

πŸ§ͺ Testing

npm test                      # Run all tests
npm run test:sprint8:monitoring  # Test monitoring
npm run test:sprint8:auth        # Test auth

πŸ“š Documentation


🀝 Contributing

Contributions welcome! Please see CONTRIBUTING.md


πŸ“„ License

MIT Β© 2024 Azeem Ali


πŸ™‹ Support

Made with ❀️ for the JavaScript community