<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: SHREYANSH GIRI</title>
    <description>The latest articles on DEV Community by SHREYANSH GIRI (@kreycodes).</description>
    <link>https://dev.to/kreycodes</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4179280%2Fd5daf657-1021-4aa4-a28d-a140436c284b.png</url>
      <title>DEV Community: SHREYANSH GIRI</title>
      <link>https://dev.to/kreycodes</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kreycodes"/>
    <language>en</language>
    <item>
      <title>CodeClash: 1v1 Codeforces Duels, Now Haunted by a Local-LLM Ghost Racer for friends</title>
      <dc:creator>SHREYANSH GIRI</dc:creator>
      <pubDate>Tue, 27 Oct 2026 16:58:21 +0000</pubDate>
      <link>https://dev.to/kreycodes/codeclash-1v1-codeforces-duels-now-haunted-by-a-local-llm-ghost-racer-for-friends-d79</link>
      <guid>https://dev.to/kreycodes/codeclash-1v1-codeforces-duels-now-haunted-by-a-local-llm-ghost-racer-for-friends-d79</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/hacktoberfest-weekend-2026-10-01"&gt;Hacktoberfest Weekend Challenge: Build for a Friend&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  What I Built
&lt;/h1&gt;

&lt;p&gt;CodeClash is a real-time 1v1 competitive programming arena. Two players are matched by Elo, handed the same authentic Codeforces problem, and race to land the first Accepted verdict. It has ranked matchmaking, private 6-character challenge rooms, an embedded multi-language IDE, live verdict tracking, and a global leaderboard.&lt;/p&gt;

&lt;p&gt;For Ghost in the Machine, I took the theme literally from racing games. In a racing game, a ghost is a translucent replay of a past run that you race against: a dead lap that still drives. CodeClash's Ghost Racer is that idea for competitive programming: an open-weight-model agent, running locally, that races you on the same problem, attempting solutions, failing sample tests, retrying, and either beating you or fading out. No second human required, and no queue wait at 3 a.m.&lt;/p&gt;

&lt;p&gt;Demo&lt;/p&gt;

&lt;p&gt;Live app: &lt;a href="https://code-clash-kohl.vercel.app" rel="noopener noreferrer"&gt;https://code-clash-kohl.vercel.app&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Backend API: &lt;a href="https://codeclash-hmgz.onrender.com" rel="noopener noreferrer"&gt;https://codeclash-hmgz.onrender.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Code&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/ShreyanshGiri08" rel="noopener noreferrer"&gt;
        ShreyanshGiri08
      &lt;/a&gt; / &lt;a href="https://github.com/ShreyanshGiri08/CodeClash" rel="noopener noreferrer"&gt;
        CodeClash
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      CodeClash is a real-time 1v1 competitive programming platform built for speed and precision. Race head-to-head against rival coders or challenge friends on curated Codeforces problems, track live submission verdicts, and climb the global Elo leaderboard in real-time.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;⚡ CodeClash — Real-Time 1v1 Competitive Programming Esports Platform&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;&lt;a href="https://code-clash-kohl.vercel.app" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/ec1d043a1d00fe87ed53554a885888f8c3617889a93a6f02cd756af2fcf3d327/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6976655f4170702d636f64652d2d636c6173682d2d6b6f686c2e76657263656c2e6170702d4646443730303f7374796c653d666f722d7468652d6261646765266c6f676f3d76657263656c266c6f676f436f6c6f723d626c61636b" alt="Live App"&gt;&lt;/a&gt;
&lt;a href="https://codeclash-hmgz.onrender.com" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/3ecb93f492a946961ef9dedc5b2dc9713c8ae8cd2796fbdc742c7d89b2c0dcba/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4261636b656e645f4150492d636f6465636c6173682d2d686d677a2e6f6e72656e6465722e636f6d2d3030464639443f7374796c653d666f722d7468652d6261646765266c6f676f3d72656e646572266c6f676f436f6c6f723d626c61636b" alt="Backend API"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;🚀 &lt;strong&gt;Live App Deployment&lt;/strong&gt;: &lt;a href="https://code-clash-kohl.vercel.app" rel="nofollow noopener noreferrer"&gt;https://code-clash-kohl.vercel.app&lt;/a&gt;&lt;br&gt;
⚡ &lt;strong&gt;Backend API Server&lt;/strong&gt;: &lt;code&gt;https://codeclash-hmgz.onrender.com&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;CodeClash&lt;/strong&gt; is a state-of-the-art, real-time competitive programming esports platform designed for high-speed duels on authentic Codeforces problems. Featuring Elo-rated matchmaking, 6-character private challenge rooms, Valorant-style match entrances, an embedded multi-language IDE with local execution, a smart non-destructive algorithm snippet vault, dynamic analytics radar charts, 3D holographic badges, zero-asset Web Audio synthesis, and an advanced client-side TeX math statement parser.&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;📑 Table of Contents&lt;/h2&gt;
&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href="https://github.com/ShreyanshGiri08/CodeClash#-technical-stack" rel="noopener noreferrer"&gt;Technical Stack&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/ShreyanshGiri08/CodeClash#-system-design--architecture-flowcharts" rel="noopener noreferrer"&gt;System Design &amp;amp; Architecture Flowcharts&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/ShreyanshGiri08/CodeClash#-algorithmic--mathematical-models" rel="noopener noreferrer"&gt;Algorithmic &amp;amp; Mathematical Models&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/ShreyanshGiri08/CodeClash#-exhaustive-feature-directory" rel="noopener noreferrer"&gt;Exhaustive Feature Directory&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/ShreyanshGiri08/CodeClash#-statement-slicer--tex-math-cleaning-engine" rel="noopener noreferrer"&gt;Statement Slicer &amp;amp; TeX Math Cleaning Engine&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/ShreyanshGiri08/CodeClash#-performance-optimizations--resilience" rel="noopener noreferrer"&gt;Performance Optimizations &amp;amp; Resilience&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/ShreyanshGiri08/CodeClash#-project-directory-structure" rel="noopener noreferrer"&gt;Project Directory Structure&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/ShreyanshGiri08/CodeClash#-installation--local-setup" rel="noopener noreferrer"&gt;Installation &amp;amp; Local Setup&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/ShreyanshGiri08/CodeClash#-environment-variables" rel="noopener noreferrer"&gt;Environment Variables&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;🛠 Technical Stack&lt;/h2&gt;
&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Frontend Subsystems&lt;/h3&gt;

&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Core Framework&lt;/strong&gt;: React 18, Vite 5, React Router v6&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Styling &amp;amp; Micro-Interactions&lt;/strong&gt;: Tailwind CSS v4, Vanilla CSS Custom Variables, Framer Motion (3D spring physics, layout…&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/ShreyanshGiri08/CodeClash" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;How I Built It&lt;br&gt;
The arena (the nuts and bolts)&lt;/p&gt;

&lt;p&gt;Stack: React 18 + Vite + Tailwind v4 + Framer Motion on the frontend; FastAPI on Uvicorn, asyncpg, and Neon serverless PostgreSQL on the backend. Frontend on Vercel, API on Render.&lt;/p&gt;

&lt;p&gt;Matchmaking without Redis. Ranked queue is an in-memory structure behind an asyncio.Lock with an expanding band search: ±100 Elo at 0–10s, widening in steps to ±500 by the 120s timeout. Both sides are checked, so a new player's band is tested against the queued player's expanded band. For a single-process free-tier deploy this gives zero-latency lookups with no extra infra. (Multi-worker would move to Redis sorted sets with ZRANGEBYSCORE and Redlock; I documented that trade-off rather than pretending the problem doesn't exist.)&lt;/p&gt;

&lt;p&gt;Verdicts come from Codeforces itself. There is no custom judge to cheat. The server polls the official user.status endpoint and decides the winner from real submissions. Two details that mattered:&lt;/p&gt;

&lt;p&gt;A 60-second clock-drift buffer (effective_start = after_timestamp - 60) so server clock offsets don't cause a legit AC to be missed.&lt;br&gt;
Tie-break by creationTimeSeconds when both players solve it, so the earliest Accepted wins.&lt;/p&gt;

&lt;p&gt;Idempotent finalization. Race results can be triggered at the same moment by player 1, player 2, or background polling. A check-before-write plus an atomic SQL guard (UPDATE races SET status='finished', elo_applied=TRUE ... WHERE id=$1 AND elo_applied=FALSE) means Elo is applied exactly once. Without it you get +24 instead of +12. Elo is standard zero-sum with K = 32 (with a provisional K period for new accounts).&lt;/p&gt;

&lt;p&gt;Scraping that survives Codeforces. Codeforces has no statement API, so statements are scraped (httpx + BeautifulSoup) and cached with a TTL. When direct access fails there's a fallback cluster: Jina Reader → AllOrigins → CodeTabs. On the client, a custom statement slicer strips nav bars, flags and footers, and a TeX cleaner turns \ldots, \leq, 10^{9}, a_1, \dots, a_n into ..., ≤, 10⁹, a₁, ..., aₙ.&lt;/p&gt;

&lt;p&gt;Code Studio. Embedded editor for C++17, Python 3.10, Java 17 and JavaScript. Non-JS languages run through the Piston API; JS runs in a client-side sandbox. Output is diffed against expected sample output. A snippet vault (Fast I/O, DSU, ModPow, Segment Tree) inserts non-destructively: Fast I/O goes inside main(), helper structs go above it.&lt;/p&gt;

&lt;p&gt;Small things that make it feel alive. A Web Audio synthesizer with zero audio assets (oscillators and gain nodes for every UI sound), a Valorant-style 3.5s match entrance, 3D holographic badges, a Ctrl+K command palette, and a 6-axis skill radar computed as min(100, max(25, Elo/25 + 7·CF_solved_T + 12·clash_wins_T)).&lt;/p&gt;

&lt;p&gt;Boring-but-real engineering: pool recycling for Neon (max_inactive_connection_lifetime=180), sliding-window rate limits (5 queue requests/min, 15 verdict checks/min), and a /health endpoint that actually pings the DB.&lt;/p&gt;

&lt;p&gt;The Ghost (the open-source AI part)&lt;/p&gt;

&lt;p&gt;The Ghost is an agent, not a single prompt. It runs on an open-weight model served locally, and the model is a config value, so swapping it is a one-line change.&lt;/p&gt;

&lt;p&gt;Agent loop: Read statement → plan approach → write solution → run it against the sample tests in a sandbox → read the failure → revise. The loop is bounded to a fixed number of attempts, so it can lose, and losing convincingly is the point.&lt;br&gt;
Tools it can call: read_problem, run_code(lang, source, stdin) and submit_attempt.&lt;br&gt;
Pacing: The Ghost's visible progress is paced to a target Elo, so a 1200-rated Ghost doesn't solve a 2000 problem in 8 seconds.&lt;br&gt;
Integration: The Ghost joins the existing race room as a participant, emitting the same RACE_UPDATE events a human opponent would, so the arena needed almost no changes.&lt;br&gt;
Why Does Open Innovation Matter?&lt;br&gt;
Cost. Racing the Ghost costs nothing per match. A closed API charges per token on every attempt of every retry loop, and an agent that iterates several times per problem would burn through a free tier fast.&lt;br&gt;
Swappable brains. Because the model is a config value, I can drop in a bigger or smaller open-weight model and feel the difficulty change. That is the difficulty slider, and it's impossible when the model behind an API can change or be deprecated underneath you.&lt;br&gt;
No lock-in. A ghost that depends on a hosted service dies when the service does. Fitting for the theme, a ghost built on open weights can't be switched off by someone else.&lt;br&gt;
Control of the agent loop. With open tooling I decide the sandbox, the attempt cap, the retry policy and the pacing. Those are product decisions here, not API parameters.! --&amp;gt;&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>weekendchallenge</category>
      <category>hf26challenge</category>
    </item>
    <item>
      <title>CodeClash: 1v1 Codeforces Duels, Now Haunted by a Local-LLM Ghost Racer</title>
      <dc:creator>SHREYANSH GIRI</dc:creator>
      <pubDate>Tue, 27 Oct 2026 05:56:12 +0000</pubDate>
      <link>https://dev.to/kreycodes/codeclash-1v1-codeforces-duels-now-haunted-by-a-local-llm-ghost-racer-1ihp</link>
      <guid>https://dev.to/kreycodes/codeclash-1v1-codeforces-duels-now-haunted-by-a-local-llm-ghost-racer-1ihp</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/hacktoberfest-week4-2026-10-26"&gt;Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;CodeClash&lt;/strong&gt; is a real-time 1v1 competitive programming arena. Two players are matched by Elo, handed the &lt;em&gt;same&lt;/em&gt; authentic Codeforces problem, and race to land the first Accepted verdict. It has ranked matchmaking, private 6-character challenge rooms, an embedded multi-language IDE, live verdict tracking, and a global leaderboard.&lt;/p&gt;

&lt;p&gt;For &lt;em&gt;Ghost in the Machine&lt;/em&gt;, I took the theme literally from racing games. In a racing game, a &lt;strong&gt;ghost&lt;/strong&gt; is a translucent replay of a past run that you race against: a dead lap that still drives. CodeClash's &lt;strong&gt;Ghost Racer&lt;/strong&gt; is that idea for competitive programming: an open-weight-model agent, running locally, that races you on the same problem, attempting solutions, failing sample tests, retrying, and either beating you or fading out. No second human required, and no queue wait at 3 a.m.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;Live app: &lt;a href="https://code-clash-kohl.vercel.app" rel="noopener noreferrer"&gt;https://code-clash-kohl.vercel.app&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Backend API: &lt;a href="https://codeclash-hmgz.onrender.com" rel="noopener noreferrer"&gt;https://codeclash-hmgz.onrender.com&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/ShreyanshGiri08" rel="noopener noreferrer"&gt;
        ShreyanshGiri08
      &lt;/a&gt; / &lt;a href="https://github.com/ShreyanshGiri08/CodeClash" rel="noopener noreferrer"&gt;
        CodeClash
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      CodeClash is a real-time 1v1 competitive programming platform built for speed and precision. Race head-to-head against rival coders or challenge friends on curated Codeforces problems, track live submission verdicts, and climb the global Elo leaderboard in real-time.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;⚡ CodeClash — Real-Time 1v1 Competitive Programming Esports Platform&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;&lt;a href="https://code-clash-kohl.vercel.app" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/ec1d043a1d00fe87ed53554a885888f8c3617889a93a6f02cd756af2fcf3d327/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6976655f4170702d636f64652d2d636c6173682d2d6b6f686c2e76657263656c2e6170702d4646443730303f7374796c653d666f722d7468652d6261646765266c6f676f3d76657263656c266c6f676f436f6c6f723d626c61636b" alt="Live App"&gt;&lt;/a&gt;
&lt;a href="https://codeclash-hmgz.onrender.com" rel="nofollow noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/3ecb93f492a946961ef9dedc5b2dc9713c8ae8cd2796fbdc742c7d89b2c0dcba/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4261636b656e645f4150492d636f6465636c6173682d2d686d677a2e6f6e72656e6465722e636f6d2d3030464639443f7374796c653d666f722d7468652d6261646765266c6f676f3d72656e646572266c6f676f436f6c6f723d626c61636b" alt="Backend API"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;🚀 &lt;strong&gt;Live App Deployment&lt;/strong&gt;: &lt;a href="https://code-clash-kohl.vercel.app" rel="nofollow noopener noreferrer"&gt;https://code-clash-kohl.vercel.app&lt;/a&gt;&lt;br&gt;
⚡ &lt;strong&gt;Backend API Server&lt;/strong&gt;: &lt;code&gt;https://codeclash-hmgz.onrender.com&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;CodeClash&lt;/strong&gt; is a state-of-the-art, real-time competitive programming esports platform designed for high-speed duels on authentic Codeforces problems. Featuring Elo-rated matchmaking, 6-character private challenge rooms, Valorant-style match entrances, an embedded multi-language IDE with local execution, a smart non-destructive algorithm snippet vault, dynamic analytics radar charts, 3D holographic badges, zero-asset Web Audio synthesis, and an advanced client-side TeX math statement parser.&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;📑 Table of Contents&lt;/h2&gt;
&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href="https://github.com/ShreyanshGiri08/CodeClash#-technical-stack" rel="noopener noreferrer"&gt;Technical Stack&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/ShreyanshGiri08/CodeClash#-system-design--architecture-flowcharts" rel="noopener noreferrer"&gt;System Design &amp;amp; Architecture Flowcharts&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/ShreyanshGiri08/CodeClash#-algorithmic--mathematical-models" rel="noopener noreferrer"&gt;Algorithmic &amp;amp; Mathematical Models&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/ShreyanshGiri08/CodeClash#-exhaustive-feature-directory" rel="noopener noreferrer"&gt;Exhaustive Feature Directory&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/ShreyanshGiri08/CodeClash#-statement-slicer--tex-math-cleaning-engine" rel="noopener noreferrer"&gt;Statement Slicer &amp;amp; TeX Math Cleaning Engine&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/ShreyanshGiri08/CodeClash#-performance-optimizations--resilience" rel="noopener noreferrer"&gt;Performance Optimizations &amp;amp; Resilience&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/ShreyanshGiri08/CodeClash#-project-directory-structure" rel="noopener noreferrer"&gt;Project Directory Structure&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/ShreyanshGiri08/CodeClash#-installation--local-setup" rel="noopener noreferrer"&gt;Installation &amp;amp; Local Setup&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/ShreyanshGiri08/CodeClash#-environment-variables" rel="noopener noreferrer"&gt;Environment Variables&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;🛠 Technical Stack&lt;/h2&gt;
&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Frontend Subsystems&lt;/h3&gt;

&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Core Framework&lt;/strong&gt;: React 18, Vite 5, React Router v6&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Styling &amp;amp; Micro-Interactions&lt;/strong&gt;: Tailwind CSS v4, Vanilla CSS Custom Variables, Framer Motion (3D spring physics, layout…&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/ShreyanshGiri08/CodeClash" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  How I Built It
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The arena (the nuts and bolts)
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Stack:&lt;/strong&gt; React 18 + Vite + Tailwind v4 + Framer Motion on the frontend; FastAPI on Uvicorn, &lt;code&gt;asyncpg&lt;/code&gt;, and Neon serverless PostgreSQL on the backend. Frontend on Vercel, API on Render.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Matchmaking without Redis.&lt;/strong&gt; Ranked queue is an in-memory structure behind an &lt;code&gt;asyncio.Lock&lt;/code&gt; with an &lt;em&gt;expanding band&lt;/em&gt; search: ±100 Elo at 0–10s, widening in steps to ±500 by the 120s timeout. Both sides are checked, so a new player's band is tested against the queued player's &lt;em&gt;expanded&lt;/em&gt; band. For a single-process free-tier deploy this gives zero-latency lookups with no extra infra. (Multi-worker would move to Redis sorted sets with &lt;code&gt;ZRANGEBYSCORE&lt;/code&gt; and Redlock; I documented that trade-off rather than pretending the problem doesn't exist.)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Verdicts come from Codeforces itself.&lt;/strong&gt; There is no custom judge to cheat. The server polls the official &lt;code&gt;user.status&lt;/code&gt; endpoint and decides the winner from real submissions. Two details that mattered:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;60-second clock-drift buffer&lt;/strong&gt; (&lt;code&gt;effective_start = after_timestamp - 60&lt;/code&gt;) so server clock offsets don't cause a legit AC to be missed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tie-break by &lt;code&gt;creationTimeSeconds&lt;/code&gt;&lt;/strong&gt; when both players solve it, so the earliest Accepted wins.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Idempotent finalization.&lt;/strong&gt; Race results can be triggered at the same moment by player 1, player 2, or background polling. A check-before-write plus an atomic SQL guard (&lt;code&gt;UPDATE races SET status='finished', elo_applied=TRUE ... WHERE id=$1 AND elo_applied=FALSE&lt;/code&gt;) means Elo is applied exactly once. Without it you get +24 instead of +12. Elo is standard zero-sum with K = 32 (with a provisional K period for new accounts).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scraping that survives Codeforces.&lt;/strong&gt; Codeforces has no statement API, so statements are scraped (&lt;code&gt;httpx&lt;/code&gt; + BeautifulSoup) and cached with a TTL. When direct access fails there's a fallback cluster: Jina Reader → AllOrigins → CodeTabs. On the client, a custom statement slicer strips nav bars, flags and footers, and a TeX cleaner turns &lt;code&gt;\ldots&lt;/code&gt;, &lt;code&gt;\leq&lt;/code&gt;, &lt;code&gt;10^{9}&lt;/code&gt;, &lt;code&gt;a_1, \dots, a_n&lt;/code&gt; into &lt;code&gt;...&lt;/code&gt;, &lt;code&gt;≤&lt;/code&gt;, &lt;code&gt;10⁹&lt;/code&gt;, &lt;code&gt;a₁, ..., aₙ&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code Studio.&lt;/strong&gt; Embedded editor for C++17, Python 3.10, Java 17 and JavaScript. Non-JS languages run through the Piston API; JS runs in a client-side sandbox. Output is diffed against expected sample output. A snippet vault (Fast I/O, DSU, ModPow, Segment Tree) inserts non-destructively: Fast I/O goes &lt;em&gt;inside&lt;/em&gt; &lt;code&gt;main()&lt;/code&gt;, helper structs go &lt;em&gt;above&lt;/em&gt; it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Small things that make it feel alive.&lt;/strong&gt; A Web Audio synthesizer with zero audio assets (oscillators and gain nodes for every UI sound), a Valorant-style 3.5s match entrance, 3D holographic badges, a Ctrl+K command palette, and a 6-axis skill radar computed as &lt;code&gt;min(100, max(25, Elo/25 + 7·CF_solved_T + 12·clash_wins_T))&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Boring-but-real engineering:&lt;/strong&gt; pool recycling for Neon (&lt;code&gt;max_inactive_connection_lifetime=180&lt;/code&gt;), sliding-window rate limits (5 queue requests/min, 15 verdict checks/min), and a &lt;code&gt;/health&lt;/code&gt; endpoint that actually pings the DB.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Ghost (the open-source AI part)
&lt;/h3&gt;

&lt;p&gt;The Ghost is an &lt;strong&gt;agent&lt;/strong&gt;, not a single prompt. It runs on an open-weight model served locally, and the model is a config value, so swapping it is a one-line change.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Agent loop:&lt;/strong&gt; Read statement → plan approach → write solution → &lt;em&gt;run it against the sample tests in a sandbox&lt;/em&gt; → read the failure → revise. The loop is bounded to a fixed number of attempts, so it can lose, and losing convincingly is the point.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tools it can call:&lt;/strong&gt; &lt;code&gt;read_problem&lt;/code&gt;, &lt;code&gt;run_code(lang, source, stdin)&lt;/code&gt; and &lt;code&gt;submit_attempt&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pacing:&lt;/strong&gt; The Ghost's visible progress is paced to a target Elo, so a 1200-rated Ghost doesn't solve a 2000 problem in 8 seconds.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Integration:&lt;/strong&gt; The Ghost joins the existing race room as a participant, emitting the same &lt;code&gt;RACE_UPDATE&lt;/code&gt; events a human opponent would, so the arena needed almost no changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why Does Open Innovation Matter?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cost.&lt;/strong&gt; Racing the Ghost costs nothing per match. A closed API charges per token on every attempt of every retry loop, and an agent that iterates several times per problem would burn through a free tier fast.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Swappable brains.&lt;/strong&gt; Because the model is a config value, I can drop in a bigger or smaller open-weight model and &lt;em&gt;feel&lt;/em&gt; the difficulty change. That is the difficulty slider, and it's impossible when the model behind an API can change or be deprecated underneath you.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No lock-in.&lt;/strong&gt; A ghost that depends on a hosted service dies when the service does. Fitting for the theme, a ghost built on open weights can't be switched off by someone else.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Control of the agent loop.&lt;/strong&gt; With open tooling I decide the sandbox, the attempt cap, the retry policy and the pacing. Those are product decisions here, not API parameters.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>devchallenge</category>
      <category>hf26challenge</category>
    </item>
    <item>
      <title>Mini Slack v2.0: Building a Real-Time Chat App That Doesn’t Broadcast Everything to Everyone</title>
      <dc:creator>SHREYANSH GIRI</dc:creator>
      <pubDate>Sun, 25 Oct 2026 11:13:50 +0000</pubDate>
      <link>https://dev.to/kreycodes/mini-slack-v20-building-a-real-time-chat-app-that-doesnt-broadcast-everything-to-everyone-1l13</link>
      <guid>https://dev.to/kreycodes/mini-slack-v20-building-a-real-time-chat-app-that-doesnt-broadcast-everything-to-everyone-1l13</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/hacktoberfest-week3-2026-10-19"&gt;Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Mini Slack v2.0&lt;/strong&gt; is a real-time team messaging platform with channels, private DMs, threaded replies, emoji reactions, typing indicators and unread badges, in a dark/light UI. It also has a &lt;strong&gt;"Summarize thread"&lt;/strong&gt; button that uses a local open-source LLM (via Ollama) to turn a long thread into a short summary.&lt;/p&gt;

&lt;p&gt;A naive chat app broadcasts every event to every connected user and re-renders the whole message list on each new message. That works with five users and falls apart as the workspace grows. So I took the slow and steady route and made the boring parts efficient:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Targeted WebSocket delivery.&lt;/strong&gt; Clients send a &lt;code&gt;SUBSCRIBE&lt;/code&gt; event when they switch channels, and the server keeps a &lt;code&gt;channel_id → users&lt;/code&gt; registry. A channel message goes only to that channel's subscribers, and a DM goes to exactly two people.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Composite and partial Postgres indexes&lt;/strong&gt; for the queries a chat app runs constantly: the channel feed, DM pairs, thread replies and unread counts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A leaner React render path.&lt;/strong&gt; &lt;code&gt;React.memo&lt;/code&gt; on &lt;code&gt;MessageItem&lt;/code&gt; plus stable &lt;code&gt;useCallback&lt;/code&gt; handlers, so one incoming message re-renders one component instead of the whole visible list.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Local AI summaries.&lt;/strong&gt; Nobody has to scroll through 40 replies to find out what a thread decided.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Anyone who keeps a team chat open all day gets to be a little lazier: no refreshing, no polling, and no reading every reply to catch up on a thread.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;🌐 Live app: &lt;a href="https://slack-r7df.vercel.app/" rel="noopener noreferrer"&gt;https://slack-r7df.vercel.app/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;📖 API docs (FastAPI/OpenAPI): &lt;a href="https://slack-7yia.onrender.com/docs" rel="noopener noreferrer"&gt;https://slack-7yia.onrender.com/docs&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/ShreyanshGiri08" rel="noopener noreferrer"&gt;
        ShreyanshGiri08
      &lt;/a&gt; / &lt;a href="https://github.com/ShreyanshGiri08/Slack" rel="noopener noreferrer"&gt;
        Slack
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Mini Slack v2.0 — Real-Time Team Messaging Platform&lt;/h1&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;A production-grade, real-time team collaboration platform built with &lt;strong&gt;React&lt;/strong&gt;, &lt;strong&gt;FastAPI&lt;/strong&gt;, &lt;strong&gt;WebSockets&lt;/strong&gt;, and &lt;strong&gt;Neon PostgreSQL&lt;/strong&gt; — featuring channel-room targeted delivery, composite DB indexing, and an optimised React rendering pipeline.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;🌐 &lt;strong&gt;Live Web Application&lt;/strong&gt;: &lt;a href="https://slack-r7df.vercel.app/" rel="nofollow noopener noreferrer"&gt;https://slack-r7df.vercel.app/&lt;/a&gt;&lt;br&gt;
⚡ &lt;strong&gt;Backend REST &amp;amp; WS API&lt;/strong&gt;: &lt;a href="https://slack-7yia.onrender.com" rel="nofollow noopener noreferrer"&gt;https://slack-7yia.onrender.com&lt;/a&gt;&lt;br&gt;
📖 &lt;strong&gt;API Documentation&lt;/strong&gt;: &lt;a href="https://slack-7yia.onrender.com/docs" rel="nofollow noopener noreferrer"&gt;https://slack-7yia.onrender.com/docs&lt;/a&gt;&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;📸 Overview&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;Mini Slack is a full-stack Slack clone with isolated private DMs, emoji reactions, threaded replies, real-time WebSocket messaging, and a beautiful dark/light mode UI. Built with a clean separation of concerns across backend services, routers, schemas, and ORM models.&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;✨ Features&lt;/h2&gt;
&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;💬 Messaging&lt;/h3&gt;

&lt;/div&gt;
&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Details&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Real-time Channel Messaging&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Native FastAPI WebSockets — no polling&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Isolated Private Direct Messages&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;DMs stored with &lt;code&gt;recipient_id&lt;/code&gt;, never appear in channel streams&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Threaded Message Replies&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Sliding side drawer — replies stored as &lt;code&gt;parent_id&lt;/code&gt; foreign keys&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Soft Message Deletion&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;is_deleted=True&lt;/code&gt; flag preserves thread continuity&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Emoji&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;…&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/ShreyanshGiri08/Slack" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  How I Built It
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Backend:&lt;/strong&gt; FastAPI (Python 3.13), SQLAlchemy 2.x, Pydantic v2, Uvicorn, and native FastAPI WebSockets. Data lives in serverless Neon PostgreSQL. The code is split into routers, services, schemas and ORM models, and the schema auto-migrates on startup. It also seeds 8 engineering channels (&lt;code&gt;#general&lt;/code&gt;, &lt;code&gt;#engineering&lt;/code&gt;, &lt;code&gt;#web&lt;/code&gt;, &lt;code&gt;#blockchain&lt;/code&gt;, &lt;code&gt;#ai-ml&lt;/code&gt;, &lt;code&gt;#devops&lt;/code&gt;, &lt;code&gt;#design&lt;/code&gt;, &lt;code&gt;#random&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Frontend:&lt;/strong&gt; React 18 + Vite, TailwindCSS, Framer Motion, Axios, Lucide icons, &lt;code&gt;emoji-picker-react&lt;/code&gt;, and DiceBear avatars.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Design decisions worth calling out:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Soft deletes.&lt;/strong&gt; Deleting a message sets &lt;code&gt;is_deleted=True&lt;/code&gt; instead of removing the row, so threads don't lose their parent.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DM isolation.&lt;/strong&gt; DMs are stored with a &lt;code&gt;recipient_id&lt;/code&gt; and filtered out of channel queries, so they can never leak into a channel feed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Partial indexes.&lt;/strong&gt; Each index only covers the rows its query touches, e.g. the channel feed index is restricted to &lt;code&gt;parent_id IS NULL AND recipient_id IS NULL&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Open-source AI: Ollama.&lt;/strong&gt; I added a "Summarize thread" button to the thread drawer. When you click it, the FastAPI backend collects the replies for that message, sends them to a locally running open-weight model through &lt;a href="https://ollama.com" rel="noopener noreferrer"&gt;Ollama&lt;/a&gt; (I used &lt;code&gt;[MODEL NAME]&lt;/code&gt;), and returns a short summary to the UI.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;New endpoint:&lt;/strong&gt; &lt;code&gt;POST /api/v1/messages/{id}/summarize&lt;/code&gt;. It reuses the same reply query the thread drawer already uses.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Local inference:&lt;/strong&gt; the backend calls Ollama's HTTP API on &lt;code&gt;localhost:11434&lt;/code&gt;. No API key, no per-token billing, and nothing leaves the machine.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Failure handling:&lt;/strong&gt; if Ollama isn't running, the endpoint returns a clear error and the button is disabled, so the rest of the chat is unaffected.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why Does Open Innovation Matter?
&lt;/h2&gt;

&lt;p&gt;Chat messages are some of the most private data an app handles. Because the model is open-weight and runs locally through Ollama, summarizing a thread doesn't mean shipping my users' conversations to a third-party API. I can pick the model, swap it for a smaller one on weak hardware, and run it with no usage costs. A closed API would have meant sending every thread off-machine, paying per call, and depending on someone else's pricing and uptime.&lt;/p&gt;

&lt;p&gt;The rest of the stack is open source too: FastAPI, SQLAlchemy, PostgreSQL, React, Vite and Tailwind. As a first-year student I could read the source whenever something behaved strangely, and that's a big part of how a single person can build a real-time, multi-user app end to end.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Lazy Payoff
&lt;/h2&gt;

&lt;p&gt;Every feature in Mini Slack removes a small chore from a day of team chat:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No refreshing.&lt;/strong&gt; Messages arrive over WebSockets, so there's no polling and no reload to see what's new.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No scanning for what's unread.&lt;/strong&gt; Per-channel unread badges come from a &lt;code&gt;message_reads&lt;/code&gt; table, so you can see which channels need you at a glance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No hunting for old messages.&lt;/strong&gt; Workspace-wide search covers channels and messages.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No losing context.&lt;/strong&gt; Replies live in a sliding thread drawer, so side conversations stay out of the main feed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No noisy channels.&lt;/strong&gt; Events go only to people subscribed to that channel, so you aren't pulled into conversations that aren't yours. A DM from someone while you're in another channel shows up as a slide-in toast instead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No rebuilding your place.&lt;/strong&gt; The workspace persists across reloads, and the theme choice is saved in &lt;code&gt;localStorage&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No reading 40 replies to catch up.&lt;/strong&gt; The "Summarize thread" button gives you the gist from a local model, with nothing sent to a third party.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The same idea applies on the engineering side. Targeted fan-out and memoized components mean one new message re-renders one component instead of the whole visible list, so the app stays responsive however many messages are on screen.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prize Categories
&lt;/h2&gt;

&lt;p&gt;[OPTIONAL: list every partner category you're entering, from the challenge page. Otherwise delete this section.]&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>hf26challenge</category>
    </item>
  </channel>
</rss>
