request-kit-clientv0.7.5

Request Kit Client

A powerful, TypeScript-first API client SDK for authentication, user profile management, and custom HTTP services — built with Axios and clean developer ergonomics.

View on NPM
MIT License
24.1 kB Unpacked
0 Dependencies

Quick Installation

Get up and running in seconds

Terminal
npm i request-kit-client

Powerful Features

Everything you need for modern API client development

Plug-and-play API client
Ready to use out of the box with minimal configuration
Token Injection
Automatic token management via Axios interceptors
Modular services
Organized auth, user, and custom service modules
Auto Content-Type
Intelligent handling for JSON and FormData
Centralized error normalization
Consistent error handling across all API calls
Optional response caching
Built-in caching for improved performance
Dynamic custom service creation
Create custom services on the fly
Full TypeScript support
Complete type safety and IntelliSense support
Custom route overrides
Flexible routing configuration
Composable and extendable
Works with any API architecture
Unauthorized handler support
Built-in onUnauthorized callback handling
SSR & Public/Private API compatibility
Works seamlessly in all environments

Ideal for Frontend Apps

Perfect for any frontend application that needs:

Modular API services

Organized auth, user, and custom services

Token injection

Automatic authentication handling

Type-safe requests

Full TypeScript support and validation

Error normalization

Consistent error handling patterns

Simple to Use

Clean, intuitive API design

Basic Usage
import { RequestKitClient } from 'request-kit-client';

const client = new RequestKitClient({
  baseURL: 'https://api.example.com',
  token: 'your-auth-token'
});

// Use modular services
const user = await client.user.getProfile();
const posts = await client.custom.get('/posts');

Advanced Usage

Explore more powerful features

Authentication Setup
// Initialize with auth
const client = new RequestKitClient({
  baseURL: 'https://api.example.com',
  onUnauthorized: () => {
    // Handle token refresh
    window.location.href = '/login'
  }
})

// Set token dynamically
client.setToken('new-jwt-token')
Custom Services
// Create custom service
const blogService = client.createService('blog', {
  getPosts: () => client.get('/posts'),
  createPost: (data) => client.post('/posts', data),
  updatePost: (id, data) => client.put(`/posts/${id}`, data)
})

// Use custom service
const posts = await blogService.getPosts()

Ready to Get Started?

Join developers who are building better APIs with request-kit-client

npm
npm i request-kit-client
yarn
yarn add request-kit-client
pnpm
pnpm add request-kit-client