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

devcodes-http-tool

v1.0.4

Published

devcodes-http-tool — A fast, modern HTTP client for Node.js and browsers. Built by Dev Codes.

Readme

DevCodes v1.0.0 📡

The Ultimate HTTP Client Library - Faster, better, and more powerful than Axios.

DevCodes is a modern, TypeScript-first HTTP client designed to replace Axios with superior performance, simpler API, and full type safety.

✨ Features

  • ⚡ Lightning Fast - Optimized for performance with minimal overhead
  • 📝 TypeScript First - Full type definitions and inference
  • 🔄 Request/Response Interceptors - Control request and response flows
  • ⏱️ Timeout Support - Built-in timeout handling
  • 🎯 Simple API - Intuitive interface inspired by Axios but improved
  • 📦 Lightweight - No unnecessary dependencies
  • 🌐 Universal - Works in Node.js and browsers (Fetch API)
  • 🔐 Built-in Security - CORS support, credentials handling
  • 🚀 Modern - Uses Fetch API under the hood

📦 Installation

npm install devcodes-http-tool

🚀 Quick Start

Basic Usage

import devcodes from 'devcodes-http-tool';

// GET request
const response = await devcodes.get('/api/users');
console.log(response.data);

// POST request
const result = await devcodes.post('/api/users', {
  name: 'John',
  email: '[email protected]'
});

// With full config
const data = await devcodes.request({
  url: '/api/data',
  method: 'GET',
  baseURL: 'https://api.example.com',
  timeout: 5000
});

Create Instance

import { create } from 'devcodes-http-tool';

const client = create({
  baseURL: 'https://api.example.com',
  timeout: 10000,
  headers: {
    'Authorization': 'Bearer token123'
  }
});

// Use the instance
const users = await client.get('/users');

📚 API Reference

Methods

All methods return a Promise<Response<T>> where T is your data type.

GET

devcodes.get<T>(url, config?)

POST

devcodes.post<T>(url, data?, config?)

PUT

devcodes.put<T>(url, data?, config?)

PATCH

devcodes.patch<T>(url, data?, config?)

DELETE

devcodes.delete<T>(url, config?)

HEAD

devcodes.head<T>(url, config?)

OPTIONS

devcodes.options<T>(url, config?)

Generic Request

devcodes.request<T>(config)

Configuration

interface RequestConfig {
  url?: string;
  method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
  baseURL?: string;
  data?: any;
  params?: Record<string, any>;
  headers?: Record<string, string>;
  timeout?: number;
  withCredentials?: boolean;
  auth?: { username: string; password: string };
  responseType?: 'json' | 'text' | 'arraybuffer' | 'blob';
  maxRedirects?: number;
  validateStatus?: (status: number) => boolean;
}

Response

interface Response<T> {
  data: T;
  status: number;
  statusText: string;
  headers: Record<string, string>;
  config: RequestConfig;
}

🔗 Interceptors

Request Interceptors

Modify requests before they're sent:

import { create } from 'devcodes-http-tool';

const client = create();

client.requestInterceptors.use(
  (config) => {
    // Add authorization header
    config.headers = {
      ...config.headers,
      'Authorization': `Bearer ${getToken()}`
    };
    return config;
  },
  (error) => {
    return Promise.reject(error);
  }
);

Response Interceptors

Process responses:

client.responseInterceptors.use(
  (response) => {
    console.log('Response received:', response.status);
    return response;
  },
  (error) => {
    // Handle errors globally
    console.error('Request failed:', error);
    return Promise.reject(error);
  }
);

🔧 Advanced Examples

Timeout Handling

try {
  const data = await devcodes.get('/slow-endpoint', {
    timeout: 5000 // 5 seconds
  });
} catch (error) {
  if (error.code === 'ECONNABORTED') {
    console.log('Request timed out');
  }
}

Custom Status Validation

const response = await devcodes.get('/api/data', {
  validateStatus: (status) => status < 500 // Accept anything below 500
});

Query Parameters

const response = await devcodes.get('/api/users', {
  params: {
    page: 1,
    limit: 10,
    sort: 'name'
  }
});
// URL becomes: /api/users?page=1&limit=10&sort=name

Request with Auth

const response = await devcodes.get('/api/data', {
  auth: {
    username: 'user',
    password: 'pass'
  }
});

CORS with Credentials

const response = await devcodes.get('/api/data', {
  withCredentials: true
});

🎯 Why DevCodes over Axios?

| Feature | DevCodes | Axios | |---------|----------|-------| | Performance | ✅ Optimized | ⚠️ Heavier | | TypeScript | ✅ First-class | ⚠️ Basic | | Bundle Size | ✅ Minimal | ⚠️ Larger | | Modern API | ✅ Yes | ⚠️ Legacy | | Fetch API | ✅ Native | ⚠️ XMLHttpRequest | | Setup Time | ✅ Fast | ⚠️ Slower |

🐛 Error Handling

try {
  const data = await devcodes.get('/api/data');
} catch (error) {
  if (error.isDevCodesError) {
    console.log('Code:', error.code);
    console.log('Status:', error.response?.status);
    console.log('Message:', error.message);
  }
}

📄 License

MIT

🤝 Contributing

Contributions welcome! Please submit pull requests or issues on GitHub.

💬 Support

Join our Discord for help and updates: discord.gg/ESh2Dp2xX9


Built with ❤️ by the DevCodes team