django-react-api-client
v0.1.0
Published
TypeScript-first, CSRF-aware API client for React / Next.js apps talking to Django REST Framework backends.
Maintainers
Readme
django-react-api-client
TypeScript-first, CSRF-aware, developer-friendly API client for React / Next.js applications talking to Django REST Framework back-ends.
npm install django-react-api-clientimport { ApiClient } from "django-react-api-client";
const api = new ApiClient({
baseURL: "/api/",
withCredentials: true, // session cookie auth
});
// inside React component / hook
const orders = await api.get<Order[]>("orders/");See examples/usage.tsx for a full integration example.
Features
• Centralised config (baseURL, timeout, headers).
• Automatic CSRF token retrieval (/api/csrf/ or cookie).
• Safe get<T>, post<T,D> … helpers with full TypeScript inference.
• Pluggable interceptors and unified ApiError.
• Works with session (cookie + CSRF) and JWT/Bearer auth.
