API calls typed from your routes
A typed Axios client. Feed it a Duck Gen route map or your own, and bodies, params, queries, and responses are all typed.
get
Typed GET requests with an inferred response, typed path params, and typed query strings.
post
Typed POST body and response. The build fails if the body drifts from the route map.
put and patch
Full and partial updates, typed against your DTOs. No hand-written interfaces to keep in sync.
del
Typed DELETE with typed params and response. Handles
204 No Contentcorrectly.byMethod
An escape hatch for any HTTP verb, with full type inference over a route-map entry.
request
A raw Axios request with the route-map config filled in. Every option stays typed.
Install
Install it with Axios, create a client, and start calling endpoints.
Install
bun add @gentleduck/query axiosCreate 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.