Social Feed UI Kit (Next.js + React + Tailwind + React Query)

By (author)Saad Hasnain Khan

Tech stack:
Next.js
React
TS
TW

The frontend that ties a social app together. An infinite-scroll feed with IntersectionObserver, a post composer with media + character counter, a ful...
read more
AI Contributions:64
Published At:July 24, 2026
Files Included:13 file(s)
Updated At:October 23, 2026

Read Me

Social Feed UI Kit (Next.js + React + Tailwind + React Query)

The frontend that turns the backend gigs into a working social app. Everything is typed, themed (light/dark), accessible, and wired to the companion APIs.

What's inside

FileWhat it does
src/components/Feed.tsxinfinite-scroll timeline via IntersectionObserver + skeleton/empty states.
src/components/PostCard.tsxpost with like/comment/repost/share, optimistic + accessible.
src/components/PostComposer.tsxcomposer with live character counter.
src/components/CommentThread.tsxinline paginated comments + reply box.
src/components/FollowButton.tsxoptimistic follow/unfollow with hover-to-unfollow.
src/components/NotificationBell.tsxlive badge + dropdown over Socket.IO.
src/components/RelativeTime.tsxcompact "3m / 5h / 2d" timestamps.
src/hooks/useFeed.tsuseInfiniteQuery over the keyset feed cursor.
src/hooks/useEngagement.tsoptimistic like/repost/comment mutations with rollback.
src/hooks/useNotifications.tsSocket.IO notification stream + unread count.
src/lib/apiClient.tstiny typed fetch wrapper (bearer auth, query params).
src/types.tsshared response types.

Highlights

  • Infinite scroll with a prefetch margin (rootMargin: 600px) — loads the next page before the user hits the bottom, no scroll-event math.
  • Optimistic UI everywhere it matters. Likes, reposts, and follows flip instantly and roll back on error; the server's response reconciles the final state.
  • Real-time notification badge with zero polling — subscribes to the /notifications Socket.IO namespace and updates the count live.
  • Themed + accessible. Tailwind light/dark, aria-pressed/aria-label on actions, semantic <article>/<time>, keyboard-friendly buttons.
  • Presentational components, logic in hooks. Easy to restyle or port.

Wiring it up

// pages/_app.tsx
const qc = new QueryClient();
<QueryClientProvider client={qc}><Component {...pageProps} /></QueryClientProvider>

// pages/index.tsx
import { Feed } from '@/components/Feed';
export default function Home() { return <Feed />; }

Set NEXT_PUBLIC_API_URL to your backend base and store the JWT in localStorage.accessToken (or swap getToken() in apiClient.ts for cookies).

Install: npm i @tanstack/react-query socket.io-client. Talks to Posts & News Feed, Likes/Comments/Reposts, Profiles & Follow System, and Real-time Notifications.

Loading

Loading

Loading

More like this View all

AI WhatsApp Message Drafts (Gemini, Roman Urdu)

AI-written WhatsApp confirmations, payment reminders, out-for-delivery and thank-you messages in Roman Urdu, Urdu or English. Gemini + zod, model fallback, offline templates.

  • 0

    Ratings

  • 11

    Files

    • Next.js
    • React
    • +3

    Tech stack

Auth Module with Supabase SSR + Optional 2FA

A production-ready, plug-and-play authentication module built with Next.js 14 App Router and Supabase SSR. Drop it into any Next.js project to get a fully working auth system in minutes.

  • 0

    Ratings

  • 1

    Files

    • TS
    • Supabase
    • +4

    Tech stack

Smart Inventory & Auto-Merging Catalog API

Production-ready Next.js 14 inventory system with real-time catalog search, quantity auto-merging logic, and Supabase RLS security.

  • 0

    Ratings

  • 1

    Files

    • Next.js
    • TS
    • +5

    Tech stack