Skip to content

A comprehensive web application built with Flask that integrates multiple APIs into a beautiful, interactive dashboard.

License

Notifications You must be signed in to change notification settings

b5119/flask-api-dashboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

27 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ API Hub - Modern Multi-API Dashboard

A beautiful, modern web application built with Flask that aggregates data from multiple APIs into one stunning, interactive dashboard. No database required for basic features - everything runs in your browser!

Python Flask License Status


โœจ Key Features

๐ŸŒ Global & Local News Center

  • Global Trending News from 13 countries
  • Local News Detection - Auto-detect your location for city-specific news
  • 7 News Categories with emoji icons (Tech, Business, Sports, Health, etc.)
  • Real-time Search with smart filtering
  • Load More pagination for endless browsing

๐ŸŒค๏ธ Smart Weather Station

  • GPS Auto-Detection - One-click location detection
  • Save Unlimited Cities - Quick-access to your favorite locations
  • 5-Day Detailed Forecast - Temperature, humidity, wind, and more
  • Beautiful Weather Icons - Visual weather representation
  • Sunrise/Sunset Times - Plan your day better

๐Ÿ’ฐ Crypto Portfolio Tracker

  • Live Prices for 100+ cryptocurrencies
  • Portfolio Management - Track your crypto investments
  • Profit/Loss Calculations - See real-time gains and losses
  • Price Alerts - Get notified when prices hit your targets
  • Trending Coins - Discover what's hot in crypto
  • No API Key Required - Uses free CoinGecko API

๐Ÿ™ GitHub Repository Explorer

  • Search Millions of Repos - Find any public repository
  • Trending Repos - Daily, weekly, and monthly trends
  • Language Filtering - Browse by programming language
  • Detailed Analytics - Stars, forks, contributors, and more
  • Works Without Token - 60 requests/hour (perfect for personal use)

๐ŸŽจ Design Highlights

  • โœจ Modern Glassmorphism UI - Frosted-glass effect cards
  • ๐ŸŽจ Purple Gradient Background - Eye-catching aesthetic
  • ๐Ÿ’ซ Smooth Animations - Fade-in effects and hover transitions
  • ๐Ÿ“ฑ Fully Responsive - Perfect on mobile, tablet, and desktop
  • ๐ŸŽฏ Intuitive Navigation - Clean, easy-to-use interface
  • โšก Fast Loading - Optimized for performance

๐Ÿš€ Quick Start (5 Minutes)

1๏ธโƒฃ Clone & Setup

git clone https://github.com/b5119/flask-api-dashboard.git
cd flask-api-dashboard
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -r requirements.txt

2๏ธโƒฃ Get FREE API Keys

Takes 5 minutes total! See SETUP_GUIDE.md for detailed instructions.

3๏ธโƒฃ Create .env File

SECRET_KEY=your-super-secret-key-change-this
NEWSAPI_KEY=your_newsapi_key_here
OPENWEATHER_API_KEY=your_openweathermap_key_here
GITHUB_TOKEN=optional_github_token
FLASK_ENV=development

4๏ธโƒฃ Run!

python run.py

Visit: http://localhost:5000 ๐ŸŽ‰


๐Ÿ“ Project Structure

flask-api-dashboard/
โ”œโ”€โ”€ app/
โ”‚   โ”œโ”€โ”€ __init__.py                      # Application factory + extensions initialization
โ”‚   โ”œโ”€โ”€ models.py                        # SQLAlchemy models (User, Articles, CryptoHoldings, etc.)
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ api/                             # External API integrations (service layer)
โ”‚   โ”‚   โ”œโ”€โ”€ news_api.py                  # NewsAPI service wrapper
โ”‚   โ”‚   โ”œโ”€โ”€ weather_api.py               # OpenWeatherMap service wrapper
โ”‚   โ”‚   โ”œโ”€โ”€ crypto_api.py                # CoinGecko client utilities
โ”‚   โ”‚   โ”œโ”€โ”€ github_api.py                # GitHub REST API wrapper
โ”‚   โ”‚   โ”œโ”€โ”€ tracker.py                   # Crypto alerting + portfolio tracking tools
โ”‚   โ”‚   โ””โ”€โ”€ github_analytics_core.py     # GitHub repo analytics engine
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ routes/                          # Route handlers (controllers)
โ”‚   โ”‚   โ”œโ”€โ”€ main.py                      # Dashboard home view
โ”‚   โ”‚   โ”œโ”€โ”€ news.py                      # News routes
โ”‚   โ”‚   โ”œโ”€โ”€ weather.py                   # Weather routes
โ”‚   โ”‚   โ”œโ”€โ”€ crypto.py                    # Crypto tracking routes
โ”‚   โ”‚   โ””โ”€โ”€ github.py                    # GitHub stats/explorer routes
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ templates/                       # Jinja2 HTML views
โ”‚   โ”‚   โ”œโ”€โ”€ base.html                    # Shared base layout
โ”‚   โ”‚   โ”œโ”€โ”€ index.html                   # Main dashboard UI
โ”‚   โ”‚   โ”œโ”€โ”€ news.html                    # News UI
โ”‚   โ”‚   โ”œโ”€โ”€ weather.html                 # Weather UI
โ”‚   โ”‚   โ”œโ”€โ”€ crypto.html                  # Crypto portfolio UI
โ”‚   โ”‚   โ””โ”€โ”€ github.html                  # GitHub analytics UI
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ static/                          # Frontend assets
โ”‚   โ”‚   โ”œโ”€โ”€ css/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ style.css                # Global styling
โ”‚   โ”‚   โ”œโ”€โ”€ js/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ main.js                  # Interactive UI logic
โ”‚   โ”‚   โ””โ”€โ”€ img/                         # Logos, screenshots, icons
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ __init__.py                      # Package init
โ”‚
โ”œโ”€โ”€ config.py                             # Configuration classes (Production, Dev, Test)
โ”œโ”€โ”€ run.py                                # App entry point
โ”œโ”€โ”€ requirements.txt                      # Python dependency list
โ”‚
โ”œโ”€โ”€ SETUP_GUIDE.md                        # How to install & run the project
โ”œโ”€โ”€ IMPROVEMENTS.md                       # Future upgrade notes
โ””โ”€โ”€ README.md                             # Project documentation

๐Ÿ› ๏ธ Technology Stack

Backend

Technology Version Purpose
Flask 3.0.0 Web framework
Flask-SQLAlchemy 3.1.1 Database ORM
Flask-Migrate 4.0.5 Database migrations
Requests 2.31.0 HTTP library
Python-dotenv 1.0.0 Environment variables

Frontend

Technology Purpose
Bootstrap 5 Responsive CSS framework
jQuery 3.7.1 DOM manipulation & AJAX
Font Awesome 6.4 Beautiful icons
Google Fonts (Poppins) Modern typography
Custom CSS Glassmorphism effects

APIs Integrated

API Cost Usage Limit Purpose
NewsAPI FREE 100 req/day News articles from 90+ sources
OpenWeatherMap FREE 1,000 req/day Weather data & forecasts
CoinGecko FREE Unlimited โœจ Cryptocurrency prices
GitHub FREE 60 req/hour (5K with token) Repository data

๐ŸŽฏ Feature Deep-Dive

๐Ÿ“ฐ News Center

Global News

  • 13 Countries Supported: ๐Ÿ‡บ๐Ÿ‡ธ ๐Ÿ‡ฌ๐Ÿ‡ง ๐Ÿ‡จ๐Ÿ‡ฆ ๐Ÿ‡ฆ๐Ÿ‡บ ๐Ÿ‡ฉ๐Ÿ‡ช ๐Ÿ‡ซ๐Ÿ‡ท ๐Ÿ‡ฏ๐Ÿ‡ต ๐Ÿ‡ฎ๐Ÿ‡ณ ๐Ÿ‡จ๐Ÿ‡ณ ๐Ÿ‡ง๐Ÿ‡ท ๐Ÿ‡ฟ๐Ÿ‡ฆ ๐Ÿ‡ณ๐Ÿ‡ฌ ๐Ÿ‡ฐ๐Ÿ‡ช
  • 7 Categories: General, Business, Technology, Entertainment, Health, Science, Sports
  • Real-time Search: 500ms debounce for efficient API usage
  • Smart Filtering: Combine country + category + search
  • Load More: Infinite scroll with pagination

Local News

  • GPS Detection: Browser geolocation API
  • City-Specific News: Get news from your location
  • Smart Fallback: Shows country news if city news unavailable
  • One-Click Location: "Detect Location" button

Example Usage:

1. Click "Local News" tab
2. Click "Detect Location" โ†’ Allow browser permission
3. See news specific to your city!
4. Filter by category for focused content

๐ŸŒค๏ธ Weather Station

Key Features

  • Auto-Detection: Uses browser GPS to find your city
  • Save Cities: Unlimited favorite locations in localStorage
  • 5-Day Forecast: Detailed predictions with hourly breakdown
  • Visual Icons: Weather-specific icons (sun, cloud, rain, etc.)
  • Detailed Metrics: Temperature, humidity, wind, pressure, cloudiness

Smart Features

  • Default City Memory: Remembers last searched city
  • Quick Switch: Click any saved city badge for instant weather
  • Beautiful Cards: Modern forecast cards with daily summaries
  • Sunrise/Sunset: Plan your day around daylight hours

Example Usage:

1. Click "My Location" โ†’ Auto-loads your weather
2. Search "Tokyo" โ†’ See Tokyo's weather
3. Click "Save" โ†’ Tokyo added to favorites
4. Click "Tokyo" badge anytime โ†’ Instant weather

๐Ÿ’ฐ Crypto Portfolio Tracker

Portfolio Management

  • Add Holdings: Track any cryptocurrency you own
  • Real-time Valuation: See current value of your portfolio
  • Profit/Loss Tracking:
    • $ gain/loss per holding
    • % gain/loss with color coding
    • Total portfolio P/L
  • Purchase History: Remember when and at what price you bought

Price Alerts

  • Set Targets: Alert when price goes above/below target
  • Multiple Alerts: Unlimited price alerts
  • Easy Management: View and remove alerts anytime
  • LocalStorage: No server required, saved in browser

Live Prices

  • Top 50 Coins: Sorted by market cap
  • Search Coins: Find any crypto quickly
  • Quick Add: One-click portfolio addition from price table
  • Detailed Metrics: Price, 24h/7d change, market cap
  • Auto-Refresh: Updates every 60 seconds

Example Usage:

Portfolio:
1. Go to "My Portfolio" tab
2. Enter: bitcoin, amount: 0.5, price: $40,000
3. Click "Add to Portfolio"
4. See real-time value and profit/loss!

Alerts:
1. Go to "Alerts" tab
2. Enter: bitcoin, target: $50,000, condition: above
3. Create alert
4. Get notified when Bitcoin hits $50K

๐Ÿ™ GitHub Explorer

Search & Discovery

  • Repository Search: Find any public repository
  • Trending Repos: See what's hot (daily/weekly/monthly)
  • Language Filter: Browse by programming language
  • Detailed Info: Stars, forks, description, language

Analytics (Existing)

  • Repository Details: Full metadata
  • Contributors: See who's building the project
  • Languages: Code language breakdown
  • Commits: Recent activity
  • Issues & PRs: Development status

No Token Required: Works out-of-the-box with 60 requests/hour!


๐Ÿ’พ Data Persistence (No Database Required!)

LocalStorage Strategy

All user preferences saved in browser (no server-side database needed):

Weather

localStorage.setItem('weather_saved_cities', ['London', 'Tokyo', 'Paris']);
localStorage.setItem('weather_default_city', 'London');

Crypto

localStorage.setItem('crypto_portfolio', [{
  id: 1234567890,
  coinId: 'bitcoin',
  amount: 0.5,
  purchasePrice: 40000,
  purchaseDate: '2025-01-01'
}]);

localStorage.setItem('crypto_alerts', [{
  coinId: 'ethereum',
  targetPrice: 3000,
  condition: 'above'
}]);

Benefits

  • โœ… No Database Setup: Works immediately
  • โœ… Privacy-Friendly: Data stays on your device
  • โœ… Instant Access: No server round-trips
  • โœ… Offline-Ready: Saved data available offline
  • โœ… No Authentication Required: Start using immediately

๐ŸŽจ UI/UX Features

Modern Design

  • Glassmorphism: Frosted-glass effect with backdrop blur
  • Gradient Background: Purple gradient (667eea โ†’ 764ba2)
  • Poppins Font: Modern, clean typography
  • Smooth Animations: CSS transitions and keyframes
  • Hover Effects: Scale transforms and shadow effects

User Experience

  • Toast Notifications: Non-intrusive success/error messages
  • Loading Spinners: Animated while fetching data
  • Empty States: Helpful messages when no data
  • Error Handling: Clear error messages with recovery options
  • Responsive Design: Mobile-first approach

Accessibility

  • Color contrast ratios meet WCAG standards
  • Keyboard navigation support
  • Screen reader friendly
  • Focus indicators on interactive elements

๐Ÿ“Š API Usage & Limits

Free Tier Comparison

API Free Limit Perfect For Upgrade
NewsAPI 100 req/day โœ… Check news 4-5 times daily $449/month
OpenWeatherMap 1,000 req/day โœ… Check every 2 minutes! $40/month
GitHub (no token) 60 req/hour โœ… Casual browsing FREE (5K with token)
CoinGecko Unlimited โœ… No restrictions! Always free โค๏ธ

๐Ÿ’ก Pro Tip: Free tiers are MORE than enough for personal use!


๐Ÿš€ Performance Optimizations

Backend

  • Efficient API Calls: Batch requests where possible
  • Error Handling: Graceful fallbacks for API failures
  • Request Timeouts: 10-second timeout on all API calls
  • Class-based APIs: Reusable, maintainable code

Frontend

  • Debounced Search: 500ms delay prevents excessive API calls
  • Lazy Loading: Load data only when tabs are active
  • Auto-Refresh: Smart refresh only for visible content
  • Image Optimization: Placeholder images for missing content
  • LocalStorage Caching: Reduce server requests

User Experience

  • Optimistic UI: Instant feedback before API response
  • Progressive Enhancement: Works even if some APIs fail
  • Graceful Degradation: Fallbacks for missing data
  • Loading States: Visual feedback during data fetch

๐Ÿ”’ Security

Current Implementation

  • โœ… Environment Variables: Sensitive data in .env
  • โœ… No API Keys in Frontend: All keys server-side
  • โœ… CSRF Protection: Flask-WTF enabled
  • โœ… SQL Injection Prevention: SQLAlchemy ORM
  • โœ… XSS Protection: Jinja2 auto-escaping

Best Practices

  • Change SECRET_KEY to random string
  • Never commit .env to version control
  • Use HTTPS in production
  • Keep dependencies updated
  • Validate all user inputs

๐Ÿงช Testing Your Setup

Quick Health Check

# Visit this endpoint after starting server
curl http://localhost:5000/test-apis

# Expected response:
{
  "news": "OK",
  "weather": "OK", 
  "crypto": "OK",
  "github": "OK"
}

Test Each Feature

  1. Dashboard: Should show 4 stat cards with data
  2. News: Should load articles (may take 15s for weather key activation)
  3. Weather: Click "My Location" โ†’ Should detect your city
  4. Crypto: Should show Top 50 coins immediately
  5. GitHub: Should show trending repositories

๐Ÿ› Troubleshooting

Common Issues

"API key not found"

# Solution:
1. Check .env file exists in project root
2. Verify key names: NEWSAPI_KEY, OPENWEATHER_API_KEY
3. Restart Flask server after editing .env

Weather API not working

# Solution:
1. Wait 10-15 minutes after getting key (activation time)
2. Test key manually:
   curl "https://api.openweathermap.org/data/2.5/weather?q=London&appid=YOUR_KEY"

Location detection not working

# Solution:
1. Click "Allow" when browser asks for location permission
2. Use HTTPS (geolocation requires secure context)
3. Try manual city search instead

News only showing US articles

# Solution:
1. Check you selected correct country in dropdown
2. Try "Global" + different country combination
3. For local news, click "Detect Location" first

๐ŸŽฏ Roadmap & Future Features

Phase 1 (Completed) โœ…

  • โœ… Global + Local News with GPS
  • โœ… Portfolio tracker with P/L
  • โœ… Price alerts system
  • โœ… Weather GPS detection
  • โœ… Save favorite cities
  • โœ… Modern glassmorphism UI
  • โœ… LocalStorage persistence

Phase 2 (Planned) ๐Ÿšง

  • User authentication (Flask-Login)
  • Cloud-sync preferences
  • Browser push notifications
  • Export portfolio to PDF/CSV
  • Dark mode toggle
  • News article bookmarking
  • Weather alerts
  • Crypto price charts

Phase 3 (Future) ๐Ÿ”ฎ

  • Mobile app (React Native)
  • Real-time WebSocket updates
  • Advanced analytics dashboard
  • Social features (share portfolios)
  • Multi-language support
  • Machine learning predictions
  • Tax calculation for crypto

๐Ÿค Contributing

Contributions are welcome! Here's how:

  1. Fork the repository
  2. Create a feature branch
    git checkout -b feature/AmazingFeature
  3. Commit your changes
    git commit -m 'Add: Amazing new feature'
  4. Push to the branch
    git push origin feature/AmazingFeature
  5. Open a Pull Request

Contribution Guidelines

  • Follow PEP 8 style guide
  • Add comments for complex logic
  • Update README if adding features
  • Test your changes thoroughly
  • Keep commits atomic and descriptive

๐Ÿ‘ค Author

Frank Bwalya


๐Ÿ™ Acknowledgments

APIs & Services

  • NewsAPI - For news article data
  • OpenWeatherMap - For weather information
  • CoinGecko - For cryptocurrency data
  • GitHub API - For repository information

Libraries & Frameworks

  • Flask - Excellent web framework
  • Bootstrap - Beautiful CSS framework
  • Font Awesome - Amazing icon library
  • jQuery - Simplified JavaScript

Inspiration

  • Modern dashboard designs on Dribbble
  • Glassmorphism UI trend
  • Community feedback and suggestions

๐Ÿ“ง Support

Need help? Here's how to get it:

  1. Check Documentation: Read SETUP_GUIDE.md
  2. Search Issues: See if someone had the same problem
  3. Open Issue: Describe your problem with error messages
  4. Email: [email protected]

โญ Star This Project

If you find this project useful, please consider giving it a star! โญ

It helps others discover the project and motivates continued development.


๐Ÿ“ธ Screenshots

Dashboard Home

Dashboard Beautiful overview with real-time stats from all APIs

News Center

News Center Global and local news with smart filtering

Weather Station

Weather 1 Weather 2 Weather 3 5-day forecast with GPS auto-detection

Crypto Portfolio

Crypto Portfolio 1 Crypto Portfolio 2 Track your investments with profit/loss calculations


๐ŸŽ‰ Final Notes

This project demonstrates:

  • โœ… Clean Flask architecture
  • โœ… Modern UI/UX design
  • โœ… Multiple API integrations
  • โœ… LocalStorage for persistence
  • โœ… Responsive design
  • โœ… No database required for basic features
  • โœ… Production-ready code

Perfect for:

  • Learning Flask development
  • Building API integrations
  • Creating dashboards
  • Portfolio projects
  • Personal use

Made with โค๏ธ and Flask | ยฉ 2025 API Hub

About

A comprehensive web application built with Flask that integrates multiple APIs into a beautiful, interactive dashboard.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published