X Algorithm - The code that affects your thoughts

July 20, 2026 (1d ago)

X Recommendation Algorithm Architecture

With this post, X open-sourced its recommendation algorithm, becoming one of the first major social media platforms to make its core feed-generation logic fully transparent.

Behind the scenes, the repository xai-org/x-algorithm replaces legacy monolithic code with a lightweight, modular microservices architecture built primarily in Rust and Python.


Architecture Overview

The repository consists of several specialized components:


Technical Flow & Processing Logic

When a user publishes a post on X, the payload is pushed to specific Kafka topics categorized by parameters such as timestamp, media format, and geographic region.

(Note: The initial post-creation service and Kafka push implementations are managed by internal upstream systems outside this open-source repository.)

Grox Microservice Processing

The Grox service is the first component to receive and analyze the incoming posts. It performs the following operations:

Data Persistence

Once processing in Grox is complete, the post metadata and analyzed candidate data are persisted into either X's Manhattan database or sent to downstream Kafka event streams depending on the post's category.