A modern social media platform with AI-powered recommendations and real-time messaging capabilities.
- Email/Password Authentication with JWT tokens
- Google OAuth 2.0 integration for seamless sign-in
- Protected routes with middleware authentication
- Create Posts with multiple image uploads (via Cloudinary)
- Public/Private visibility settings
- Like/Unlike posts with real-time updates
- Delete posts with cascade deletion of associated data
- Category-based organization (Travel, Food, Fashion, Technology, Lifestyle)
- Smart Recommendations: AI analyzes your liked posts and recommends similar content using Google Gemini AI
- AI Chat Assistant: Interactive AI chatbot to answer questions and provide assistance
- Intelligent Category Matching: Machine learning-based content discovery
- Personal Chat with Socket.IO real-time communication
- Chat History with message persistence
- User Discovery to find and connect with new users
- Start Chat modal for quick conversations
- Profile Page with user's post collection
- User Discovery modal to browse other users
- Like tracking across posts
- Responsive Design with React Bootstrap
- Smooth Animations and transitions
- Dark Mode Ready interface
- Mobile-Friendly layout
- Node.js v16+
- PostgreSQL 12+
- npm or yarn
- Cloudinary account
- Google Cloud Console project (for OAuth)
- Google AI Studio API key (for Gemini)
- Clone the repository
git clone https://github.com/Joshua080324/Dummy-Instagram.git
cd Dummy-Instagram- Install backend dependencies
npm install- Install frontend dependencies
cd client
npm install
cd ..- Setup environment variables
Create .env file in root directory:
# Database
DATABASE_URL=postgresql://username:password@localhost:5432/dummy_instagram
# JWT Secret
JWT_SECRET=your_jwt_secret_key_here
# Cloudinary
CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name
CLOUDINARY_API_KEY=your_cloudinary_api_key
CLOUDINARY_API_SECRET=your_cloudinary_api_secret
# Google OAuth
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
# Google Gemini AI
GEMINI_API_KEY=your_gemini_api_key
# Server
PORT=3000Create client/.env file:
VITE_BASE_URL=http://localhost:3000
VITE_GOOGLE_CLIENT_ID=your_google_client_id- Setup Database
# Create database
npx sequelize-cli db:create
# Run migrations
npm run migrate
# Seed sample data
npm run seed- Run the application
Backend:
npm run devFrontend (in new terminal):
cd client
npm run dev- Access the application
- Frontend:
http://localhost:5173 - Backend API:
http://localhost:3000
Use these pre-seeded accounts for testing:
| Password | |
|---|---|
| john@example.com | password123 |
| jane@example.com | password123 |
| mike@example.com | password123 |
| sarah@example.com | password123 |
| alex@example.com | password123 |
graph TD
A[Landing Page] -->|New User| B[Register Page]
A -->|Existing User| C[Login Page]
B -->|Email/Password| D[Create Account]
B -->|Google OAuth| E[Google Sign-In]
C -->|Email/Password| F[Verify Credentials]
C -->|Google OAuth| E
D --> G[Generate JWT Token]
E --> G
F --> G
G --> H[Store Token in localStorage]
H --> I[Redirect to Home]
Steps:
- User visits the application
- Choose between Register or Login
- Option to use Email/Password or Google OAuth
- System validates credentials and generates JWT token
- Token stored in browser's localStorage
- User redirected to Home feed
graph TD
A[Home Page] --> B{Authenticated?}
B -->|No| C[Redirect to Login]
B -->|Yes| D[Load Posts]
D --> E[Show All Posts Tab]
D --> F[AI Recommended Posts Tab]
F --> G[Analyze User's Liked Posts]
G --> H[AI Gemini Processing]
H --> I[Return Recommended Posts]
E --> J[Display Posts]
I --> J
J --> K[User Interactions]
K --> L[Like/Unlike Post]
K --> M[View Profile]
K --> N[Start Chat]
K --> O[Delete Own Post]
Steps:
- User lands on Home Page
- System checks authentication status
- Loads all public posts in "All Posts" tab
- "AI Recommended" tab analyzes user's like history
- Google Gemini AI processes liked categories
- Returns personalized recommendations
- User can interact: Like, Comment, Chat, Delete
graph TD
A[Click Create Post Button] --> B[Open Create Post Modal]
B --> C[Fill Post Details]
C --> D[Select Category]
C --> E[Upload Images]
C --> F[Set Privacy]
E --> G[Upload to Cloudinary]
G --> H[Get Image URLs]
F --> I{Privacy Setting?}
I -->|Public| J[Visible to All]
I -->|Private| K[Visible to Owner Only]
H --> L[Submit Post to Server]
L --> M[Save to Database]
M --> N[Update Redux Store]
N --> O[Show in Feed]
O --> P[Success Notification]
Steps:
- Click "+" icon in navigation
- Create Post Modal appears
- Fill in post details:
- Content/Caption
- Select category (Travel, Food, Fashion, etc.)
- Upload up to 5 images
- Choose visibility (Public/Private)
- Images uploaded to Cloudinary CDN
- Post data saved to database
- Redux store updated
- New post appears in feed instantly
graph TD
A[User Likes Posts] --> B[Track Liked Post Categories]
B --> C{Minimum 3 Likes?}
C -->|No| D[Show Recent Public Posts]
C -->|Yes| E[Analyze Category Distribution]
E --> F[Prepare Prompt for Gemini]
F --> G[Google Gemini AI API]
G --> H[AI Returns Best Category Match]
H --> I[Query Posts by Category]
I --> J[Filter User's Own Posts]
J --> K[Order by Recent]
K --> L[Return Top 20 Recommendations]
L --> M[Display in Recommended Tab]
Steps:
- System tracks all posts liked by user
- Counts likes per category (Travel: 5, Food: 3, Fashion: 1)
- If user has liked at least 3 posts, activate AI
- Send category statistics to Google Gemini AI
- AI analyzes patterns and returns best matching category
- Query database for posts in that category
- Exclude user's own posts
- Display personalized recommendations
graph TD
A[Click Messages Icon] --> B[Messages Page]
B --> C[Load Chat List]
C --> D{Has Chats?}
D -->|No| E[Show Empty State]
D -->|Yes| F[Display Chat List]
E --> G[Click Start New Chat]
F --> H[Select Chat]
G --> I[User Discovery Modal]
I --> J[Select User]
J --> K[Create/Open Chat]
H --> K
K --> L[Load Message History]
L --> M[Socket.IO Connection]
M --> N[Real-Time Updates]
N --> O[Send/Receive Messages]
Steps:
- Navigate to Messages page
- View list of existing conversations
- Start New Chat via User Discovery modal
- Select a user to chat with
- System creates chat room (or opens existing)
- Load message history from database
- Socket.IO establishes WebSocket connection
- Messages sent/received in real-time
- Chat history persisted to database
graph TD
A[Click AI Chat Icon] --> B[AI Chat Modal Opens]
B --> C[User Types Message]
C --> D[Send to Gemini AI]
D --> E[AI Processing]
E --> F[Clean & Format Response]
F --> G[Display AI Response]
G --> H{Continue Chat?}
H -->|Yes| C
H -->|No| I[Close Modal]
Steps:
- Click "AI Chat" icon (Stars icon)
- AI Chat Modal appears
- Type your question or message
- Message sent to Google Gemini AI API
- AI processes and generates response
- Response cleaned (remove markdown, formatting)
- Display AI answer in chat interface
- Continue conversation or close modal
graph TD
A[View User Profile] --> B{Own Profile?}
B -->|Yes| C[Show All Posts + Private]
B -->|No| D[Show Public Posts Only]
C --> E[Can Delete Posts]
D --> F[Can Like Posts]
D --> G[Can Start Chat]
F --> H[Update Like Count]
G --> I[Open Chat with User]
E --> J[Confirm Delete]
J --> K[Remove from Database]
K --> L[Update Redux Store]
L --> M[Refresh Profile]
Steps:
- Click on username or profile picture
- System checks: Is this your profile?
- Own Profile: See all posts (public + private), can delete
- Other Profile: See public posts only, can like/chat
- Delete Post: Confirmation dialog → Remove from DB → Update UI
- Start Chat: Create new conversation with user
- All changes update Redux store for instant UI refresh
┌─────────────────────────────────────────────────────────────┐
│ CLIENT SIDE │
├─────────────────────────────────────────────────────────────┤
│ React.js + Redux Toolkit + React Router + Bootstrap │
│ ├── Pages (Login, Register, Home, Profile, Messages) │
│ ├── Components (PostCard, Modals, Navigation) │
│ ├── Redux Store (Auth, Posts, Likes Slices) │
│ └── HTTP Client (Axios) │
└─────────────────┬───────────────────────────────────────────┘
│
│ REST API + Socket.IO
│
┌─────────────────▼───────────────────────────────────────────┐
│ SERVER SIDE │
├─────────────────────────────────────────────────────────────┤
│ Node.js + Express.js + Socket.IO │
│ ├── Routes (Users, Posts, Chat, AI) │
│ ├── Controllers (Business Logic) │
│ ├── Middleware (Authentication, Error Handling) │
│ └── Helpers (JWT, Cloudinary, AI) │
└─────────────────┬───────────────────────────────────────────┘
│
│ Sequelize ORM
│
┌─────────────────▼───────────────────────────────────────────┐
│ DATABASE LAYER │
├─────────────────────────────────────────────────────────────┤
│ PostgreSQL Database │
│ ├── Users Table │
│ ├── Posts Table │
│ ├── Likes Table (Junction) │
│ ├── Categories Table │
│ ├── Images Table │
│ ├── Chats Table │
│ └── Messages Table │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ EXTERNAL SERVICES │
├─────────────────────────────────────────────────────────────┤
│ 🤖 Google Gemini AI → AI Recommendations & Chat │
│ ☁️ Cloudinary → Image Storage & CDN │
│ 🔐 Google OAuth → Authentication │
└─────────────────────────────────────────────────────────────┘
The project includes comprehensive test coverage (80%+):
# Run all tests
npm test
# Run tests with coverage report
npm run test:coverage
# Run tests in watch mode
npm run test:watchTest Coverage Includes:
- Unit tests for controllers
- Integration tests for routes
- Middleware tests
- Helper function tests
- Database model tests
Comprehensive API documentation available in API_DOCUMENTATION.md
Key Endpoints:
POST /users/register- Create new accountPOST /users/login- Email/password loginPOST /users/auth/google- Google OAuth login
GET /posts- Get all postsPOST /posts- Create new postDELETE /posts/:id- Delete post
POST /posts/:id/like- Like/unlike post
POST /chat- Create/get chatGET /chat- Get all user's chatsGET /chat/:id- Get chat detailsPOST /chat/:id/messages- Send message
GET /ai/recommendations- Get AI-powered recommendationsPOST /ai/chat- Chat with AI assistant
- Runtime: Node.js v16+
- Framework: Express.js
- Database: PostgreSQL with Sequelize ORM
- Authentication: JWT + Google OAuth 2.0
- Real-time: Socket.IO
- File Upload: Multer + Cloudinary
- AI: Google Generative AI (Gemini)
- Testing: Jest
- Framework: React.js 18
- State Management: Redux Toolkit
- Routing: React Router v6
- UI Library: React Bootstrap
- HTTP Client: Axios
- OAuth: @react-oauth/google
- Notifications: SweetAlert2
- Build Tool: Vite
- Version Control: Git & GitHub
- Environment: dotenv
- API Testing: Thunder Client / Postman
- Code Quality: ESLint
- Database Migrations: Sequelize CLI
Dummy-Instagram/
├── client/ # React frontend
│ ├── src/
│ │ ├── components/ # Reusable components
│ │ ├── pages/ # Page components
│ │ ├── store/ # Redux store & slices
│ │ ├── helpers/ # Utility functions
│ │ └── assets/ # Static assets
│ ├── public/
│ └── package.json
├── controllers/ # Request handlers
├── models/ # Sequelize models
├── routes/ # API routes
├── helpers/ # Backend utilities
├── middleware/ # Express middleware
├── migrations/ # Database migrations
├── seeders/ # Database seeders
├── __tests__/ # Test files
├── config/ # Configuration files
├── data/ # Sample data
├── .env # Environment variables
├── app.js # Express app setup
├── package.json
└── README.md
- ✅ JWT token authentication
- ✅ Password hashing with bcryptjs
- ✅ Protected routes with middleware
- ✅ Environment variable protection
- ✅ SQL injection prevention (Sequelize ORM)
- ✅ XSS protection
- ✅ CORS configuration
- Story/Reels feature
- Comment system on posts
- Hashtag support
- Advanced search and filters
- User follow/following system
- Push notifications
- Email verification
- Password reset functionality
- Post editing capability
- Image filters and editing tools
Joshua
- GitHub: @Joshua080324
- Repository: Dummy-Instagram
This project is for educational purposes as part of Individual Project Phase 2.
- Google Gemini AI for intelligent recommendations
- Cloudinary for image hosting
- React & Redux community
- Node.js & Express.js ecosystem
⭐ If you like this project, please give it a star! ⭐
Built with ❤️ using React, Node.js, and AI
Built with ❤️ using React, Node.js, and AI