onrails logoonrails

Introduction

Welcome to onrails, the railway-oriented programming toolkit for TypeScript.

Welcome to the onrails documentation.

onrails is a lightweight, pure TypeScript library providing algebraic primitives like Result (Ok/Err), ResultAsync, and Maybe (Some/None) along with pattern matching via @onrails/pattern.

Key Goals

  • Tame Expected Failure: Make fallible boundaries clean and inspectable.
  • No Throws: Avoid throwing exceptions for normal control paths.
  • Compile-Time Safety: Strict type inference and exhaustive matching.

Explore

On this page