# janestreet/core architecture

> Architecture diagram of the GitHub repository janestreet/core, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/janestreet/core
- Repository: https://github.com/janestreet/core

## Overview

Jane Street Core is a foundational OCaml library, not an end-user application. Its principal use is for OCaml programs to call reusable APIs for collections, serialization, time, errors, and system-level utilities. The tree also contains separate validation, filename, command-line, and heap-block packages. The README is empty and most OCaml implementations were not excerpted, so the graph groups those APIs by documented-in-tree module names and limits call relationships to the sampled runtime and C code.

Main entry points: [`core/src/bigstring_stubs.c`](https://github.com/janestreet/core/blob/master/core/src/bigstring_stubs.c) (Bigstring), [`core/src/timezone_js_loader_stubs.js`](https://github.com/janestreet/core/blob/master/core/src/timezone_js_loader_stubs.js) (Timezone JS bindings), [`core/src/runtime.js`](https://github.com/janestreet/core/blob/master/core/src/runtime.js) (JS runtime bindings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core_api["Core APIs"]
  node_collections["Collections"]
  node_serialization["Serialization"]
  node_errors_validation["Errors and validation"]
  node_strings_numbers["Strings and numbers"]
  node_system_utils["System utilities"]
end

subgraph group_time["Time and formatting"]
  node_time_types["Time types"]
  node_timezone["Timezone support"]
  node_strftime["Date formatting<br/>[strftime.js]"]
end

subgraph group_runtime["Runtime support"]
  node_bigstring["Bigstring<br/>[bigstring_stubs.c]"]
  node_runtime_bindings["JS runtime bindings<br/>[runtime.js]"]
  node_gc_bindings["GC bindings<br/>[gc_stubs.c]"]
  node_md5["MD5<br/>[md5_stubs.c]"]
  node_timezone_js["Timezone JS bindings"]
end

subgraph group_packages["Related packages"]
  node_filename["Filename utilities"]
  node_validate["Validation package"]
  node_command["Command-line package"]
  node_heap_block["Heap-block utilities<br/>[heap_block_stubs.c]"]
end

node_consumer(("OCaml programs"))
node_temporal["Temporal API"]

node_bigstring -->|"has JS support"| node_runtime_bindings
node_bigstring -->|"uses declarations"| node_bigstring
node_timezone_js -->|"uses API"| node_temporal

click node_collections "https://github.com/janestreet/core/tree/master/core/src"
click node_serialization "https://github.com/janestreet/core/tree/master/core/src"
click node_errors_validation "https://github.com/janestreet/core/tree/master/core/src"
click node_strings_numbers "https://github.com/janestreet/core/tree/master/core/src"
click node_system_utils "https://github.com/janestreet/core/tree/master/core/src"
click node_time_types "https://github.com/janestreet/core/tree/master/core/src"
click node_timezone "https://github.com/janestreet/core/tree/master/core/src"
click node_strftime "https://github.com/janestreet/core/blob/master/core/src/strftime.js"
click node_bigstring "https://github.com/janestreet/core/blob/master/core/src/bigstring_stubs.c"
click node_runtime_bindings "https://github.com/janestreet/core/blob/master/core/src/runtime.js"
click node_gc_bindings "https://github.com/janestreet/core/blob/master/core/src/gc_stubs.c"
click node_md5 "https://github.com/janestreet/core/blob/master/core/src/md5_stubs.c"
click node_timezone_js "https://github.com/janestreet/core/blob/master/core/src/timezone_js_loader_stubs.js"
click node_filename "https://github.com/janestreet/core/tree/master/filename_base/src"
click node_validate "https://github.com/janestreet/core/tree/master/validate/src"
click node_command "https://github.com/janestreet/core/tree/master/command/src"
click node_heap_block "https://github.com/janestreet/core/blob/master/heap_block/heap_block_stubs.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_collections,node_serialization,node_errors_validation,node_strings_numbers,node_system_utils toneBlue
class node_time_types,node_timezone,node_strftime toneAmber
class node_bigstring,node_runtime_bindings,node_gc_bindings,node_md5,node_timezone_js,node_temporal toneMint
class node_filename,node_validate,node_command,node_heap_block toneRose
class node_consumer toneIndigo
```

## Components

### Core APIs

- [Collections](https://github.com/janestreet/core/tree/master/core/src): `core/src`
- [Serialization](https://github.com/janestreet/core/tree/master/core/src): `core/src`
- [Errors and validation](https://github.com/janestreet/core/tree/master/core/src): `core/src`
- [Strings and numbers](https://github.com/janestreet/core/tree/master/core/src): `core/src`
- [System utilities](https://github.com/janestreet/core/tree/master/core/src): `core/src`

### Time and formatting

- [Time types](https://github.com/janestreet/core/tree/master/core/src): `core/src`
- [Timezone support](https://github.com/janestreet/core/tree/master/core/src): `core/src`
- [Date formatting](https://github.com/janestreet/core/blob/master/core/src/strftime.js): `core/src/strftime.js`

### Runtime support

- [Bigstring](https://github.com/janestreet/core/blob/master/core/src/bigstring_stubs.c): `core/src/bigstring_stubs.c`
- [JS runtime bindings](https://github.com/janestreet/core/blob/master/core/src/runtime.js): `core/src/runtime.js`
- [GC bindings](https://github.com/janestreet/core/blob/master/core/src/gc_stubs.c): `core/src/gc_stubs.c`
- [MD5](https://github.com/janestreet/core/blob/master/core/src/md5_stubs.c): `core/src/md5_stubs.c`
- [Timezone JS bindings](https://github.com/janestreet/core/blob/master/core/src/timezone_js_loader_stubs.js): `core/src/timezone_js_loader_stubs.js`

### Related packages

- [Filename utilities](https://github.com/janestreet/core/tree/master/filename_base/src): `filename_base/src`
- [Validation package](https://github.com/janestreet/core/tree/master/validate/src): `validate/src`
- [Command-line package](https://github.com/janestreet/core/tree/master/command/src): `command/src`
- [Heap-block utilities](https://github.com/janestreet/core/blob/master/heap_block/heap_block_stubs.c): `heap_block/heap_block_stubs.c`

### Other components

- **OCaml programs**
- **Temporal API**

## Connections

- Bigstring → JS runtime bindings: has JS support (evidence: `core/src/runtime.js`)
- Bigstring → Bigstring: uses declarations (evidence: `core/src/bigstring_stubs.c`)
- Timezone JS bindings → Temporal API: uses API (evidence: `core/src/timezone_js_loader_stubs.js`)
