Back to Projects
TruthSkyPost preview
Social Media Platform

TruthSkyPost

A live, high-concurrency production social network engineered with custom feed ranking algorithms, real-time Socket.io messaging, and multi-layer caching.

Next.jsTypeScriptSocket.ioRedisDockerMongoDBRedux ToolkitShadcn/uiTailwind CSSJWT AuthResend OTP APIZodBcrypt

Architecture & Overview

TruthSkyPost is a production-grade full-stack social ecosystem engineered from the ground up to handle high-concurrency real-time interactions. The system separates high-frequency read/write concerns by deploying a Next.js App Router client, an Express.js API gateway, and an isolated Socket.io service backed by Redis Pub/Sub. Featuring downloadable Android APKs and installable PWA integration, the architecture prioritizes low-latency feed delivery, sub-millisecond session states, and zero CLS layout stability.

The Problem

  1. 1

    Auth & Multi-Tab Session Invalidation: Traditional JWT stateless flows were dropping active sessions or conflicting tokens when users opened parallel tabs/browsers, resulting in unexpected logouts.

  2. 2

    Real-time Message Security & Latency: High-volume direct messaging faced potential middleman interception risks and thread synchronization lags across clustered server nodes.

  3. 3

    Database Load: Uncached MongoDB queries for dynamic news feeds generated heavy I/O spikes under peak user activity.

The Solution

  1. 1

    Enterprise Security & Token Architecture: Rebuilt authentication using HTTP-only SameSite JWT cookies paired with rotating refresh tokens, Bcrypt password hashing, and Resend-backed OTP email verification (storing backend OTPs in hashed formats).

  2. 2

    Redis-Adapter Socket Messaging: Integrated a Redis Pub/Sub adapter into Socket.io gateway nodes to maintain stateful 1-on-1 chats, typing indicators, and presence tracking securely across multiple instances.

  3. 3

    Multi-Metric Caching & Cursor Pagination: Implemented Redis read-through caching for hot paths (reducing DB loads by 70%+) combined with cursor pagination (~9 KB payloads) for seamless infinite scrolling.

Key Features

Real-Time Messaging Engine

Socket.io powered instant 1-on-1 messaging, presence detection, and live notification alerts.

Custom Feed Ranking Algorithm

Multi-metric algorithm scoring posts by engagement, recency decay, and tag matching.

Hashed OTP Email Verification

Secure onboarding flows powered by the Resend API with server-side OTP hash comparison.

Redis-Backed Performance Layer

Sub-millisecond latency for hot read paths, post caching, and automated cache invalidation.

Enterprise Security Suite

HTTP-only cookies, Bcrypt password hashing, CSRF/XSS protection, and Zod input validation.

Mobile-First PWA & Native Build

Installable PWA and downloadable Android APK support with zero CLS layout shifts.

Tech Stack Used

Frontend

Next.jsTypeScriptRedux ToolkitShadcn/uiTailwind CSS

Backend

Node.jsExpress.jsSocket.ioJWT AuthResend OTP API

Data, Infra & Validation

MongoDBRedisDockerZodBcrypt

Curious about the rest of the work?

Back to Projects