WordPress REST API Client for TypeScript
Platform-agnostic TypeScript client for the WordPress REST API — works in Node.js, browsers, and React Native.
Install
pnpm add @atomic-solutions/wordpress-utils Fetch posts without React
import { createClient } from '@atomic-solutions/wordpress-utils'
const client = createClient({
baseURL: 'https://your-site.com/wp-json',
})
const { data: posts } = await client.posts.list({ per_page: 10 })
// posts is typed: WPPost[] What's included
- Typed methods for posts, pages, categories, tags, users, media, comments
- Zod schemas for all response shapes — runtime-validated, not just TypeScript types
- JWT authentication support (login, token refresh, header injection)
- Works in Node.js, browsers, React Native, and Expo — no
fetchpolyfill needed in modern environments - 112+ tests
Use this if you need the raw client
If you're in a React app, consider @atomic-solutions/react-wordpress instead — it wraps this client with React Query hooks so you get caching and refetching for free.
Need help shipping this in production?
Atomic Solutions builds headless WordPress storefronts for clients. Get in touch →