{"id":51132690,"url":"https://github.com/igorjs/pure-fx","last_synced_at":"2026-06-25T14:30:34.155Z","repository":{"id":344393597,"uuid":"1181584442","full_name":"igorjs/pure-fx","owner":"igorjs","description":"Functional application framework for TypeScript. Zero dependencies. Errors as values. Immutability at runtime.","archived":false,"fork":false,"pushed_at":"2026-06-18T05:35:48.000Z","size":2104,"stargazers_count":6,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-18T07:25:31.909Z","etag":null,"topics":["framework","functional-programming","typescript","zero-dependencies"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/igorjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING-RULES.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":"NOTICE","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["igorjs"]}},"created_at":"2026-03-14T10:46:02.000Z","updated_at":"2026-06-18T05:35:49.000Z","dependencies_parsed_at":"2026-05-01T00:04:11.679Z","dependency_job_id":null,"html_url":"https://github.com/igorjs/pure-fx","commit_stats":null,"previous_names":["igorjs/pure-ts","igorjs/pure-fx"],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/igorjs/pure-fx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igorjs%2Fpure-fx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igorjs%2Fpure-fx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igorjs%2Fpure-fx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igorjs%2Fpure-fx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/igorjs","download_url":"https://codeload.github.com/igorjs/pure-fx/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igorjs%2Fpure-fx/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34780124,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-25T02:00:05.521Z","response_time":101,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["framework","functional-programming","typescript","zero-dependencies"],"created_at":"2026-06-25T14:30:33.027Z","updated_at":"2026-06-25T14:30:34.143Z","avatar_url":"https://github.com/igorjs.png","language":"TypeScript","funding_links":["https://github.com/sponsors/igorjs"],"categories":[],"sub_categories":[],"readme":"# Pure FX\n\n[![CI](https://github.com/igorjs/pure-fx/actions/workflows/ci.yml/badge.svg)](https://github.com/igorjs/pure-fx/actions/workflows/ci.yml)\n[![npm](https://img.shields.io/npm/v/@igorjs/pure-fx?color=blue)](https://www.npmjs.com/package/@igorjs/pure-fx)\n[![npm downloads](https://img.shields.io/npm/dm/@igorjs/pure-fx)](https://www.npmjs.com/package/@igorjs/pure-fx)\n[![JSR](https://jsr.io/badges/@igorjs/pure-fx)](https://jsr.io/@igorjs/pure-fx)\n[![License](https://img.shields.io/npm/l/@igorjs/pure-fx)](https://github.com/igorjs/pure-fx/blob/main/LICENSE)\n[![Zero Dependencies](https://img.shields.io/badge/dependencies-0-brightgreen)]()\n\nFunctional application framework for TypeScript. Zero dependencies.\n\n\u003e **Note:** This project is in beta. APIs may change between minor versions until 1.0.\n\nErrors are values, not exceptions. Data is immutable, enforced at runtime. Async is lazy and composable.\n\nRuns on Node.js 22+, Deno 2+, Bun, Cloudflare Workers, and Chromium.\n\n## Install\n\n```bash\nnpm install @igorjs/pure-fx\n```\n\nAlso available on [JSR](https://jsr.io/@igorjs/pure-fx):\n\n```bash\nnpx jsr add @igorjs/pure-fx\n```\n\n## Quick Example\n\n```ts\nimport { Ok, Err, pipe, Task, Schema, File, Valid, Invalid } from '@igorjs/pure-fx'\n\n// Errors as values, not exceptions\nconst parse = (s: string) =\u003e {\n  const n = Number(s);\n  return Number.isNaN(n) ? Err('not a number') : Ok(n);\n};\n\npipe(parse('42'), r =\u003e r.map(n =\u003e n * 2)); // Ok(84)\n\n// Lazy async with Result\nconst data = await Task.fromPromise(() =\u003e fetch('/api'), String)\n  .map(r =\u003e r.json())\n  .timeout(5000, () =\u003e 'timed out')\n  .run(); // Result\u003cunknown, string\u003e\n\n// Validate unknown input\nconst User = Schema.object({ name: Schema.string, age: Schema.number });\nUser.parse(untrustedData); // Result\u003c{ name: string; age: number }, SchemaError\u003e\n\n// Accumulate ALL validation errors (not just the first)\nconst validateName = (s: string) =\u003e s ? Valid(s) : Invalid('name required');\nconst validateAge = (n: number) =\u003e n \u003e 0 ? Valid(n) : Invalid('must be positive');\nvalidateName('').zip(validateAge(-1)); // Invalid(['name required', 'must be positive'])\n\n// Read a file (works on Node, Deno, Bun)\nconst content = await File.read('./config.json').run();\n```\n\n## Modules\n\n| Layer | Primitives | Docs |\n|-------|------------|------|\n| **Core** | `Result`, `Option`, `Validation`, `pipe`, `flow`, `Match`, `Eq`, `Ord`, `State`, `Lens`, `Prism`, `Iso`, `Traversal`, `LensOptional` | [docs/core.md](docs/core.md) |\n| **Data** | `Record`, `List`, `NonEmptyList`, `HashMap`, `Immutable`, `Schema`, `Codec`, `ADT`, `StableVec` | [docs/data.md](docs/data.md) |\n| **Types** | `TypeDef` (+ `Str`, `Num`, `Int`, `UInt`, `Bool`, `Bytes`, `Nil`, `DateTime`, `Vec`, `Pair`, `Tuple`, `Dict`, `Struct`, `ListOf`, `MapOf`, `Maybe`, `Either`), `ErrType`, `Type`, `Duration`, `Cron` | [docs/types.md](docs/types.md) |\n| **Async** | `Task`, `Stream`, `Lazy`, `Env`, `Timer`, `Retry`, `CircuitBreaker`, `Semaphore`, `Mutex`, `RateLimiter`, `Cache`, `Channel`, `StateMachine`, `EventEmitter`, `Pool`, `Queue`, `CronRunner` | [docs/async.md](docs/async.md) |\n| **IO** | `File`, `Command`, `Json`, `Crypto`, `Encoding`, `Compression`, `Clone`, `Url`, `Client`, `Terminal`, `WebSocket`, `Dns`, `Net`, `FFI` | [docs/io.md](docs/io.md) |\n| **Runtime** | `Server`, `Program`, `Logger`, `Config`, `Os`, `Process`, `Path`, `Eol`, `Platform` | [docs/runtime.md](docs/runtime.md) |\n\n[Full documentation with examples](docs/index.md)\n\n## Runtime Compatibility\n\nMost modules are pure TypeScript and work everywhere. Runtime-dependent modules adapt automatically:\n\n| Module | Node 22+ | Node 25+ | Deno 2+ | Bun | Workers | Browser |\n|--------|----------|----------|---------|-----|---------|---------|\n| Core, Data, Async, Types | Yes | Yes | Yes | Yes | Yes | Yes |\n| `Crypto` (full Web Crypto) | Yes | Yes | Yes | Yes | Yes | Yes |\n| `Compression` | Yes | Yes | Yes | Yes | Partial | Partial |\n| `File`, `Command`, `Terminal` | Yes | Yes | Yes | Yes | No | No |\n| `Process`, `Os`, `Path` | Yes | Yes | Yes | Yes | No | No |\n| `Dns`, `Net` | Yes | Yes | Yes | Yes | No | No |\n| `FFI` | No | Yes (`--allow-ffi`) | Yes (`--allow-ffi`) | Yes | No | No |\n| `Server` | Yes | Yes | Yes | Yes | Yes (adapter) | No |\n\n## Troubleshooting\n\n### Compression hangs on older Deno versions\n\nPure FX uses `Blob.stream().pipeThrough()` for compression, which requires Deno 1.38+. If compression operations hang, update Deno.\n\n### FFI not available\n\nFFI requires native library loading capabilities:\n- **Deno**: Run with `--allow-ffi`\n- **Bun**: Works out of the box\n- **Node 25+**: Run with `--allow-ffi` (experimental)\n- **Node 22-24**: Not available. `FFI.open()` returns `Err(FFIError(\"...\"))`. Use `FFI.isAvailable()` to check.\n\n### Os/Process return None for some values\n\nSome OS APIs are permission-gated on Deno (e.g. `hostname`, `env`). Run with `--allow-sys` and `--allow-env`, or use `deno run --allow-all`.\n\nOn Windows, `Process.uid()` and `Process.gid()` return `None` (POSIX-only APIs).\n\n### File operations return Err\n\nAll file operations return `Result` or `Task` instead of throwing. Check the error:\n\n```ts\nconst result = await File.read('./missing.txt').run();\nif (result.isErr) {\n  console.log(result.error.tag);     // \"FileError\"\n  console.log(result.error.message); // \"ENOENT: no such file...\"\n}\n```\n\n### Deno requires version 2.0+\n\nPure FX uses Deno 2.0+ APIs. Deno 1.x is not supported. Compression requires Deno 1.38+ for `CompressionStream`, but all other modules require Deno 2.0+.\n\n### Modules return Err in Workers/Browser\n\nRuntime-dependent modules (`File`, `Command`, `Process`, etc.) gracefully return `Err` or `None` in environments that don't support them. They never throw.\n\n## Subpath Imports\n\n```ts\n// Import everything\nimport { Ok, Task, Schema } from '@igorjs/pure-fx'\n\n// Or import specific modules for smaller bundles\nimport { Ok, Err, pipe } from '@igorjs/pure-fx/core'\nimport { Schema, HashMap } from '@igorjs/pure-fx/data'\nimport { Task, Stream } from '@igorjs/pure-fx/async'\nimport { File, Command, FFI } from '@igorjs/pure-fx/io'\n```\n\n## How It Compares\n\n| | Pure FX | Effect | fp-ts / Effect-ts |\n|---|---------|--------|-------------------|\n| **Philosophy** | Thin, opt-in primitives | Comprehensive runtime with fibers, layers, services | Category-theory encodings (HKT, typeclasses) |\n| **Dependencies** | Zero | ~10 internal packages | Several (`fp-ts` ecosystem) |\n| **Learning curve** | Familiar JS idioms (`Result`, `Option`, `pipe`) | Steep: generators, layers, services, scopes | Steep: HKT, Kind, typeclass instances |\n| **Bundle size** | Small, tree-shakeable subpaths | Large (full runtime) | Medium |\n| **Error handling** | `Result\u003cT, E\u003e` and `Task\u003cT, E\u003e` | Typed errors via `Effect\u003cA, E, R\u003e` | `Either\u003cE, A\u003e`, `TaskEither` |\n| **Async** | `Task` (lazy Promise wrapper) | Fiber-based with structured concurrency | `TaskEither`, `ReaderTaskEither` |\n| **Runtime support** | Node, Deno, Bun, Workers, Browser | Node (primary), limited Deno/Bun | Node (primary) |\n| **IO** | Built-in File, Command, Server, Crypto, FFI | Via services and layers | BYO (no IO primitives) |\n\n**Choose Pure FX when** you want typed errors and immutable data without adopting a framework. It adds `Result`, `Task`, `Schema`, and IO adapters on top of plain TypeScript: no generators, no layers, no HKT. If your code already uses `pipe` and explicit error returns, Pure FX fits in without reshaping your architecture.\n\n**Choose Effect when** you need structured concurrency, dependency injection via layers, or a full application runtime with fibers, scopes, and managed services.\n\n**Choose fp-ts when** you want strict category-theory abstractions and are comfortable with HKT-based typeclass hierarchies.\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, coding standards, and how to submit changes.\n\n## Disclaimer\n\nTHIS SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n## License\n\n[Apache-2.0](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figorjs%2Fpure-fx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Figorjs%2Fpure-fx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figorjs%2Fpure-fx/lists"}