Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Β | Β | |||
Β | Β | |||
Β | Β | |||
Β | Β | |||
Repository files navigation
# WeatherSense
WeatherSense is a desktop weather monitoring application built with **React, Vite, Tauri, Rust, and Node.js**. It fetches real-time weather information and hourly forecasts, monitors upcoming weather changes, and can generate desktop notifications when significant weather events such as rain are detected.
## Description
WeatherSense provides:
* π€οΈ **Current Weather**
* Temperature
* Feels-like temperature
* Weather condition
* Humidity
* Wind speed
* Atmospheric pressure
* Last updated time
* π **Hourly Weather Forecast**
* Temperature forecast
* Weather conditions
* Rain probability
* Precipitation information
* π§οΈ **Weather Change Detection**
* Detects upcoming rain events
* Estimates rain confidence
* Checks whether rain is expected within the next few hours
* Provides reasons for detected weather changes
* π **Desktop Notifications**
* Generates native desktop notifications for significant weather events
* Uses a confidence threshold before notifying the user
* Prevents duplicate notifications for the same event
* βοΈ **Automatic Weather Monitoring**
* Background weather monitoring
* Configurable monitoring intervals:
* 5 minutes
* 10 minutes
* 15 minutes
* 30 minutes
* 60 minutes
* π₯οΈ **System Tray Integration**
* Open WeatherSense
* Check weather immediately
* Open settings
* Exit the application
* π§ͺ **Testing Support**
* Backend regression tests
* Weather API testing
* Synthetic rain-event testing
* Notification-engine testing
## Technology Stack
### Frontend / Desktop
* React
* TypeScript
* Vite
* Tauri 2
* Rust
### Backend
* Node.js
* Express.js
* Axios
* CORS
* dotenv
### Weather Data
* WeatherAPI
## Project Structure
```text
WeatherSense/
β
βββ backend/
β βββ server.js
β βββ package.json
β βββ services/
β β βββ notificationEngine.js
β β βββ weatherChangeDetector.js
β βββ test/
β βββ run.js
β
βββ desktop/
β βββ src/
β β βββ App.tsx
β β βββ App.css
β β βββ main.tsx
β β
β βββ src-tauri/
β β βββ src/
β β βββ Cargo.toml
β β βββ tauri.conf.json
β β
β βββ package.json
β βββ vite.config.ts
β
βββ README.md
```
# How to Run
## Prerequisites
Make sure the following are installed:
* Node.js
* npm
* Rust
* Cargo
* Tauri CLI
* A WeatherAPI API key
For Tauri development, install the required Tauri system dependencies for your operating system.
## 1. Clone the Repository
```bash
git clone https://github.com/vikas-g-10/WeatherSense.git
cd WeatherSense
```
## 2. Configure the Weather API Key
Create a `.env` file inside the `backend` folder:
```text
backend/.env
```
Add your WeatherAPI key:
```env
WEATHER_API_KEY=your_weatherapi_key
```
Replace `your_weatherapi_key` with your actual API key.
**Do not commit your `.env` file or API key to GitHub.**
## 3. Install Backend Dependencies
Open a terminal in the project root:
```bash
cd backend
npm install
```
## 4. Run Backend Tests
From the `backend` directory:
```bash
npm test
```
## 5. Start the Backend
For development:
```bash
npm run dev
```
Or start normally:
```bash
npm start
```
The backend runs on:
```text
http://localhost:5000
```
You can verify that it is running by opening:
```text
http://localhost:5000/health
```
You should receive a response similar to:
```json
{
"status": "OK",
"service": "WeatherSense Backend"
}
```
## 6. Install Desktop Dependencies
Open a **second terminal**.
From the project root:
```bash
cd desktop
npm install
```
## 7. Start WeatherSense
Make sure the backend is already running.
Then, from the `desktop` directory:
```bash
npx tauri dev
```
This starts the WeatherSense desktop application.
## Running Both Components
You need **two terminals** during development.
### Terminal 1 β Backend
```bash
cd WeatherSense/backend
npm install
npm run dev
```
### Terminal 2 β Desktop Application
```bash
cd WeatherSense/desktop
npm install
npx tauri dev
```
## Testing the Weather Change Detection
The backend includes a synthetic rain-event endpoint for testing the notification system.
With the backend running, you can test:
```text
http://localhost:5000/api/test/rain-event
```
You can also test the notification evaluation flow directly from the WeatherSense application using:
**Test Automatic Alert**
This simulates a rain event and sends it through the normal weather-event and notification decision pipeline.
## Backend API
Some available endpoints include:
```text
GET /
GET /health
GET /weather/:city
GET /forecast/:city
GET /api/weather/:city/check
POST /api/notifications/evaluate
GET /api/test/rain-event
```
Example:
```text
http://localhost:5000/weather/Bengaluru
```
## Build the Desktop Application
To create a production build:
```bash
cd desktop
npm run build
```
To build the Tauri desktop application:
```bash
npx tauri build
```
The generated application/package will be placed in the Tauri build output directory.
## Important
WeatherSense requires a valid **WeatherAPI key** to retrieve live weather and forecast data.
Keep your API key private and never commit the following file:
```text
backend/.env
```
---
**WeatherSense** β Monitor the weather. Detect changes. Get notified.