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.
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.
- 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
- 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
- MongoDB 6.18.0 local instance
- Document-based NoSQL structure
- Backward compatible schema design
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
- Node.js v14 or higher
- npm or yarn package manager
- MongoDB running locally or connection string configured
- YouTube Data API key
- Navigate to backend directory:
cd backend- Install dependencies:
npm install- Create .env file in backend directory:
YOUTUBE_API_KEY=your_youtube_api_key_here
- Start the backend server:
npm startBackend will run on http://localhost:3000
- Navigate to frontend directory:
cd frontend/my-app- Install dependencies:
npm install- Start development server:
npm run devFrontend will run on http://localhost:5173
- 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 and unlike posts
- View total like count on posts
- Prevent duplicate likes from same user
- Real-time like counter updates
- Add comments to posts with timestamps
- Retrieve all comments for a post
- Display comment count
- Proper data validation for comment text
- 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 search functionality
- View user profiles with statistics
- Total posts count per user
- Total likes received aggregation
- User-specific post filtering
- 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
- YouTube music search with 350ms debounce
- Search results with thumbnails and channel information
- Efficient API request management
- Error handling for failed searches
- 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
- POST /like/:postId - Add like to post
- POST /unlike/:postId - Remove like from post
- POST /comment/:postId - Add comment to post
- GET /comments/:postId - Retrieve all comments for post
- GET /profile/:username - Get user profile with statistics
- GET /search-youtube - Search YouTube for music
{
_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
}
]
}- Clean, readable code with proper comments
- Consistent naming conventions
- Error handling on all API endpoints
- Input validation for user data
- All new features are optional fields
- Existing posts work without new fields
- No breaking changes to existing APIs
- Graceful fallbacks for missing data
- Efficient MongoDB queries with proper indexing
- Debounced search to reduce API calls
- Lazy loading of posts
- Optimized image delivery through Cloudinary
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
YOUTUBE_API_KEY=your_youtube_api_key_here
- 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
- react: UI library
- axios: HTTP client
- react-icons: Icon components
- vite: Build tool and dev server
All API endpoints return JSON with consistent structure:
{
"success": true,
"data": {}
}{
"success": false,
"error": "Error message"
}- 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
- Chrome/Chromium (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
- Verify MongoDB is running
- Check port 3000 is available
- Confirm .env file exists with API key
- Clear browser cache and localStorage
- Restart dev server with npm run dev
- Check Node.js version compatibility
- Verify backend server is running
- Check network tab for CORS issues
- Review API_DOCUMENTATION.md for endpoint details
- Backend response time: < 200ms for typical requests
- Frontend initial load: < 2 seconds
- Music search debounce: 350ms
- Database query optimization: Indexed fields for fast retrieval
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
When contributing to this project:
- Maintain code style consistency
- Test all changes thoroughly
- Document new features
- Update API documentation
- Ensure backward compatibility
This project is created for educational purposes.
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
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