Skip to main content

Duck Query

Typed Axios client. Pair it with a Duck Gen route map or supply your own. Bodies, params, queries, and responses are all typed.

7 methods

Axios calls checked by your compiler

Feed in the route map from Duck Gen or one you define by hand. Every `.get`, `.post`, and `.patch` is typed end to end: params, body, query, response.

get

Typed GET with inferred response type, typed path params, and typed query strings.

post

Typed POST body and response. Compile fails if the body shape drifts from the route map.

put

Full-replacement updates with a typed body and response. Reads route metadata from Duck Gen.

patch

Partial updates typed against your DTOs. No hand-written interface duplication.

del

Typed DELETE with typed params and response. Handles 204 No Content correctly.

byMethod

Escape hatch for any HTTP verb. Full type inference over a route-map entry.

request

Raw axios request with route-map config pre-filled. All options stay typed.

Install

Install the peer, import the factory, start calling endpoints.

# Install
bun add @gentleduck/query axios

# Create a typed client
import { createDuckQueryClient } from '@gentleduck/query'
import type { Routes } from './generated'

export const api = createDuckQueryClient<Routes>({ baseURL: '/api' })

Free & open source

gentleduck is MIT licensed and will always be free and open source. Every package ships with full source access — fork it, modify it, own it.

Become a Sponsor