New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@adi-family/http

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adi-family/http

Framework-agnostic, type-safe HTTP interface system

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

@adi-family/http

Framework-agnostic, type-safe HTTP interface system that separates API contracts from implementation, enabling end-to-end type safety between client and server.

Installation

npm install @adi-family/http zod
# or
bun add @adi-family/http zod

Quick Start

1. Define API Contract

import { z } from 'zod'
import { route } from '@adi-family/http'
import type { HandlerConfig } from '@adi-family/http'

export const getUserConfig = {
  method: 'GET',
  route: route.pattern('/api/users/:id', z.object({ id: z.string() })),
  response: {
    schema: z.object({
      id: z.string(),
      name: z.string(),
      email: z.string().email()
    })
  }
} as const satisfies HandlerConfig

2. Create Server Handler

import { handler } from '@adi-family/http'
import { getUserConfig } from './contracts'

export const getUserHandler = handler(getUserConfig, async (ctx) => {
  const user = await db.users.findById(ctx.params.id)
  return user
})

3. Use in Client

import { BaseClient } from '@adi-family/http'
import { getUserConfig } from './contracts'

const client = new BaseClient({
  baseUrl: 'http://localhost:3000'
})

// Fully type-safe!
const user = await client.run(getUserConfig, {
  params: { id: '123' }
})

Features

  • Framework Agnostic - Works with Express, Hono, Fastify, or any HTTP framework
  • Type Safety - Full TypeScript inference from config to client
  • Config-Based Contracts - API definitions are pure configuration objects
  • Validation - Body and query validated with Zod schemas
  • No Param Validation - URL params used only for building paths
  • Separation of Concerns - Contracts live separately from server handlers

Documentation

For complete documentation, examples, and guides, visit: https://github.com/adi-family/http

Framework Adapters

License

MIT - See LICENSE file for details

Copyright (c) 2025 ADI Family (https://github.com/adi-family)

Keywords

http

FAQs

Package last updated on 09 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts