Skip to content

Installation

Terminal window
npm install @oofp/core
# or
pnpm add @oofp/core
# or
yarn add @oofp/core

Install additional packages as needed:

Terminal window
# Functional HTTP client
pnpm add @oofp/http
# Query cache
pnpm add @oofp/query
# Saga pattern
pnpm add @oofp/saga
# React hooks (experimental)
pnpm add @oofp/react
  • TypeScript 5.0 or higher
  • Node.js 18 or higher (for ESM support)
  • "strict": true in your tsconfig.json is recommended

OOFP uses sub-path exports for tree-shaking. Always import from specific modules:

// Correct — tree-shakeable
import * as M from "@oofp/core/maybe";
import * as E from "@oofp/core/either";
import * as TE from "@oofp/core/task-either";
import * as RTE from "@oofp/core/reader-task-either";
import { pipe } from "@oofp/core/pipe";
import { flow } from "@oofp/core/flow";

The convention is to use short namespace aliases:

ModuleAlias
maybeM
eitherE
taskT
task-eitherTE
readerR
reader-task-eitherRTE
ioIO
stateS
listL
objectO
stringStr