FormerLab/fortransky: We built a terminal-only Bluesky / AT Protocol client written in Fortran, with a Rust native firehose decoder for the relay-raw stream path. Yes, that Fortran. · GitHub

FormerLab/fortransky: We built a terminal-only Bluesky / AT Protocol client written in Fortran, with a Rust native firehose decoder for the relay-raw stream path. Yes, that Fortran. · GitHub

Fortransky: A Bluesky Client Written in Fortran

In a stunning display of programming ingenuity, a developer has created Fortransky, a Bluesky client application written entirely in Fortran. This groundbreaking project demonstrates the versatility of the venerable Fortran language while providing a functional social media client for the AT Protocol-based Bluesky platform.

The Unlikely Marriage of Fortran and Social Media

Fortran, a programming language that dates back to the 1950s, is primarily known for scientific computing and numerical analysis. Its appearance in the realm of social media clients is unexpected, to say the least. Fortransky represents a fascinating intersection of legacy technology and modern social networking.

The project’s architecture is particularly noteworthy, featuring a layered approach that combines Fortran’s core functionality with modern bridging technologies:

  • Fortran TUI (Terminal User Interface) in the src/ directory
  • C libcurl bridge in cshim/ for HTTP functionality
  • Fortran iso_c_binding module in src/atproto/firehose_bridge.f90
  • Rust staticlib in bridge/firehose-bridge/ handling complex data transformations

Technical Architecture

The data flow through Fortransky’s pipeline is a testament to creative problem-solving:

envelope → CAR → DAG-CBOR → NormalizedEvent → JSONL

This transformation chain processes Bluesky’s raw data streams, converting them from their native binary format into something Fortran can handle effectively. The project even includes a firehose_bridge_cli binary used by relay_raw_tail.py for stream processing.

Installation and Dependencies

Setting up Fortransky requires a mix of traditional and modern development tools:

System Packages (Ubuntu/Debian):
bash
sudo apt install -y gfortran cmake pkg-config libcurl4-openssl-dev

Rust Requirements:
The project requires rustc >= 1.70, installable via rustup:
bash
curl –proto ‘=https’ –tlsv1.2 -sSf https://sh.rustup.rs | sh

Python Dependencies:
For the relay-raw stream path, Python dependencies are required:
bash
sudo pip install cbor2 websockets –break-system-packages

Authentication and Session Management

Fortransky uses app-specific passwords rather than main Bluesky credentials for security. Sessions are stored in ~/.fortransky/session.json and automatically restored on subsequent launches. Users can log out using the ‘x’ command, which clears the saved session.

Command Interface

The application features a comprehensive command set organized by context:

Home View Commands:

  • l – Login and fetch timeline
  • x – Logout and clear session
  • a <handle> – View author feed
  • s <query> – Search posts
  • p <handle> – View profile
  • n – View notifications
  • c – Compose post
  • t <uri> – Open thread
  • j – Stream tail
  • m – Toggle stream mode
  • q – Quit

Post List Commands:

  • j/k – Navigate
  • n/p – Next/previous page
  • o – Open thread
  • r – Reply
  • l – Like
  • R – Repost
  • q – Quote-post
  • P – Open author profile
  • /query – Search
  • b – Back to home

Stream Modes

Fortransky supports two streaming approaches:

Jetstream Mode:
Connects to Bluesky’s WebSocket service, offering lower bandwidth usage and native JSON handling. This is the “easy” mode for working with the data.

Relay-Raw Mode:
Connects directly to the raw AT Protocol relay, handling binary CBOR over WebSocket. This mode requires the native Rust decoder to process the data stream.

The decoder detection follows a specific order:

  1. FORTRANSKY_FIREHOSE_DECODER environment variable
  2. Local bridge target release build
  3. Local bridge target debug build
  4. firehose_bridge_cli on PATH

Development History

The project has evolved through several versions:

  • v1.1: Native Rust firehose decoder integration
  • v1.0: Like, repost, and quote-post actions added
  • v0.9: Typed decode layer implementation
  • v0.7: C libcurl bridge replacement and session support

Current Limitations

While impressive, Fortransky has some acknowledged limitations:

  • JSON parsing is hand-rolled and lightweight, not a full schema-driven parser
  • Relay-raw only processes app.bsky.feed.post create operations
  • Stream view shows raw DIDs without handle resolution
  • The TUI is line-based rather than raw keypress
  • Stream control commands only work from the home view

Fortran social media client
Bluesky AT Protocol
Legacy programming meets modern social media
Terminal-based Bluesky experience
Cross-language software architecture
Rust-Fortran integration
Innovative software engineering
Social media terminal client
AT Protocol implementation
Programming language versatility

Who said Fortran was dead?
The most unexpected Bluesky client
When legacy meets modern
Programming language crossover
Terminal social networking
Old school meets new school
Software engineering creativity
The power of interoperability
Unexpected technology combinations
Pushing programming boundaries

,

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *