Skip to content

Repository files navigation

🌀️ WeatherTracker

A modern cross-platform weather application built with a Flutter frontend and a Python FastAPI backend.

This project demonstrates the development of a production-style application featuring responsive UI, REST API integration, MQTT communication, Cubit state management, feature-based architecture, and native Android plugin development.

✨ Features

  • πŸ” User Authentication: Secure login and registration system using JWT.
  • 🌀️ Real-time Weather Data: Current weather conditions and forecasts via OpenMeteo integration.
  • πŸ“‘ Live Updates: Real-time data synchronization using the MQTT protocol.
  • πŸ“ Location Management: Save and manage multiple locations.
  • πŸ‘€ User Profile: Personalized user settings and saved places.
  • 🌐 Network Monitoring: Real-time network connectivity status monitoring.
  • πŸ”¦ Native Integration: Device flashlight control via a custom Android plugin.
  • πŸ“± Responsive UI: Optimized for mobile, tablet, and web viewing.

πŸ—οΈ Full-Stack Architecture

This project consists of two main components, ensuring a clear separation of concerns:

1. Frontend (Flutter)

  • State Management: Uses flutter_bloc (Cubit) for reactive state management. Business logic is strictly separated from the UI.
  • Architecture: Feature-Based Architecture combined with a shared core module.
  • Dependency Injection: Implemented via RepositoryProvider to keep the application loosely coupled.

2. Backend (Python FastAPI)

  • API: RESTful API built with the high-performance FastAPI framework.
  • Database: SQLite database for persistent storage (managed via SQLAlchemy).
  • Security: JWT authentication and bcrypt password hashing for secure user sessions.

πŸš€ Technologies

Category Technologies
Frontend Framework Flutter, Dart
State Management flutter_bloc (Cubit)
Frontend Networking http, mqtt_client, internet_connection_checker_plus
Native Integration Kotlin, MethodChannel (flashlight_plugin)
Backend Framework Python, FastAPI, Uvicorn
Backend DB & Auth SQLAlchemy, PyJWT, passlib, bcrypt
External APIs OpenMeteo SDK

πŸ“ Project Structure

Frontend (Flutter)

lib/
β”œβ”€β”€ core/
β”‚   β”œβ”€β”€ theme/           # App theming and colors
β”‚   β”œβ”€β”€ data/            # Shared data repositories
β”‚   β”œβ”€β”€ models/          # Data models
β”‚   β”œβ”€β”€ services/        # API, Network, and MQTT services
β”‚   β”œβ”€β”€ cubit/           # Global state management
β”‚   β”œβ”€β”€ widgets/         # Reusable UI components
β”‚   └── utils/           # Utility functions and helpers
β”‚
β”œβ”€β”€ features/
β”‚   β”œβ”€β”€ auth/            # Authentication feature (Login/Register)
β”‚   β”œβ”€β”€ home/            # Weather dashboard and main screen
β”‚   └── profile/         # User profile and settings
β”‚
└── main.dart            # App entry point

Backend (Python FastAPI)

weather_backend/
β”œβ”€β”€ api/
β”‚   β”œβ”€β”€ weather_router.py    # Weather data endpoints
β”‚   └── auth_router.py       # Authentication endpoints
β”œβ”€β”€ core/
β”‚   └── security.py          # JWT and security utilities
β”œβ”€β”€ services/
β”‚   β”œβ”€β”€ auth_service.py      # Authentication logic
β”‚   └── weather_service.py   # Weather data processing
β”œβ”€β”€ repository/
β”‚   β”œβ”€β”€ database.py          # Database configuration
β”‚   └── user_repository.py   # User database operations
β”œβ”€β”€ main.py                  # FastAPI app entry point
β”œβ”€β”€ requirements.txt         # Python dependencies
└── weather.db               # SQLite database


βš™οΈ Installation & Getting Started

Prerequisites

  • Flutter SDK 3.11.1 or higher
  • Python 3.8+
  • Android Studio / VS Code

1. Running the Backend

Navigate to the backend directory and set up the Python environment:

cd weather_backend

# Create and activate virtual environment
python -m venv .venv

# Windows:
.venv\Scripts\activate
# macOS/Linux:
source .venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Start the server
uvicorn main:app --reload

*The API will be available at http://localhost:8000* *Swagger API documentation: http://localhost:8000/docs*

2. Running the Frontend

Open a new terminal, navigate to the project root, and run:

# Install Flutter dependencies
flutter pub get

# Run the app
flutter run

Note: During dependency installation, Flutter will automatically download the custom flashlight_plugin directly from GitHub.


πŸ”¦ Easter Egg & Native Plugin

The application contains a hidden feature demonstrating native platform integration via a custom Flutter plugin.

To activate it:

  1. Launch the application on a physical Android device or Emulator.
  2. Locate the blue cloud ☁️ icon in the Top Navigation Bar.
  3. Perform a long press on the icon.
  4. This invokes the custom MethodChannel implementation and toggles the device flashlight. (On unsupported platforms like Web or iOS, an informational dialog is displayed instead).

πŸ‘‰ Plugin Repository: Leskiv1/flashlight_plugin


πŸŽ“ Academic Background & Progression

This project was originally developed as part of a University Mobile Application Development course. Throughout the course, the application was progressively enhanced:

  • Labs 1-3: Responsive UI development, custom design system, and routing.
  • Labs 4-5: REST API integration and real-time MQTT communication.
  • Lab 6: Complete architectural refactoring to 3-Tier Architecture, implementing Cubit state management and Dependency Injection.
  • Lab 7: Native Android plugin development using MethodChannel and safe platform handling (dart:ffi concepts).

πŸ™ Acknowledgements & Course Materials: * Course Repository: DenysDoskochynskyi/IoT-flutter


About

🌀️ A full-stack weather application built with Flutter & FastAPI. Features REST API, real-time MQTT updates, Cubit state management, and a custom native Android plugin.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages