The Tech Stack: Building the Future of Social Networking

The cutting-edge technologies powering Rhizome's semantic, event-sourced, federated architecture.


PostgreSQL: Not Your Average Database

JSONB + GIN Indexes: The ~1000x Speedup

We're using PostgreSQL JSONB with GIN indexes (jsonb_path_ops) for graph queries. This isn't your typical relational database—we're treating PostgreSQL as a hybrid document/graph store.

The Magic:

CREATE INDEX idx_event_references_path 
ON rhizome_events USING GIN ((payload -> 'references') jsonb_path_ops);

Performance Benchmarks:
- Without GIN index: 113ms for 1M rows
- With GIN index: 0.1ms for same query
- ~1000x speedup for containment queries

Why jsonb_path_ops?
- 30-50% smaller index than default jsonb_ops
- Faster containment queries (the only operator we need)
- Perfect for "find all posts referencing X" queries

Query Pattern:

events = RhizomeEvent.query.filter(
    RhizomeEvent.payload['references'].op('@>')(f'["{canonical_uri}"]')
).all()

This gives us graph database performance without leaving PostgreSQL. No need for Neo4j or other graph DBs—we get sub-millisecond graph queries on millions of events.


RDF & Semantic Triplets: The Grammar of Everything

Entities as Core, Triplets as Interpretations

Core Architectural Principle:
- Events & Entities are the core:
- Events = immutable history (what happened): "User X posted Y at time Z"
- Entities = canonical objects (what exists): Person, Author, Tag, Media, Source - immutable, factual objects
- Triplets are interpretations: Semantic triplets are community-created interpretations layered ON TOP of events and entities, relating them to each other and adding meaning

Subject-Verb-Object Modeling

We're modeling all interactions as semantic triplets using RDF (Resource Description Framework) patterns:

(user123, creates, post456)  # Interpretation: user created post
(post456, references, akashic://cultural/movement/surf-movies-1960s)  # Interpretation: post references concept
(post456, references, akashic://cultural/album/pet-sounds-1966)  # Interpretation: post references album
(user123, likes, post456)  # Interpretation: user likes post

Why Triplets?
- Grammatical: Natural Subject-Verb-Object structure
- Queryable: SPARQL-style pattern matching
- Extensible: Add new predicates without schema changes
- Standard: Built on W3C RDF standards
- Community-driven: Anyone can add triplets, community validates through resonance
- Evolving meaning: Interpretations can be added/removed/endorsed, while core entities remain stable

SPARQL-Style Queries

Conceptual SPARQL queries (we implement the patterns, not necessarily full SPARQL):

# What does User X reference?
SELECT ?object WHERE {
  user123 references ?object
}

# What references Concept Y?
SELECT ?subject WHERE {
  ?subject references akashic://cultural/movement/surf-movies-1960s
}

# What concepts are co-referenced with X?
SELECT ?other WHERE {
  ?post references akashic://cultural/album/pet-sounds-1966 .
  ?post references ?other .
  FILTER (?other != akashic://cultural/album/pet-sounds-1966)
}

This enables powerful graph traversal—find connections, discover patterns, traverse relationships.


JSON-LD: Protocol Transformation Magic

Lossless Protocol Conversion

We're using JSON-LD (JSON for Linked Data) to enable seamless protocol transformation:

Akashic Protocol (full granularity):

{
  "@context": ["https://www.w3.org/ns/activitystreams"],
  "type": "Post",
  "references": [
    "akashic://cultural/movement/surf-movies-1960s",
    "akashic://cultural/album/pet-sounds-1966"
  ],
  "triplets": [
    {"subject": "post789", "predicate": "references", "object": "..."}
  ]
}

ActivityPub (simplified):

{
  "type": "Note",
  "context": ["akashic://cultural/movement/surf-movies-1960s"],
  "rhizome:references": ["..."]  // Custom property for round-trip
}

RSS (minimal):

<item>
  <title>Thinking about surf movies...</title>
</item>

The Transformation Layer:
- Lossless by default: Full granularity preserved internally
- Graceful simplification: Export to simpler protocols
- Round-trip compatible: Akashic → ActivityPub → Akashic preserves data
- Transformation manifests: Track what's preserved/lost


Event Sourcing: Immutable Truth

Append-Only Event Log

Every action is an immutable event in an append-only log:

{
  "event_type": "POST",
  "user_id": "user123",
  "sequence": 42,
  "payload": {...},
  "previous_hash": "abc123...",
  "content_hash": "def456...",
  "signature": "ghi789..."
}

Key Characteristics:
- Immutable: Events never change, only append
- Hash-chained: Each event references previous hash (SHA256)
- Cryptographically signed: Ed25519 signatures ensure authenticity
- Tamper-proof: Changing any event breaks the chain

Materialized Views: Triplets from Events

Events generate materialized triplets:

Event: POST(user123, "Thinking about surf movies...", references=[...])
    ↓
Triplets:
  (user123, creates, post456)
  (post456, references, akashic://cultural/movement/surf-movies-1960s)
  (post456, references, akashic://cultural/album/pet-sounds-1966)

Why Materialized?
- Fast queries: Query triplets, not raw events
- Community enrichment: Users can add triplets
- Temporal queries: "What did User X reference in 2024?"
- Graph traversal: Find paths through triplet graph


Cryptography: Trust & Verification

Ed25519: Fast, Secure Signatures

We use Ed25519 (Edwards-curve Digital Signature Algorithm) for cryptographic signatures:

Instance Identity:

instance_id = sha256(public_key).hexdigest()
signature = ed25519_sign(private_key, event_data)

Every event is signed by the instance, ensuring cryptographic authenticity.

Fernet: Symmetric Encryption

Fernet (symmetric encryption) protects private keys:

Private keys are encrypted at rest, decrypted only when needed for signing.


Vector Clocks: Synchronization Without Centralization

Distributed State Tracking

Vector clocks track what events each instance has seen:

{
  "user_id": "user123",
  "remote_instance_id": "instance456",
  "vector_clock": {
    "instance456": 42,
    "instance789": 15
  },
  "last_sync_at": "2025-11-06T19:00:00Z"
}

What This Enables:
- Incremental exports: "Give me events since last sync"
- Conflict detection: "Did we both create event #42?"
- Efficient sync: Only transfer what's new
- Offline-first: Sync when connected, work when disconnected


ActivityStreams 2.0: Federation Foundation

W3C Standard for Social Networking

ActivityStreams 2.0 is the foundation of ActivityPub (and our Akashic Protocol):

Why ActivityStreams?
- W3C Standard: Widely adopted
- Extensible: JSON-LD allows custom properties
- Federated: Works across instances
- Future-proof: Accommodates new activity types

Our Extension:

{
  "type": "Note",
  "context": [...],  // Standard ActivityStreams
  "rhizome:references": [...],  // Our custom extension
  "rhizome:triplets": [...]  // Semantic triplets
}

Sneakerware: Offline-First Data Transfer

USB/Mesh Network Propagation

Sneakerware enables data transfer without internet:

Export Format:

{
  "instance_metadata": {...},
  "events": [...],
  "vector_clock": {...},
  "signatures": {...}
}

Verification:
- Signature check: Verify instance identity
- Chain integrity: Verify hash chain
- Deduplication: Skip events already seen


Graph Query Patterns: Beyond SQL

Containment Queries

Find all posts referencing X:

events = RhizomeEvent.query.filter(
    RhizomeEvent.payload['references'].op('@>')(f'["{uri}"]')
).all()

Co-Occurrence Analysis

Find URIs frequently referenced together:

events = get_all_referencing("akashic://cultural/album/pet-sounds-1966")
co_occurrences = Counter()
for event in events:
    for ref in event.payload.get('references', []):
        if ref != target_uri:
            co_occurrences[ref] += 1

Graph Traversal

Find related conversations:

def get_related_conversations(reference_uris):
    # Find posts sharing any of the references
    conditions = [
        RhizomeEvent.payload['references'].op('@>')(f'["{uri}"]')
        for uri in reference_uris
    ]
    return query.filter(or_(*conditions)).all()

Materialized Views: Performance at Scale

Triplets as Queryable Graph

Events (immutable history):

Event #1: POST(user123, "Thinking about surf movies...")
Event #2: LIKE(user456, post789)

Triplets (materialized graph):

(user123, creates, post789)
(post789, references, akashic://cultural/movement/surf-movies-1960s)
(user456, likes, post789)

Why Materialize?
- Fast queries: Query triplets, not scan events
- Graph algorithms: PageRank, community detection
- Temporal queries: "What did User X reference in 2024?"
- Community enrichment: Users add triplets, not events


Protocol Transformation: The Universal Adapter

Lossless → Simplified

Transformation Pipeline:

Akashic Protocol (Full Granularity)
    ↓
Transformation Layer
    ↓
┌───────────┴───────────┐
↓                       ↓
ActivityPub          RSS/Nostr
(Simplified)        (Minimal)

Transformation Rules:
1. Preserve core semantics: Who, what, when
2. Map to closest equivalent: ActivityPub Like → Akashic Reaction
3. Store full granularity: Custom properties for round-trip
4. Document information loss: Transformation manifests

Round-Trip Compatibility:
- Akashic → ActivityPub → Akashic preserves data
- Custom properties (rhizome:references) ensure lossless conversion
- Transformation manifests track what's preserved/lost


Canonical URIs: Preventing Fragmentation

Akashic Universal Mapping

Every entity gets a canonical URI:

akashic://cultural/album/pet-sounds-1966
akashic://cultural/movement/surf-movies-1960s
akashic://place/tower-of-london

Why Canonical?
- Prevents fragmentation: "Pet Sounds" vs "pet sounds" vs "Pet Sounds (Beach Boys)"
- Consistent queries: All references use same URI
- Cross-platform: Works with Letterboxd, Goodreads, etc.
- Future-proof: URIs persist even if external URLs break

Auto-Canonicalization (future):
- User types "Pet Sounds" → auto-canonize → akashic://cultural/album/pet-sounds-1966
- Taxonomic search → disambiguation UI → canonical URI
- External URLs → lookup mapping → canonical URI


Roam/Obsidian Patterns: Bidirectional Linking

Networked Thought Meets Social Networking

We're adapting Roam Research and Obsidian patterns for social conversations:

The Innovation:
- Roam's multi-reference linking (networked thought)
- ActivityPub federation (decentralized social)
- Semantic web principles (canonical URIs)
- Event sourcing (tamper-proof, exportable)

No other federated social platform does this.


Future Tech: What's Coming

AI-Driven Protocol Ingestion

Dynamic protocol learning:
- AI agent learns new protocols automatically
- Maps protocol features to Akashic Protocol
- Extracts semantic richness from protocol-specific features
- Builds knowledge base for future automation

Moderator-Driven AI Enhancement

Hybrid human-AI approach:
- Human moderators curate AI-suggested mappings
- Knowledge base improves over time
- Gradual automation as AI learns patterns
- Community-driven protocol understanding

Graph Algorithms

Community detection, PageRank, clustering:
- Find communities in conversation graphs
- Rank posts/concepts by importance
- Cluster related conversations
- Discover emergent patterns

Delay-Tolerant Networking

Mesh networks, sneakerware propagation:
- Works without internet
- Propagates through physical connections
- Censorship-resistant
- Disaster-ready


The Stack Summary

Database:
- PostgreSQL 14+ with JSONB + GIN indexes (jsonb_path_ops)
- Materialized views for triplets
- Vector clocks for synchronization

Cryptography:
- Ed25519 for signatures
- Fernet for symmetric encryption
- SHA256 for hash chaining

Protocols:
- Akashic Protocol (superset)
- ActivityPub (simplified export)
- RSS/Nostr (minimal export)
- JSON-LD for transformation

Standards:
- RDF/SPARQL for semantic triplets
- ActivityStreams 2.0 for federation
- JSON-LD for linked data

Patterns:
- Event sourcing (immutable logs)
- Materialized views (triplets)
- Graph queries (containment, traversal)
- Bidirectional linking (Roam/Obsidian)


This is cutting-edge tech, applied to social networking. We're not just building another social platform—we're building the infrastructure for a semantic, federated, offline-resilient social web. 🌿

← Back to Splash