Article
Building a full social network from scratch: feed, friends, groups, DMs, search
What it takes to build a complete social network as one coherent app — feed ranking, social graph, search, messaging — with Spring Boot, React, PostgreSQL, OpenSearch, and a Rust graph cache.
Most modern social platforms aren’t a single thing — they’re a stack of intersecting systems (feed ranking, social graph, search, messaging, moderation, analytics) that have grown together over years. I wanted to know what it actually takes to build all of that as one coherent app, end-to-end, with no shortcuts. The result is the Social Enterprise Platform: a full-featured social network built with Spring Boot, React, PostgreSQL, OpenSearch, and a custom Rust social-graph cache.
What’s in it
Far more than I expected when I started. The app ships with:
-
Personalized feed with 80% organic + 20% recommended content, six reaction types, nested comments, link previews, cursor-based infinite scroll
-
User profiles with follow/unfollow, follower lists, activity history
-
Friend requests with mutual-follow semantics
-
Groups — public or restricted, role-based (Owner / Admin / Member), pending approval flow, pinned posts
-
Pages for organizations or topics, with their own feeds
-
Direct messages with real-time conversations and file attachments
-
Search across users, groups, and pages via OpenSearch (with PostgreSQL fallback)
-
Admin dashboard with DAU/WAU/MAU, engagement analytics, moderation tools
-
AI support with Lucene KNN vectors, answer caching, knowledge-gap analysis, and feedback loops
The interesting parts
AOEE: a Rust social-graph cache
Postgres handles the durable social graph, but reading “who follows whom” on every feed request is too slow at any reasonable scale. AOEE is a small Rust service that holds the graph in memory with efficient bitset operations and answers reachability + mutual-friend queries in microseconds. Updates flow in via Postgres LISTEN/NOTIFY and a write-behind queue.
Feed ranking as a pluggable mix
The 80/20 organic-to-recommended split isn’t hardcoded; it’s a ranking pipeline with explicit stages (candidate generation, scoring, diversification, blending). Each stage is testable in isolation. The recommended path uses Lucene KNN vectors over a content-embedding index.
AI support that improves over time
The latest iteration adds a full AI support system: an intent classifier routes user questions, a retrieval layer pulls relevant context from the platform’s knowledge base, an LLM answers, and every interaction feeds back into a knowledge-gap dashboard. When too many users hit the same gap, an admin sees it surface in the metrics view.
What I learned
Social-app surfaces are deceptively simple. A “comment” looks like a row in a table; in practice it’s three database rows, a search-index update, an OpenSearch refresh, a webhook fan-out, a moderation check, and a feed-cache invalidation. Building all of that yourself is humbling. But you understand the system in a way no managed SaaS ever lets you.
Source
github.com/geekychris/enterprise_social_platform — 34 commits in, with full screenshots, architecture docs, and a Docker Compose stack that brings up the entire system locally.
