# frappe-js-client

> Zero-dependency, fetch-native TypeScript/JavaScript client for Frappe Framework REST APIs (v14, v15, v16).

Latest version **3.4.0** (published 2026-09-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install frappe-js-client
pnpm add frappe-js-client
yarn add frappe-js-client
bun add frappe-js-client
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 3.4.0 |
| Published | 2026-09-12 |
| First published | 2025-03-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=20 |
| Dependencies | 0 |
| Unpacked size | 946.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Dhia A. Shalabi <dhia.shalabi@gmail.com> |
| Maintainers | dhiashalabi |
| Keywords | frappe, frappe-framework, erpnext, fetch, typescript, rest, sdk, api-client, zero-dependency |

## Links

- npm: https://www.npmjs.com/package/frappe-js-client
- Repository: https://github.com/dhiashalabi/frappe-js-client
- Homepage: https://dhiashalabi.github.io/frappe-js-client/
- Issues: https://github.com/dhiashalabi/frappe-js-client/issues
- npm.io page: https://npm.io/package/frappe-js-client

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 3.4.0 (latest) — 2026-09-12
- 3.3.0 — 2026-09-11
- 3.1.0 — 2026-09-03
- 3.0.0 — 2026-08-31
- 2.4.0 — 2026-08-29
- 2.3.7 — 2025-06-20
- 2.1.3 — 2025-03-15
- 2.1.2 — 2025-03-15
- 2.0.0 — 2025-03-15
- 1.6.1 — 2025-03-13
- 1.6.0 — 2025-03-13
- 1.5.0 — 2025-03-13

## README

# Frappe JS Client

[![npm version](https://badge.fury.io/js/frappe-js-client.svg)](https://badge.fury.io/js/frappe-js-client)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
[![docs](https://img.shields.io/badge/docs-dhiashalabi.github.io-blue)](https://dhiashalabi.github.io/frappe-js-client/)

Zero-dependency TypeScript/JavaScript client for [Frappe Framework](https://frappeframework.com) REST APIs. Uses `globalThis.fetch`.

Supports **Frappe v14, v15, and v16**. Default `apiVersion` is **`2`** (`/api/v2`, Frappe 15+). Pass `{ apiVersion: 1 }` for classic `/api/method` + `/api/resource` — that is the v14-safe path, and it also works on v15 and v16.

Realtime is optional: `frappe-js-client/realtime` with peer `socket.io-client`. Core stays zero-dependency.

**Docs:** [dhiashalabi.github.io/frappe-js-client](https://dhiashalabi.github.io/frappe-js-client/)

## Installation

```bash
pnpm add frappe-js-client
# or
npm install frappe-js-client
```

No runtime dependencies.

## Quick start

```typescript
import { createFrappeClient, tokenAuth, consoleLogger } from 'frappe-js-client'

const frappe = createFrappeClient({
    url: 'https://frappe.example.com',
    auth: tokenAuth({ apiKey: '...', apiSecret: '...' }),
    logger: consoleLogger(), // optional; pathname only, no query/headers/bodies
})

const user = await frappe.db.getDoc('User', 'Administrator')
```

Session login (classic `/api/method/login`):

```typescript
await frappe.auth.login({
    username: 'admin',
    password: 'password',
})
```

Extended modules (`permission`, `workflow`, `report`, `desk`, `site`):

```typescript
import { withExtended } from 'frappe-js-client/extended'

const app = withExtended(frappe)
await app.workflow.apply(doc, 'Approve')
```

Realtime (optional peer `socket.io-client`):

```typescript
import { createRealtime } from 'frappe-js-client/realtime'

const realtime = createRealtime(app)
realtime.subscribeDoc('ToDo', 'TD-1', (event) => console.log(event))
```

Full guides: [documentation](https://dhiashalabi.github.io/frappe-js-client/docs/getting-started). API reference: [Client API](https://dhiashalabi.github.io/frappe-js-client/docs/api) · [Codegen](https://dhiashalabi.github.io/frappe-js-client/docs/codegen).

## Development

Requires [pnpm](https://pnpm.io) 11 and Node.js **20+** (CI uses Node 22).

This package lives in a pnpm workspace. Clone the repo root, not `packages/client` alone:

```bash
git clone https://github.com/dhiashalabi/frappe-js-client.git
cd frappe-js-client
pnpm install
pnpm test
pnpm lint
pnpm build
pnpm docs:start
```

Unit tests: `pnpm test`. Integration and browser tests require a separately managed Frappe site:

```bash
FRAPPE_TEST_URL=http://frappe14.localhost:8000 pnpm test:integration
FRAPPE_TEST_URL=http://frappe14.localhost:8000 pnpm test:browser
```

Live tests need a running site. Do not commit credentials (`.env` / `.env.live` are gitignored):

```bash
FRAPPE_LIVE_URL=http://127.0.0.1:8001 pnpm test:live
```

If the URL host is not the Frappe site name (for example `127.0.0.1` vs `frappe16.localhost`), pass `siteName` into `createFrappeClient` so requests send `Host` / `X-Frappe-Site-Name`.

## License

MIT. See [LICENSE](LICENSE).

## Support

- [Issues](https://github.com/dhiashalabi/frappe-js-client/issues)
- [Discussions](https://github.com/dhiashalabi/frappe-js-client/discussions)

---
_Source: https://npm.io/package/frappe-js-client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
