···11+# FORTRAT-F90
22+33+**AT Protocol lexicon explorer — written in Fortran**
44+55+
66+
77+88+---
99+1010+## So what is this?
1111+1212+FORTRAT-F90 is a terminal application that fetches the AT Protocol lexicon schema from GitHub, builds a force-directed graph of all record types and their references, and renders it as ASCII art in your terminal.
1313+1414+It is written in Fortran. And if you run it, it's running wild :) Still early
1515+1616+Not "inspired by Fortran". Not "has some Fortran vibes". Written in Fortran. The HTTP requests are Fortran. The JSON parsing is Fortran. The force simulation is Fortran. The ASCII renderer is Fortran. The terminal raw mode is a 40-line C helper because `tcsetattr` is a POSIX syscall and we are not animals.
1717+1818+```
1919+./fortrat
2020+```
2121+2222+That is a Fortran binary talking to the AT Protocol.
2323+2424+---
2525+2626+## Why?
2727+2828+[Fortransky](https://github.com/FormerLab/fortransky) — our FORTRAN Bluesky client — shipped a few days before Atmosphere 2026. The AT Proto crowd found out that someone had written a Bluesky client in a language from 1957. This was considered funny. We considered it a mandate :)
2929+3030+FORTRAT-F90 is the follow-up, our inhouse AT Ptoto lexicon explorer now open sourced. If Fortransky proved you *could* post to Bluesky from Fortran, FORTRAT-F90 proves you can also explore the entire AT Protocol schema from Fortran while watching a force simulation settle in real time.
3131+3232+The name is FORTRAN + AT Protocol. FORTRAN identifiers were limited to 6 characters. We used 6. We showed restraint.
3333+3434+---
3535+3636+## What you are looking at
3737+3838+The AT Protocol defines every data type on the network in a schema system called **lexicons**. A post is a lexicon. A like is a lexicon. A follow, a label, a moderation action — all lexicons, all formally specified in JSON, all living in the [atproto repository](https://github.com/bluesky-social/atproto/tree/main/lexicons).
3939+4040+FORTRAT-F90 fetches all of them, builds a graph where nodes are lexicon types and edges are references between them, and renders it. The dense blue-green cluster in the middle is `app.bsky.*`. The orbiting yellow nodes are `com.atproto.*`. The purple ones are `tools.ozone.*`. The force simulation pulls related types together and pushes unrelated ones apart, so the layout roughly reflects the actual structure of the protocol.
4141+4242+It updates every 150ms. The nodes drift.
4343+4444+---
4545+4646+## Architecture
4747+4848+Everything is Fortran. The exception is noted with appropriate shame.
4949+5050+```
5151+src/types.f90 — all shared types, ANSI escape constants
5252+src/tui.f90 — terminal control (ISO C binding → C helper)
5353+src/tui_helper.c — 60 lines of C (tcsetattr, write, ioctl — we tried)
5454+src/simulate.f90 — force-directed simulation, pure Fortran math
5555+src/render.f90 — ASCII grid renderer, Bresenham lines, frame buffer
5656+src/fetch.f90 — HTTP (ISO C binding → libcurl)
5757+src/lexparse.f90 — JSON (json-fortran), graph builder
5858+src/main.f90 — event loop, state machine
5959+```
6060+6161+The renderer builds the entire frame into a Fortran allocatable array and sends it to C in a single `write()` call. This is how we avoid flicker. It works.
6262+6363+---
6464+6565+## Build
6666+6767+### Dependencies
6868+6969+```bash
7070+# Arch / Garuda
7171+sudo pacman -S gcc-fortran curl cmake git
7272+7373+# Ubuntu / Debian
7474+sudo apt install gfortran libcurl4-openssl-dev cmake git
7575+```
7676+7777+### Build
7878+7979+```bash
8080+make
8181+```
8282+8383+The Makefile clones and builds [json-fortran](https://github.com/jacobwilliams/json-fortran) into `vendor/` automatically on first run. Subsequent builds skip this step.
8484+8585+```bash
8686+./fortrat
8787+```
8888+8989+Allow 2-3 minutes for the initial lexicon fetch (~256 files from GitHub's CDN). After that it runs locally.
9090+9191+---
9292+9393+## Controls
9494+9595+| Key | Action |
9696+|-----|--------|
9797+| `hjkl` / arrows | Navigate between nodes |
9898+| `Enter` | Inspect selected node |
9999+| `Esc` | Deselect |
100100+| `/` | Search lexicons |
101101+| `Tab` | Toggle namespace visibility |
102102+| `c` | Toggle community lexicons |
103103+| `q` | Quit |
104104+105105+---
106106+107107+## Recommended terminal size
108108+109109+120×40 minimum. The wider the better. The graph breathes at 200+ columns
110110+111111+Works in cool-retro-term (phosphor green preset, obviously) and in any modern terminal. The screenshots from cool-retro-term looked better. The screenshots from a normal terminal are more readable. Both are valid choices and we will not judge you.
112112+113113+---
114114+115115+## Relation to Fortransky
116116+117117+[Fortransky](https://github.com/FormerLab/fortransky) is a FORTRAN Bluesky client. It posts. It reads timelines. It has a Rust decoder for the firehose and an x86-64 assembly decoder for fun. It is arguably the most over-engineered Bluesky client in existence...
118118+119119+FORTRAT-F90 is Fortran 2018. It uses allocatable strings, `iso_c_binding`, and modern modules. By comparison it is practically contemporary software.
120120+121121+Both are part of the FormerLab sovereign computing ecosystem, which is a fancy way of saying we build things that have no business existing and then release them anyway.
122122+123123+---
124124+125125+## Known limitations
126126+127127+- GitHub's unauthenticated API is rate-limited to 60 requests/hour. If the fetch fails, wait an hour or set a `GITHUB_TOKEN` in a proxy.
128128+- The force simulation is O(n²). With 256 nodes it runs fine. With 2000 nodes it would not.
129129+- The JSON parser is the excellent [json-fortran](https://github.com/jacobwilliams/json-fortran) by Jacob Williams. Without it this project would have required writing a JSON parser in Fortran, which we were prepared to do but preferred not to.
130130+- `tui_helper.c` exists. We know.
131131+132132+---
133133+134134+## FormerLab
135135+136136+[formerlab.eu](https://formerlab.eu)
137137+138138+Building things that have no business existing since whenever this started.
139139+140140+FORTRAT = FORTRAN + AT Protocol. Six characters. We counted.