A modern weather application built with React.js and FastAPI that provides real-time weather information and forecasts with AI-powered weather analysis.
- Real-time weather data from OpenWeatherMap API
- Current weather conditions and forecasts
- AI-powered weather analysis and suggestions using Groq
- City search functionality
- Responsive design with dark mode support
- Live clock and date display
- Weather data export to Excel
- CRUD operations for saving weather data
- React 19
- Tailwind CSS
- Environment Variables
- FastAPI
- Python 3
- MongoDB
- Groq for AI analysis
- python-dotenv for environment management
- Node.js (Latest LTS version recommended)
- Python 3.8 or higher
- MongoDB installed and running
- OpenWeatherMap API key
- Groq API key
- Visit OpenWeatherMap
- Sign up for a free account
- Navigate to "API Keys" section in your account
- Copy your API key
- Visit Groq Cloud
- Create an account and sign in
- Navigate to API Keys section
- Generate a new API key
- Clone the repository and navigate to the backend directory:
cd backend- Create a virtual environment and activate it:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install the required packages:
pip install -r requirements.txt- Create a
.envfile in the backend directory:
weatherAPI=your_openweathermap_api_key
groqAPI=your_groq_api_key
MongoDB_URI=mongodb://localhost:27017- Navigate to the frontend directory:
cd frontend- Install the required packages:
npm install- Create a
.env.localfile in the frontend directory:
NEXT_PUBLIC_API_URL=http://localhost:8000- Install MongoDB if not already installed
- Start MongoDB service:
# Linux/Mac
sudo service mongod start
# Windows
net start MongoDB- The application will automatically create required collections
cd backend
uvicorn app:app --reloadThe backend server will start at http://localhost:8000
cd frontend
npm run devThe frontend will be available at http://localhost:3000
/src/app: Main application pages/src/components: Reusable React components/src/types: TypeScript type definitions/public: Static assets
/api: API route handlers/services: Business logic and external service integrations/core: Core configuration and settings
GET /api/weather: Get weather data for specific coordinates- Parameters:
lat(float),lon(float) - Returns current weather and forecasts
- Parameters:
GET /api/location: Get coordinates for a city- Parameters:
city(string, required)country_code(string, optional)state_code(string, optional)limit(int, optional, default=1)
- Parameters:
GET /api/icon: Get weather icon- Parameters:
icon_code(string)size(string, optional, default="2x")
- Parameters:
- Install MongoDB if not already installed
- Start MongoDB service:
# Linux/Mac
sudo service mongod start
# Windows
net start MongoDB- The application will automatically create required collections
cd backend
uvicorn app:app --reloadThe backend server will start at http://localhost:8000
cd frontend
npm startThe frontend will be available at http://localhost:3000