- Node.js (v14+)
- PostgreSQL database
- npm or yarn
-
Clone and Install Dependencies
# Install client dependencies cd client npm install # Install API dependencies cd ../api npm install
-
Configure Database
cd api cp .env.example .env # Edit .env with your database credentials # Create database and run schema psql -U your_user -d your_database -f schema.sql
-
Start Development Servers
# Terminal 1 - Start API (from api directory) npm run dev # Terminal 2 - Start Client (from client directory) npm start
-
Access the Application
- Frontend: http://localhost:3000
- API: http://localhost:8800
📖 For detailed setup instructions, see SETUP.md
A full-stack social media application inspired by Facebook's UI, built with React, Node.js, Express, and PostgreSQL.
This is a feature-rich social media platform where users can:
- Register and authenticate
- Create and share posts with images
- Like and comment on posts
- Follow/unfollow other users
- View user profiles with cover and profile pictures
- Toggle between light and dark themes
- Update their profile information
- Framework: React 18
- Styling: SCSS with theme system
- State Management: React Context API (Auth, Dark Mode)
- Data Fetching: TanStack React Query
- HTTP Client: Axios
- Icons: Material-UI Icons
- Routing: React Router v6
- Runtime: Node.js
- Framework: Express.js
- Database: PostgreSQL
- Authentication: JWT (JSON Web Tokens)
- Password Hashing: bcryptjs
- File Upload: Multer
- Utilities: Moment.js for timestamps
facebook-UI-clone-miner/
├── client/ # React Frontend
│ ├── src/
│ │ ├── components/ # Reusable components
│ │ │ ├── navbar/
│ │ │ ├── leftBar/
│ │ │ ├── rightBar/
│ │ │ ├── post/
│ │ │ ├── posts/
│ │ │ ├── share/
│ │ │ ├── stories/
│ │ │ ├── comments/
│ │ │ └── update/
│ │ ├── pages/ # Page components
│ │ │ ├── home/
│ │ │ ├── login/
│ │ │ ├── register/
│ │ │ └── profile/
│ │ ├── context/ # React Context (Auth, DarkMode)
│ │ ├── style.scss # Global theme variables
│ │ ├── axios.js # API configuration
│ │ └── App.js # Main app component
│ └── package.json
├── api/ # Express Backend
│ ├── controllers/ # Business logic
│ │ ├── auth.js
│ │ ├── user.js
│ │ ├── post.js
│ │ ├── comment.js
│ │ ├── like.js
│ │ ├── relationship.js
│ │ └── story.js
│ ├── routes/ # API endpoints
│ ├── db.js # Database connection
│ ├── index.js # Express server
│ ├── package.json
│ └── .env # Environment variables
└── README.md
- Node.js (v14+)
- PostgreSQL
- npm or yarn
- Navigate to API directory:
cd api- Install dependencies:
npm install- Create
.envfile with database credentials:
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_HOST=localhost
DB_PORT=5432
DB_NAME=social_media_db- Start the server:
npm startServer runs on http://localhost:8800
- Navigate to client directory:
cd client- Install dependencies:
npm install- Start the development server:
npm startApp runs on http://localhost:3000
- User registration with validation
- Secure login with JWT
- Password hashing with bcryptjs
- Session persistence with cookies
- Create posts with image uploads
- Like/unlike posts
- Comment on posts
- Follow/unfollow users
- View user profiles
- Responsive design (mobile, tablet, desktop)
- Dark/Light theme toggle
- Profile picture and cover image updates
- Real-time post feeds
The app uses a SCSS theme mixin system with two themes:
Light Theme:
- Text: Black
- Background: White
- Accent: Dark Blue
Dark Theme:
- Text: Whitesmoke
- Background: #222
- Accent: White
Authentication:
POST /api/auth/register
POST /api/auth/login
POST /api/auth/logout
Users:
GET /api/users/find/:userId
PUT /api/users
Posts:
GET /api/posts
POST /api/posts
DELETE /api/posts/:id
Comments:
GET /api/comments
POST /api/comments
DELETE /api/comments/:id
Likes:
GET /api/likes
POST /api/likes
DELETE /api/likes
Relationships:
GET /api/relationships
POST /api/relationships
DELETE /api/relationships
Upload:
POST /api/upload
- react, react-dom
- react-router-dom
- @tanstack/react-query
- axios
- sass
- @mui/material, @mui/icons-material
- moment
- express
- pg (PostgreSQL)
- bcrypt, bcryptjs
- jsonwebtoken
- multer
- cors
- cookie-parser
- moment
- JWT-based authentication
- Password hashing with bcryptjs
- HTTP-only cookies
- CORS protection
- Protected routes
- Mobile-first approach
- Breakpoints:
- Mobile: max-width 480px
- Tablet: max-width 960px
- Desktop: 960px+
The project uses:
- Nodemon for auto-restarting backend
- React Scripts for frontend development
- SCSS for styling with mixins and variables
ISC License
Note: This is a clone project for educational purposes, inspired by Facebook's UI/UX design.