A modern social media application built with React, featuring a clean and responsive design with real-time interactions.
- Production: SocialApp on GitHub Pages
- 🔐 Authentication System - User login and registration with form validation
- 📱 Responsive Design - Works seamlessly on all devices
- 🏠 Feed Page - View and interact with posts
- 👤 Profile Management - User profile pages
- 📝 Post Details - Detailed view of individual posts
- 🎨 Modern UI - Built with HeroUI and Tailwind CSS
- ⚡ Fast Performance - Powered by Vite
- 🍞 Toast Notifications - Beautiful user feedback with react-toastify
- ✅ Form Validation - Real-time validation with Zod and react-hook-form
- 🎭 Glass Morphism - Modern design with backdrop blur effects
- Frontend Framework: React 19
- Build Tool: Vite
- Routing: React Router DOM
- UI Components: HeroUI
- Styling: Tailwind CSS
- Animations: Framer Motion
- HTTP Client: Axios
- Icons: FontAwesome
- Form Management: React Hook Form
- Validation: Zod
- Notifications: React Toastify
- Environment: Vite Environment Variables
Make sure you have Node.js installed on your machine:
- Node.js (version 16 or higher)
- npm or yarn
-
Clone the repository
git clone https://github.com/abdelfattahelnaggar/SocialApp.git cd SocialApp -
Install dependencies
npm install
-
Set up environment variables
# Create .local.env file in the root directory echo "VITE_BASE_URL=https://linked-posts.routemisr.com" > .local.env
-
Start the development server
npm run dev
-
Open your browser
Navigate to
http://localhost:5173to view the application
src/
├── components/ # Reusable UI components
│ └── Navbar.jsx # Navigation component
├── Layouts/ # Layout components
│ ├── AuthLayout.jsx # Layout for authentication pages
│ └── MainLayout.jsx # Main application layout
├── pages/ # Page components
│ ├── FeedPage.jsx # Main feed page
│ ├── LoginPage.jsx # User login page
│ ├── RegisterPage.jsx # User registration page with validation
│ ├── ProfilePage.jsx # User profile page
│ ├── PostDetailsPage.jsx # Individual post details
│ └── NotFoundPage.jsx # 404 error page
├── Services/ # API services
│ └── authServices.js # Authentication API calls
├── Schemas/ # Validation schemas
│ └── registerSchema.js # Zod validation schema
├── assets/ # Static assets
├── App.jsx # Main application component
├── main.jsx # Application entry point
└── index.css # Global styles
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run lint- Run ESLint for code quality
The application uses React Router with the following routes:
/- Feed page (main application)/login- User login/register- User registration/profile- User profile/post-details- Post details view
This project uses HeroUI for consistent and modern UI components along with Tailwind CSS for styling. The design features:
- Glass Morphism Effects - Semi-transparent backgrounds with backdrop blur
- Gradient Backgrounds - Beautiful blue-to-indigo gradients
- Form Validation - Real-time validation with error states
- Toast Notifications - Interactive feedback with react-toastify
- Responsive Design - Mobile-first approach with smooth animations
- Modern Typography - Gradient text effects and clean fonts
The application is built with mobile-first approach and works seamlessly across:
- 📱 Mobile devices
- 📟 Tablets
- 💻 Desktop computers
The project is configured with:
- Vite for fast development and building
- ESLint for code quality and consistency
- Tailwind CSS for utility-first styling
- Environment Variables for API configuration
- Zod for runtime type validation
- React Hook Form for efficient form handling
The application integrates with a backend API:
- Base URL:
https://linked-posts.routemisr.com - Authentication: User registration via
/users/signupand sign-in via/users/signin - Posts: Create, update, delete, and fetch posts
- Comments: Create, update, and delete comments
- Error Handling: Comprehensive error handling with user-friendly messages
- Loading States: Visual feedback during API calls
-
Auth state sync (no reload after login):
- Login now updates both
AuthContextandUserDataContextimmediately (setIsLoggedIn,setToken). UserDataContextfetches the logged user whenever the token changes and clears state on 401.- Token changes from other tabs are synced via the
storageevent.
- Login now updates both
-
Toast notifications:
- There must be exactly one
ToastContainerinsrc/main.jsx. - All pages/components should only import and use
toast(no extra containers).
- There must be exactly one
-
Accessibility improvements:
- Use
textValueonly on HeroUIDropdownItemwhen contents are non-plain text. - Do not pass
textValueto DOM elements likep,button, orModalHeader.
- Use
-
Update Post modal UX:
- Textarea pre-fills with original content on open.
- Modal is scrollable, constrained to viewport height, and tall images are capped.
- Image removal is currently not supported by the backend; users can replace the image instead. The UI warns users accordingly.
-
Reusable modals and dropdown:
DeleteModalComponentandUpdateModalComponentare generic and reused across posts and details pages.DropDownComponentwires edit/delete actions. Ensure you passhandleUpdatePostfor edit andonOpenfor delete.
-
Comments handling:
- Temporary client-side guard for deletion: users can delete their own comments on their own posts. Attempts outside this rule show a clear error.
- Inline editing uses the existing input field with character counter and Enter-to-save support.
Create a .env (or .local.env) file in the project root with:
VITE_BASE_URL=https://linked-posts.routemisr.comRestart the dev server after changing environment variables.
-
Toasts not showing:
- Ensure there is only one
ToastContainer(insrc/main.jsx). - Components should import
{ toast }fromreact-toastifyand calltoast.success/error/...directly.
- Ensure there is only one
-
Ellipsis button missing after login:
- Ensure login sets both
setToken(res.token)andsetIsLoggedIn(true). - Ensure logout clears auth state: remove token from
localStorageand callsetToken(null).
- Ensure login sets both
- The backend currently does not support removing a post image via the update endpoint. The UI provides a warning and encourages replacing the image instead.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- React - The web framework used
- HeroUI - UI component library
- Tailwind CSS - For styling
- Vite - Build tool and development server
- React Hook Form - Form management
- Zod - Schema validation
- React Toastify - Toast notifications
- Axios - HTTP client
Made with ❤️ by [Abdelfattah Elnaggar]