An interactive 3D word cloud generator that visualizes topics from news articles using React Three Fiber and FastAPI.
- 3D Interactive Visualization: Words float in 3D space with spherical distribution
- Article Analysis: Extracts and analyzes text from any news article URL
- Topic Modeling: Uses TF-IDF for keyword extraction and topic analysis
- Cyber-Void Design: Futuristic dark theme with neon accents
- Real-time Interaction: Drag to rotate, scroll to zoom, hover to highlight words
- Demo Mode: Pre-loaded demo word cloud on initial load
- React (TypeScript)
- React Three Fiber - 3D rendering with Three.js
- @react-three/drei - Useful helpers for R3F
- Framer Motion - UI animations
- Lucide React - Icons
- Axios - HTTP client
- FastAPI - Modern Python web framework
- Trafilatura - Article text extraction
- scikit-learn - TF-IDF vectorization
- NLTK - Natural language processing (stopwords)
- Motor - Async MongoDB driver
- Pydantic - Data validation
- macOS (setup script is designed for macOS)
- Python 3.8+
- Node.js 14+
- Yarn (will be installed automatically if missing)
-
Clone the repository
git clone <repository-url> cd 3D-Word-Cloud-Divya
-
Make setup script executable
chmod +x setup.sh
-
Run setup script
./setup.sh
The script will:
- Install all backend dependencies (Python packages)
- Install all frontend dependencies (Node packages)
- Download NLTK stopwords data
- Start both servers concurrently
-
Open your browser
http://localhost:3000
-
Navigate to backend directory
cd backend -
Create and activate virtual environment
python3 -m venv venv source venv/bin/activate -
Install dependencies
pip install -r requirements.txt
-
Download NLTK data
python3 -c "import nltk; nltk.download('stopwords')" -
Start backend server
uvicorn server:app --host 0.0.0.0 --port 8001 --reload
-
Open new terminal and navigate to frontend directory
cd frontend -
Install dependencies
yarn install --ignore-engines
-
Start frontend server
yarn start
-
Open browser
http://localhost:3000
-
Demo Mode: On initial load, a demo word cloud with tech-related terms is displayed
-
Analyze Article:
- Enter any article URL in the input field
- Click "ANALYZE" or press Enter
- Wait for the analysis to complete ("DECRYPTING...")
- The 3D word cloud will update with extracted topics
-
Sample Articles: Click on any sample article button to quickly load a pre-defined URL
-
Interact with 3D Scene:
- Drag: Rotate the word cloud
- Scroll: Zoom in/out
- Hover: Highlight individual words (scale up + glow effect)
-
Reset: Click "RESET" to return to demo mode
Analyze an article URL and return word cloud data.
Request Body:
{
"url": "https://example.com/article"
}Response:
{
"words": [
{"text": "Technology", "value": 95.5},
{"text": "Innovation", "value": 87.3},
...
],
"article_title": "Article Title Here"
}Health check endpoint.
Response:
{"message": "Hello World"}.
โโโ setup.sh # Setup script for macOS
โโโ README.md # This file
โโโ backend/
โ โโโ server.py # FastAPI application
โ โโโ requirements.txt # Python dependencies
โ โโโ .env # Environment variables
โโโ frontend/
โโโ src/
โ โโโ App.tsx # Main React component
โ โโโ App.css # Cyber-Void styles
โ โโโ index.js # React entry point
โ โโโ components/
โ โโโ canvas/
โ โโโ WordCloud3D.tsx # 3D word cloud container
โ โโโ Word3D.tsx # Individual 3D word component
โโโ package.json # Node dependencies
โโโ public/ # Static assets
- Fetch Article: Uses Trafilatura to download and extract article text from URL
- Clean Text: Removes special characters, digits, and converts to lowercase
- Remove Stopwords: Filters out common English words using NLTK
- TF-IDF Analysis: Applies TF-IDF vectorization to identify important terms
- Extracts top 50 features
- Supports unigrams and bigrams
- Filters by document frequency
- Normalize Scores: Scales word scores to 20-100 range for visualization
- Fallback: If TF-IDF fails, uses simple word frequency counting
- Spherical Distribution: Words are positioned using spherical coordinates
- Size Mapping: Word importance (value) maps to font size (0.3-1.5)
- Color Gradient: Words interpolate between purple and cyan based on importance
- Billboard Effect: Text always faces the camera for readability
- Hover Animation: Smooth scale-up and color change on hover
- Auto-rotation: Gentle continuous rotation of the word cloud
- Theme: Cyber-Void aesthetic with dark backgrounds
- Colors:
- Primary: Neon Cyan (#00f3ff)
- Secondary: Purple (#7000ff)
- Background: Pure Black (#050505)
- Typography:
- Headings: Orbitron (sci-fi)
- Body: Rajdhani
- Code: JetBrains Mono
- Effects: Glassmorphism, neon glow, glitch animations
-
Port 8001 already in use: Kill existing process or change port
lsof -ti:8001 | xargs kill -9
-
NLTK data not found: Manually download stopwords
python3 -c "import nltk; nltk.download('stopwords')"
-
Port 3000 already in use: Kill existing process or change port
lsof -ti:3000 | xargs kill -9
-
Module not found errors: Clear cache and reinstall
rm -rf node_modules yarn.lock yarn install --ignore-engines
- "Unable to fetch article": URL might be blocked, paywalled, or invalid
- "Could not extract meaningful text": Article might be too short or have unusual formatting
- Empty word cloud: Try a different article with more substantial content
- Sample URLs: Some sample URLs may not work due to paywalls or geo-restrictions
- CORS: Backend is configured to accept requests from any origin
- Performance: Optimized for <100 words. Larger datasets may impact performance
- Browser Support: Works best in modern browsers (Chrome, Firefox, Safari, Edge)
- Export word cloud as image or video
- Custom color schemes
- Multiple visualization layouts (sphere, cube, spiral)
- Real-time collaborative mode
- Sentiment analysis integration
- Language detection and multi-language support
MIT License - Feel free to use this project for learning and development.
Divya
Note: This project was created as part of a technical assessment to demonstrate full-stack development skills, 3D visualization capabilities, and NLP integration.