A web application for providing a weather report along with an AI summary with a Java backend.
- Weather Reports: Get detailed weather forecasts for any location using coordinates
- City Search: Search for cities to easily find coordinates
- AI-Powered Summaries: Generate human-readable weather summaries using Google's Gemini AI
- Responsive Web Interface: User-friendly interface built with Thymeleaf templates
- Java 21: Modern Java language features
- Spring Boot 3.5.5: Framework for building web applications
- Thymeleaf: Server-side Java template engine
- LangChain4j: Java library for working with LLMs
- Google Gemini AI: AI model for generating weather summaries
- Jackson: JSON processing library
- Open-Meteo API: Weather data provider (client-side integration)
- Gradle: Build and dependency management
This project embraces the power of state-of-the-art AI tools to accelerate development, improve code quality, and create intelligent weather summaries:
- GitHub Copilot: Used extensively for smart code completion, suggestions, and refactoring.
- JetBrains Junie: Provided advanced AI-assisted programming and code review within the IDE.
- LangChain4j: Integrated for building AI-powered Java workflows and enabling seamless interaction with LLMs.
- Google AI Studio Gemini Models: Leveraged to generate insightful and contextual weather data summaries for each city.
- Java 21 or higher
- Gradle (or use the included Gradle wrapper)
- Google Gemini API key (for AI summaries)
-
Clone the repository:
git clone https://github.com/yourusername/weather-app-java.git cd weather-app-java
-
Configure the Google Gemini API key:
- Option 1: Set environment variable:
export AI_API_KEY=your_gemini_api_key
- Option 2: Add to application.properties:
ai.gemini.api-key=your_gemini_api_key
- Option 1: Set environment variable:
-
(Optional) Configure the Gemini model:
export GOOGLE_GEMINI_MODEL=gemini-1.5-flash
./gradlew bootRun
- Build the Docker image:
docker build -t weather-app-java .
- Run the container:
docker run -p 8080:8080 -e AI_API_KEY=your_gemini_api_key weather-app-java
The application will be available at http://localhost:8080
- Open the application in your browser at http://localhost:8080
- Search for a city using the search box
- View the weather report for the selected location
- Read the AI-generated summary for practical insights and activity suggestions
GET /
: Home pageGET /report
: Weather report page (requires lat, lon parameters)
GET /api/cities/search
: Search for cities- Parameters:
q
: Search querylimit
: Maximum number of results (default: 10, max: 50)
- Parameters:
POST /api/ai-summary
: Generate AI summary for weather data- Request body: WeatherReport JSON
- Parameters:
timezone
: Optional timezonecity
: Optional city name
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.