Skip to content
Sanikaa205Public

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

InstaVibe - Instagram Clone with YouTube Music Integration

A full-stack social media application built with React, Node.js, and MongoDB. InstaVibe allows users to create posts, interact through likes and comments, search for other users, and integrate music from YouTube into their posts.

Project Overview

InstaVibe is a feature-rich Instagram clone that combines modern social media functionality with integrated music capabilities. Users can upload photos, add captions and music, interact with other users through likes and comments, and explore content through a clean, intuitive interface.

Technology Stack

Backend

  • Node.js with Express.js web framework
  • MongoDB database for data persistence
  • Cloudinary for image storage and management
  • YouTube Data API v3 for music search functionality
  • dotenv for environment variable management

Frontend

  • React 19.1.1 with Vite 7.1.2 build tool
  • Axios for HTTP client requests
  • React Icons for UI components
  • CSS Variables for theming and styling
  • YouTube IFrame API for music playback

Database

  • MongoDB 6.18.0 local instance
  • Document-based NoSQL structure
  • Backward compatible schema design

Project Structure

InstaVibe/
├── backend/
│   ├── index.js              # Express server with all API endpoints
│   ├── package.json          # Backend dependencies
│   ├── .env                  # Environment variables (YouTube API key)
│   ├── API_DOCUMENTATION.md  # Complete API reference
│   ├── TEST_REPORT.md        # Testing results and validation
│   └── uploads/              # Local file storage directory
│
├── frontend/
│   └── my-app/
│       ├── src/
│       │   ├── App.jsx                      # Main application component
│       │   ├── main.jsx                     # React entry point
│       │   ├── App.css                      # Global styling
│       │   ├── index.css                    # Base styles
│       │   │
│       │   ├── components/
│       │   │   ├── BottomNavbar.jsx         # Navigation bar
│       │   │   ├── BottomNavbar.css         # Navigation styling
│       │   │   ├── CreatePost.jsx           # Post creation with music search
│       │   │   ├── PostCard.jsx             # Individual post display
│       │   │   ├── PostCard.css             # Post card styling
│       │   │   ├── PostModal.jsx            # Full post view with player
│       │   │   ├── PostModal.css            # Modal styling
│       │   │   ├── MusicPlayer.jsx          # YouTube audio player
│       │   │   ├── MusicStyles.css          # Player styling
│       │   │   ├── SearchUser.jsx           # User search functionality
│       │   │   ├── ShowPost.jsx             # Post feed display
│       │   │   ├── Click.jsx                # Camera capture
│       │   │   ├── Click.css                # Camera styling
│       │   │   ├── Styles.css               # Component styles
│       │   │
│       │   └── assets/                      # Image and media assets
│       │
│       ├── public/                          # Static assets
│       ├── package.json                     # Frontend dependencies
│       ├── vite.config.js                   # Vite configuration
│       ├── eslint.config.js                 # ESLint configuration
│       └── index.html                       # HTML entry point
│
└── README.md                                # This file

Installation and Setup

Prerequisites

  • Node.js v14 or higher
  • npm or yarn package manager
  • MongoDB running locally or connection string configured
  • YouTube Data API key

Backend Setup

  1. Navigate to backend directory:
cd backend
  1. Install dependencies:
npm install
  1. Create .env file in backend directory:
YOUTUBE_API_KEY=your_youtube_api_key_here
  1. Start the backend server:
npm start

Backend will run on http://localhost:3000

Frontend Setup

  1. Navigate to frontend directory:
cd frontend/my-app
  1. Install dependencies:
npm install
  1. Start development server:
npm run dev

Frontend will run on http://localhost:5173

Core Features

Post Management

  • Upload images with captions and optional music
  • Delete posts from the feed
  • Display all posts in reverse chronological order
  • Music metadata storage and retrieval

Like System

  • Like and unlike posts
  • View total like count on posts
  • Prevent duplicate likes from same user
  • Real-time like counter updates

Comment System

  • Add comments to posts with timestamps
  • Retrieve all comments for a post
  • Display comment count
  • Proper data validation for comment text

Music Integration

  • Search YouTube for songs via dedicated API endpoint
  • Select and attach music to posts during creation
  • Audio-only playback using YouTube IFrame API
  • Music player with play/pause and mute controls
  • Display currently playing track information
  • No video display (audio-only interface)

User Features

  • User search functionality
  • View user profiles with statistics
  • Total posts count per user
  • Total likes received aggregation
  • User-specific post filtering

UI/UX Features

  • Bottom navigation bar for main sections
  • Dark mode and light mode theme toggle
  • Responsive design for various screen sizes
  • Camera capture for direct photo upload
  • Post creation modal dialog
  • Full post modal view
  • Real-time post feed updates
  • Smooth theme transitions with localStorage

Content Search

  • YouTube music search with 350ms debounce
  • Search results with thumbnails and channel information
  • Efficient API request management
  • Error handling for failed searches

API Endpoints

Post Management

  • POST /upload - Create new post with image and metadata
  • GET /files - Retrieve all posts or filter by username
  • DELETE /delete/:id - Remove post and associated image

Like System

  • POST /like/:postId - Add like to post
  • POST /unlike/:postId - Remove like from post

Comment System

  • POST /comment/:postId - Add comment to post
  • GET /comments/:postId - Retrieve all comments for post

User Profile

  • GET /profile/:username - Get user profile with statistics

Music Integration

  • GET /search-youtube - Search YouTube for music

Database Schema

Post Document

{
  _id: ObjectId,
  username: String,
  caption: String,
  file_url: String,
  file_name: String,
  upload_time: Date,
  youtubeVideoId: String (optional),
  songTitle: String (optional),
  likes: [
    {
      username: String
    }
  ],
  comments: [
    {
      username: String,
      text: String,
      createdAt: Date
    }
  ]
}

Development Guidelines

Code Quality

  • Clean, readable code with proper comments
  • Consistent naming conventions
  • Error handling on all API endpoints
  • Input validation for user data

Backward Compatibility

  • All new features are optional fields
  • Existing posts work without new fields
  • No breaking changes to existing APIs
  • Graceful fallbacks for missing data

Performance Considerations

  • Efficient MongoDB queries with proper indexing
  • Debounced search to reduce API calls
  • Lazy loading of posts
  • Optimized image delivery through Cloudinary

Testing

All APIs have been tested and verified to work correctly. See TEST_REPORT.md for detailed testing results including:

  • Like/Unlike endpoints
  • Comment add and retrieve endpoints
  • Profile retrieval with statistics
  • Error handling validation
  • Data persistence verification

Environment Variables

Backend (.env)

YOUTUBE_API_KEY=your_youtube_api_key_here

Dependencies

Backend

  • express: Web framework
  • mongodb: Database driver
  • multer: File upload handling
  • multer-storage-cloudinary: Image storage
  • cloudinary: Image management service
  • cors: Cross-origin resource sharing
  • dotenv: Environment variable management

Frontend

  • react: UI library
  • axios: HTTP client
  • react-icons: Icon components
  • vite: Build tool and dev server

API Response Format

All API endpoints return JSON with consistent structure:

Success Response

{
  "success": true,
  "data": {}
}

Error Response

{
  "success": false,
  "error": "Error message"
}

Security Notes

  • API keys stored in .env file and not committed to repository
  • CORS configured for localhost development
  • Input validation on all endpoints
  • MongoDB injection prevention through driver
  • Secure image storage via Cloudinary

Browser Compatibility

  • Chrome/Chromium (latest)
  • Firefox (latest)
  • Safari (latest)
  • Edge (latest)

Troubleshooting

Backend Connection Issues

  • Verify MongoDB is running
  • Check port 3000 is available
  • Confirm .env file exists with API key

Frontend Issues

  • Clear browser cache and localStorage
  • Restart dev server with npm run dev
  • Check Node.js version compatibility

API Errors

  • Verify backend server is running
  • Check network tab for CORS issues
  • Review API_DOCUMENTATION.md for endpoint details

Performance Metrics

  • Backend response time: < 200ms for typical requests
  • Frontend initial load: < 2 seconds
  • Music search debounce: 350ms
  • Database query optimization: Indexed fields for fast retrieval

Future Enhancements

Potential features for future development:

  • User authentication and authorization
  • Follow/Unfollow system
  • Direct messaging
  • Post editing capabilities
  • Advanced search filters
  • Notifications system
  • Image filtering and editing

Contributing

When contributing to this project:

  • Maintain code style consistency
  • Test all changes thoroughly
  • Document new features
  • Update API documentation
  • Ensure backward compatibility

License

This project is created for educational purposes.

Support

For issues or questions, please review:

  • API_DOCUMENTATION.md for endpoint details
  • TEST_REPORT.md for testing information
  • Check console logs for error messages
  • Verify all prerequisites are installed

Deployment Notes

Before deploying to production:

  • Update MongoDB connection string
  • Configure proper environment variables
  • Set up HTTPS/SSL certificates
  • Configure CORS for production domain
  • Set up proper error logging
  • Implement rate limiting
  • Configure backup strategy

Project Status: Active Development
Last Updated: April 3, 2026
Version: 2.0.0

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages