OCaml Library Collection
/

A curated collection of OCaml libraries for building modern applications. This monorepo contains 40+ packages covering web protocols, data formats, API clients, and developer utilities—all built on OCaml 5's structured concurrency with Eio.

Package Categories

Data Encoding & Serialization

Type-safe codecs for common data formats using the Jsont combinator pattern.

  • cbort — Native CBOR (RFC 8949) codec with arbitrary precision integers
  • jsonwt — JSON Web Tokens (RFC 7519) and CBOR Web Tokens with HMAC, ECDSA, and EdDSA signatures
  • json-pointerRFC 6901 JSON Pointer parsing, evaluation, and mutation
  • tomlt — TOML 1.1 codec with streaming I/O support
  • yamlt — YAML codec built on Jsont for unified JSON/YAML handling
  • yamlrw — Pure OCaml YAML 1.2 parser and emitter
  • cff — Citation File Format (CFF 1.2.0) for academic software citation
  • init — INI file codec with Python configparser semantics

Web & Network

Production-quality HTTP client and networking primitives.

  • requests — Modern HTTP(S) client inspired by Python's requests: automatic TLS, connection pooling, authentication (Basic/Bearer/Digest), cookies, retries, and proxy support
  • cookeio — HTTP cookie parsing and jar management
  • conpool — Protocol-agnostic TCP/IP connection pooling for Eio
  • mqtte — MQTT v3.1.1 and v5.0 protocol implementation

AT Protocol & Decentralized Social

A complete OCaml implementation of the AT Protocol for building decentralized social applications.

  • atp — Core IPLD primitives: CIDs, DAG-CBOR, Merkle Search Trees, CAR format
  • atp-xrpc — XRPC client for Personal Data Servers with JWT session management
  • xrpc-auth — CLI authentication helpers with credential persistence
  • hermest — Lexicon code generator: JSON schemas to OCaml types
  • bsky — Bluesky client library and CLI
  • tangled — Tangled decentralized git collaboration client
  • standard-site — AT Protocol blog/publication client

Service API Clients

Ready-to-use clients for popular services.

  • zulip — Zulip chat REST API with fiber-based bot framework
  • karakeep — Karakeep bookmark service API
  • peertube — PeerTube video platform API with CLI
  • owntracks — OwnTracks location tracking via MQTT

Text & HTML Processing

Pure OCaml implementations without C dependencies.

  • html5rw — Complete WHATWG HTML5 parser with CSS selectors, passing html5lib-tests
  • langdetect — Language detection for 47 languages using n-gram analysis

Domain & URL Utilities

  • punycodeRFC 3492 Punycode and IDNA for internationalized domain names
  • publicsuffix — Mozilla Public Suffix List for domain parsing
  • crockford — Crockford Base32 encoding with checksums

System & Configuration

  • xdge — XDG Base Directory paths for Eio applications
  • bytesrw-eio — Bytesrw streaming adapters for Eio flows

Documentation Tools

  • odoc-xo — Transform odoc HTML to use x-ocaml web components
  • claude — OCaml client for Claude Code CLI

Design Principles

Eio-first concurrency. All I/O-bound libraries use OCaml 5's Eio for structured concurrency with effect handlers—no callbacks, no monads for control flow.

Type-safe codecs. Data format libraries follow the Jsont pattern: define types once, get encoding and decoding with compile-time guarantees.

Pure OCaml. Core parsers (HTML5, YAML, CBOR) are implemented in pure OCaml for portability, including compilation to JavaScript and WebAssembly.

Multi-backend I/O. Many packages offer sublibraries for different I/O contexts:

tomlt.eio

,

yamlrw.unix

,

cff.eio

, etc.

Getting Started

Installation

Individual packages are available on opam:

opam install requests cbort jsonwt

Quick Example

A simple HTTP request with automatic JSON decoding:

open Requests

let () =
  Eio_main.run @@ fun env ->
  let response = get env "https://api.example.com/data" in
  match Response.json response with
  | Ok json -> Format.printf "%a@." Yojson.Safe.pp json
  | Error e -> Format.eprintf "Error: %s@." e

Repository Structure

This documentation is generated from a monopam-managed monorepo. Each package lives in its own subdirectory as a git subtree, enabling unified development while maintaining independent upstream repositories.

workspace/
  ocaml-requests/     # HTTP client
  ocaml-cbort/        # CBOR codec
  ocaml-atp/          # AT Protocol (11 packages)
  ocaml-yamlrw/       # YAML parser
  ...

Contributing

Development Workflow

# Build everything
opam exec -- dune build

# Run tests
opam exec -- dune test

# Build documentation
opam exec -- dune build @doc

Submitting Changes

Changes made in this monorepo must be exported to upstream repositories:

# Check which repos have uncommitted changes
monopam status

# Export commits to individual checkouts
monopam push

# Review and push each upstream
cd ../src/<repo-name>
git log --oneline -5
git push origin main

Pulling Updates

# Fetch latest from all upstreams
monopam pull

License

Most packages are released under the ISC license. See individual package documentation for specific terms.