A modern, full-featured social media application built with Next.js 16, React 19, and TypeScript. It supports multilingual content (English & Arabic), dark/light themes, real-time notifications, and a rich set of social interactions.
- β¨ Features
- π οΈ Tech Stack
- π Project Structure
- π Getting Started
- π Available Scripts
- π Internationalization (i18n)
- π¨ Theming
- π Authentication & Middleware
- π¦ Key Packages
- Login β Secure sign-in with form validation.
- Signup β User registration with full validation.
- Logout β Session-based logout with cookie management.
- Change Password β Update password from the settings page.
- Route Protection β Middleware-based protection for authenticated and guest routes.
- News Feed β Infinite scrolling feed with paginated posts.
- Create Post β Create posts with text and/or image, with privacy level selection (
Public,Following,Only Me). - Edit & Delete Posts β Full CRUD operations on your own posts.
- Like & Unlike Posts β Toggle like on any post.
- Bookmark Posts β Save posts for later viewing.
- Share Posts β Share/repost other users' posts with your own comment.
- Post Privacy Filters β Filter feed by
All,Following,My Posts, orSavedposts. - Single Post View β Dedicated page for viewing a single post with all its details.
- Image Lightbox β Full-screen image viewer for post images.
- Emoji Picker β Rich emoji input for comments and posts
- Add Comments β Comment on any post with text and image.
- Edit & Delete Comments β Modify or remove your own comments.
- Like Comments β Toggle like on comments.
- Nested Replies β Reply to comments with threaded conversation support.
- Emoji Picker β Rich emoji input for comments and posts.
- View Profile β View your own profile with stats (posts, followers, following).
- View Other Users' Profiles β Visit any user's profile page.
- Update Profile Photo β Upload and change your avatar.
- Update/Delete Cover Photo β Upload a new cover or remove the existing one.
- Profile Tabs β Browse user content through organized tabs.
- User Posts List β View all posts by a specific user.
- Suggested Friends β Discover new people to follow with suggestion cards.
- Follow / Unfollow Users β Toggle follow status on any user.
- Search Users β Search for users by name with debounced input.
- User Profiles β View detailed profiles of other users.
- Real-Time Notification Count β Unread notification badge in the navbar.
- Notification List β View all notifications with infinite scrolling.
- Mark as Read β Mark individual notifications as read.
- Mark All as Read β Bulk mark all notifications as read.
- Notification Types β Supports likes, comments, follows, and shares.
- Change Password β Secure password change form with validation.
- Theme Toggle β Switch between Dark and Light mode.
- Language Switch β Switch between English and Arabic.
- English (en) β Full English language support.
- Arabic (ar) β Full Arabic language support with RTL layout.
- Locale-Based Routing β URL-based locale prefix (
/en/...,/ar/...).
- Dark & Light Themes β Full theme support with
next-themes. - Responsive Design β Mobile-first responsive layout with 3-column desktop grid.
- Skeleton Loaders β Smooth loading states across all pages.
- Toast Notifications β User feedback with
sonnertoast messages. - Glassmorphism Navbar β Sticky navbar with backdrop blur effect.
- Infinite Scrolling β Seamless content loading with
react-intersection-observer. - State Screens β Reusable empty, error, and loading state components.
| Technology | Version | Description |
|---|---|---|
| Next.js | 16.1.6 | React framework with App Router |
| React | 19.2.4 | UI library |
| TypeScript | 5.9.3 | Type-safe JavaScript |
| Tailwind CSS | 4.2.1 | Utility-first CSS framework |
| Package | Description |
|---|---|
| @tanstack/react-query | Server state management & data fetching |
| react-hook-form | Performant form handling |
| zod | Schema-based form validation |
| js-cookie | Cookie-based token management |
| Package | Description |
|---|---|
| Radix UI | Accessible, unstyled UI primitives |
| shadcn/ui | Pre-built components (New York style) |
| Lucide React | Beautiful icon library |
| class-variance-authority | Component variant management |
| clsx + tailwind-merge | Conditional class utilities |
| tw-animate-css | Tailwind animation utilities |
| Package | Description |
|---|---|
| next-intl | Full i18n support with locale routing |
| next-themes | Dark/Light theme management |
| Package | Description |
|---|---|
| yet-another-react-lightbox | Full-screen image lightbox |
| emoji-picker-react | Emoji picker for text inputs |
| react-intersection-observer | Infinite scroll detection |
| react-day-picker | Date picker component |
| sonner | Toast notification system |
| Package | Description |
|---|---|
| @tanstack/react-query-devtools | React Query debugging tools |
| ESLint + eslint-config-next | Code linting |
| knip | Unused dependency detection |
| git-cz | Conventional commits |
| rimraf | Cross-platform directory cleanup |
social-app-next/
βββ public/ # Static assets (logo, images)
βββ src/
β βββ app/
β β βββ [locale]/ # Locale-based routing (en, ar)
β β βββ (auth)/ # Auth pages (login, signup)
β β β βββ login/
β β β βββ signup/
β β βββ (main)/ # Main app layout with navbar & sidebars
β β β βββ feed/
β β β βββ posts/ # Single post page
β β β βββ profile/
β β β βββ user/ # Other user profiles
β β β βββ notifications/
β β β βββ settings/
β β β βββ suggested-friends/
β β βββ layout.tsx # Root layout with providers
β β
β βββ core/ # Core app configuration
β β βββ constants/ # API endpoints & route constants
β β βββ i18n/ # Internationalization config & routing
β β βββ lib/ # Utilities (API fetch, time formatting)
β β βββ messages/ # Translation files (en.ts, ar.ts)
β β βββ providers/ # React Query provider
β β
β βββ features/ # Feature-based modules
β β βββ auth/ # Authentication (login, signup, shared)
β β β βββ login/ # Login form, hook, schema, service
β β β βββ signup/ # Signup form, hook, schema, service
β β β βββ shared/ # Shared auth components & utilities
β β β
β β βββ feed/ # Feed & posts feature
β β β βββ components/ # Post card, creator, comments, sidebars
β β β βββ hooks/ # Posts, comments, users hooks
β β β βββ models/ # Post, Comment, SharedPost types
β β β βββ schemas/ # Zod validation schemas
β β β βββ services/ # API service functions
β β β βββ constants/ # Feed-specific constants
β β β
β β βββ profile/ # User profile feature
β β β βββ components/ # Profile header, info, stats, tabs
β β β βββ hooks/ # Profile data hooks
β β β βββ models/ # Profile types
β β β βββ services/ # Profile API services
β β β
β β βββ notifications/ # Notifications feature
β β β βββ components/ # Notification list, item, skeleton
β β β βββ hooks/ # Notification hooks
β β β βββ models/ # Notification types
β β β βββ services/ # Notification API services
β β β
β β βββ settings/ # Settings feature
β β βββ components/ # Change password form
β β βββ hooks/ # Settings hooks
β β βββ schemas/ # Password change validation
β β
β βββ shared/ # Shared/reusable modules
β β βββ components/
β β β βββ ui/ # Base UI components (Button, Dialog, Input, etc.)
β β β βββ shared/ # Shared components (StateScreen, InfiniteList, etc.)
β β β βββ layout/ # Layout components (Navbar)
β β βββ hooks/ # Shared hooks (useUserData)
β β βββ models/ # Global types (Locale, Direction, Privacy)
β β
β βββ globals.css # Global styles & Tailwind config
β βββ proxy.ts # Middleware (auth guards, i18n routing)
β
βββ components.json # shadcn/ui configuration
βββ next.config.ts # Next.js configuration with next-intl
βββ tailwind.config.ts # Tailwind CSS configuration
βββ tsconfig.json # TypeScript configuration
βββ eslint.config.mjs # ESLint flat config
βββ postcss.config.mjs # PostCSS configuration
βββ package.json # Dependencies & scripts
Make sure you have the following installed:
- Node.js >= 18.x
- Yarn (recommended) or npm
git clone https://github.com/Kerolos2000/social-app-next.git
cd social-app-nextyarn install
# or
npm installyarn dev
# or
npm run devThis will start the app with Turbopack for fast development. The .next cache is automatically cleaned before each dev start.
Navigate to http://localhost:3000 to view the application.
The app will automatically redirect to the default locale (
/en/loginor/en/feedbased on auth status).
| Script | Command | Description |
|---|---|---|
dev |
yarn dev |
Start dev server with Turbopack (clears .next) |
build |
yarn build |
Create production build |
start |
yarn start |
Start production server |
lint |
yarn lint |
Run ESLint checks |
commit |
yarn commit |
Create conventional commit with git-cz |
The app uses next-intl for full internationalization support:
- Supported Locales:
en(English),ar(Arabic) - Default Locale:
en - RTL Support: Arabic locale automatically switches to RTL layout
- URL Structure:
/{locale}/...(e.g.,/en/feed,/ar/feed) - Translation Files: Located at
src/core/messages/en.tsandsrc/core/messages/ar.ts
All text in the application is fully translatable, including:
- Navigation labels
- Form labels & validation messages
- Error messages & empty states
- Button labels & tooltips
- Notification content
The app supports Dark and Light themes using next-themes:
- Theme preference is persisted across sessions
- Seamless switching via the settings sidebar or settings page
- All components respect the active theme through CSS variables
- Uses Tailwind CSS dark mode utilities
- Users sign up or log in via the auth pages.
- A JWT token is stored as a cookie (
token). - The token is automatically attached to all API requests via
clientApiFetch. - User data is retrieved from the token using
js-cookie.
The middleware handles:
- Protected Routes: Redirects unauthenticated users to
/login(e.g.,/feed). - Guest Routes: Redirects authenticated users away from
/loginand/signup. - Locale Detection: Applies the correct locale from the URL.
- i18n Middleware: Integrates
next-intlmiddleware for locale-based routing.
| Package | Purpose |
|---|---|
next |
Full-stack React framework with App Router, Server Components, and Turbopack |
react-hook-form |
Performant, flexible form handling with minimal re-renders |
zod |
TypeScript-first schema validation for forms and API data |
@tanstack/react-query |
Powerful server state management, caching, and synchronization |
next-intl |
Complete internationalization with locale routing and translations |
next-themes |
Theme management for dark/light mode with system preference support |
radix-ui |
Accessible, composable UI primitives |
lucide-react |
Comprehensive, customizable icon library |
sonner |
Elegant toast notifications |
emoji-picker-react |
Feature-rich emoji picker component |
date-fns |
Lightweight date utility library |
@vercel/analytics |
Web analytics for performance monitoring |
Built with β€οΈ using Next.js, React, and TypeScript
