Skip to content

Kerolos2000/social-app-next

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

93 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Social App Logo

Social App

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.

Next.js React TypeScript Tailwind CSS


πŸ“‘ Table of Contents


✨ Features

πŸ” Authentication

  • 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.

πŸ“° Feed & Posts

  • 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, or Saved posts.
  • 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

πŸ’¬ Comments & Replies

  • 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.

πŸ‘€ Profile

  • 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.

πŸ‘₯ Social & Users

  • 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.

πŸ”” Notifications

  • 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.

βš™οΈ Settings

  • Change Password β€” Secure password change form with validation.
  • Theme Toggle β€” Switch between Dark and Light mode.
  • Language Switch β€” Switch between English and Arabic.

🌍 Internationalization

  • English (en) β€” Full English language support.
  • Arabic (ar) β€” Full Arabic language support with RTL layout.
  • Locale-Based Routing β€” URL-based locale prefix (/en/..., /ar/...).

🎨 UI/UX

  • 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 sonner toast 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.

πŸ› οΈ Tech Stack

Core Framework

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

State & Data Management

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

UI Components & Styling

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

Internationalization & Theming

Package Description
next-intl Full i18n support with locale routing
next-themes Dark/Light theme management

Media & Interaction

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

Developer Tools

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

πŸ“ Project Structure

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

πŸš€ Getting Started

Prerequisites

Make sure you have the following installed:

  • Node.js >= 18.x
  • Yarn (recommended) or npm

1. Clone the Repository

git clone https://github.com/Kerolos2000/social-app-next.git
cd social-app-next

2. Install Dependencies

yarn install
# or
npm install

3. Run the Development Server

yarn dev
# or
npm run dev

This will start the app with Turbopack for fast development. The .next cache is automatically cleaned before each dev start.

4. Open in Browser

Navigate to http://localhost:3000 to view the application.

The app will automatically redirect to the default locale (/en/login or /en/feed based on auth status).


πŸ“œ Available Scripts

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

🌍 Internationalization (i18n)

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.ts and src/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

🎨 Theming

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

πŸ” Authentication & Middleware

Authentication Flow

  1. Users sign up or log in via the auth pages.
  2. A JWT token is stored as a cookie (token).
  3. The token is automatically attached to all API requests via clientApiFetch.
  4. User data is retrieved from the token using js-cookie.

Middleware (proxy.ts)

The middleware handles:

  • Protected Routes: Redirects unauthenticated users to /login (e.g., /feed).
  • Guest Routes: Redirects authenticated users away from /login and /signup.
  • Locale Detection: Applies the correct locale from the URL.
  • i18n Middleware: Integrates next-intl middleware for locale-based routing.

πŸ“¦ Key Packages

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

About

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.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors