Skip to main content

Packages

This repo publishes two npm packages. The client never depends on codegen.

PackagenpmRole
packages/clientfrappe-js-clientREST client
packages/codegenfrappe-codegenCLI + library that emits typed DocType interfaces

Node 20+. Optional peer on the client: socket.io-client ^4, only for frappe-js-client/realtime.

frappe-js-client

Zero runtime dependencies.

Subpath exports

SubpathWhat you import
.createFrappeClient, tokenAuth / cookieAuth / oauthAuth / bearerAuth / anonymousAuth, consoleLogger, formatFrappeDate / formatFrappeDatetime, all error classes, core types, module types for auth / db / file / call / search
./extendedwithExtended, ExtendedFrappeClient, types for permission / workflow / report / desk / site
./errorsSame error taxonomy as the root (FrappeError, AuthenticationError, …)
./middlewarecomposeMiddleware, retry, timing, redactHeaders, redactBody
./typesType-only barrel (FrappeDoc, FrappeInsert, Link, module interfaces). Codegen output imports this.
./testingcreateTestClient, createExtendedTestClient, MemoryTransport, fixtures
./realtimecreateRealtime and realtime types

There is no logging() middleware. Logging is logger: consoleLogger() on the client.

There is no customAuth() factory. Implement AuthStrategy yourself.

There is no unsafeTransport() helper. Pass a Transport as createFrappeClient({ transport }).

ESM and CJS are both published (import / require). Types resolve via exports.

Guides

frappe-codegen

Depends on frappe-js-client. Requires Frappe v15+ (apiVersion: 2) because meta is GET /api/v2/doctype/{doctype}/meta.

  • Binary: frappe-codegen
  • Programmatic: import { generateModule, resolveDocTypes, … } from 'frappe-codegen'
  • One export map (.); the CLI is not a library export

Full guide: Codegen. Generated API: Codegen API in the sidebar.