Skip to case file
Front pageCase FileRanked Social Feed

Subject of investigation

Green & Red Flag is a multilingual discussion platform for Tunisian dating scenarios. The repository shows a full-stack implementation of posting, green/red voting, comments, authenticated profile views, and a ranked feed. Its most distinctive implementation is the ranking layer: posts receive a time-decayed engagement score, cursor pagination carries the score/date/id ordering state, and the separate Hot Take surfaces high-volume posts with the most divided vote split.

PRODUCT

Social Discussion

RANKING

Score + Cursor Seek

HOT TAKE

Cached 10 Minutes

AUTH

JWT Cookie

CACHE

10-Min TTL

PRIMARY DB

MySQL

Opened 2025 · Closed

Case file opened — 2025

Social Discussion Platform

Ranking a social feed by engagement, disagreement, and time—without breaking pagination.

E-000 · PRODUCT

GREEN & RED FLAG · REPOSITORY EVIDENCE

FIG. 01 OF 04

Section 02

RANKING, AUTHENTICATION, AND LOCALIZATION VERIFIED.

A social feed needs to keep its ordering stable while engagement and age continuously change.

Posts and comments support green/red voting, and authenticated users can submit scenarios, comment, vote, and retrieve their own posts and aggregate vote totals.

The main feed computes a score from weighted votes, comment activity, freshness, and time decay. Its cursor stores score, creation time, and ID so the API can continue a ranked result set without offset pagination.

A dedicated Hot Take endpoint separately considers the 50 most active posts, favors divided opinion through an activity × controversy score, and caches the selected response in Redis for 10 minutes.

Intake form

PRODUCT
Multilingual voting discussion platform
PRIMARY CONSTRAINT
Ranked feed pagination
AUTH BOUNDARY
JWT guard on write/profile routes
LOCALE SUPPORT
English, French, Arabic-Tunisian, Tunisian Latin

Directive

Build a discussion platform with authenticated participation, ranked browsing, and multilingual journeys.

Section 04

RECONSTRUCTED ARCHITECTURE — REV. B

System architecture of the Green Red Flag platform

Diagram 02 — Data flow4 nodes · 3 links

Open fullscreen to interact with the system diagram.

Node — serviceLive traffic

Section 05

STACK AND RESPONSIBILITIES IDENTIFIED.

The technical stack behind the platform

  1. T-01

    Next.js

    Builds the localized client and route-based user journeys.

  2. T-02

    NestJS

    Provides modular HTTP APIs, validation, guards, and rate limiting.

  3. T-03

    MySQL

    Persists users, categories, posts, comments, and vote records.

  4. T-04

    Drizzle ORM

    Provides the MySQL schema, query layer, and migrations.

  5. T-05

    Redis

    Caches the Hot Take response for 10 minutes.

  6. T-06

    TanStack Query

    Handles client-side infinite feed queries, mutations, and cache updates.

  7. T-07

    JWT + Passport

    Authenticates protected endpoints from an httpOnly cookie or bearer token.

  8. T-08

    next-intl

    Handles locale routing and translated messages, including RTL Arabic-Tunisian pages.

  9. T-09

    TypeScript

    Provides the typed baseline across client and API.

Order: layer of concern — from interface to persistence.

File 06

IMPLEMENTED TRADE-OFFS RECORDED.

Major technical challenges and how they were resolved

Evidence board — drag the cards, drag the cork to pan

100%

Case file

Green Red Flag

4 obstacles · closed

  • Challenge CH-01: A ranked feed can reshuffle while a user is loading additional pages.. Decision: Encoded score, creation time, and ID in the cursor to continue from the last ranked item.. Result: The API uses a seek condition instead of offset pagination for ranked results..
  • Challenge CH-02: A “trending” post should favor active disagreement rather than raw vote volume alone.. Decision: Ranked the 50 most active posts by activity multiplied by vote-split controversy.. Result: The Hot Take endpoint favors posts with both participation and divided opinion..
  • Challenge CH-03: Frequently requested Hot Take selection repeats aggregation and ranking work.. Decision: Cached the selected response in Redis with a 10-minute expiry.. Result: Requests reuse the cached result until its expiry..
  • Challenge CH-04: Write actions need identity-aware controls without making browsing private.. Decision: Applied JWT guards to protected actions and optional authentication to readable feed endpoints.. Result: Public reads can include a voter’s state when a valid credential is present..

Section 08

AWAITING PORTFOLIO CONFIRMATION.

Final report on the Green Red Flag case

IMPLEMENTATION VERIFIED

Filed
by the case engineer

Ranking

The primary feed combines vote weighting, comment activity, freshness, and time decay in its score.

Pagination

The feed cursor preserves score, timestamp, and ID ordering for the next API request.

Trending

Hot Take selection uses activity and vote disagreement, with a Redis cache lasting 10 minutes.

Access

JWT guards protect participation and profile endpoints; rate limits apply globally and to selected write actions.

E-005 · REVIEW

SCREENSHOT REQUIRED

The repository confirms the system; visual evidence and project ownership details remain to be attached.

End of investigation

End of file — document CF-019


A ranking and pagination system built to stay stable while the feed keeps moving.

Next.js client and NestJS API.Not yet deployed.

Next case file — CF-017

Geleg

Real-time Multiplayer Platform · Status: Filed

A real-time multiplayer trivia platform built for synchronized gameplay across connected players.

Open case file