Skip to content

Latest commit

Β 

History

3 Commits

Folders and files

NameName
Last commit message
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.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages