A Spring Boot application that fetches weather data from OpenWeatherAPI and sends automated daily weather notifications via SMS/MMS to registered users. The application features a web interface for user registration and includes beautifully formatted weather images with comprehensive daily forecasts.
- Automated Daily Notifications: Scheduled weather updates sent directly to your phone
- Custom Weather Images: Dynamically generated images with weather information
- Multi-User Support: Manage multiple phone numbers with personalized locations
- Comprehensive Weather Data:
- Current temperature
- Daily high/low temperatures
- Rain percentage
- UV index rating
- Sunrise/sunset times
- Moonrise time
- Web Dashboard: User-friendly interface for registration and management
- Location Intelligence: Automatic IP-based location detection with GeoIP2
- Carrier-Agnostic: Support for all major phone carriers via email-to-SMS gateway
- Framework: Spring Boot 3.0.3
- Language: Java 17
- Database: MySQL with JPA/Hibernate
- Build Tool: Gradle
- Caching: Caffeine cache for optimized API calls
- Framework: Vanilla JavaScript
- Module Bundler: Webpack
- HTTP Client: Axios
- Notifications: Toastify.js
- Weather Data: OpenWeatherMap API
- Messaging: Twilio SDK & Email-to-SMS
- Geolocation: MaxMind GeoIP2
- Java 17 or higher
- MySQL database
- OpenWeatherMap API key (Get one here)
- Email account for sending SMS messages
- (Optional) Twilio account for enhanced SMS delivery
- Node.js and npm/yarn (for frontend development)
git clone https://github.com/zchalmers/weather.git
cd weatherCreate a MySQL database:
CREATE DATABASE weather_app;Create or update src/main/resources/application.properties:
# OpenWeatherMap API
openweather.api.key=YOUR_API_KEY_HERE
# Email Configuration (for SMS via email gateway)
email.username=your.email@gmail.com
email.password=your_app_password
# Database Configuration
spring.datasource.url=jdbc:mysql://localhost:3306/weather_app
spring.datasource.username=your_db_username
spring.datasource.password=your_db_password
spring.jpa.hibernate.ddl-auto=update
# Twilio (Optional - for direct SMS)
twilio.account.sid=YOUR_TWILIO_SID
twilio.auth.token=YOUR_TWILIO_TOKEN
twilio.phone.number=YOUR_TWILIO_PHONE./gradlew build./gradlew bootRunThe application will be available at http://localhost:8080
- Open the web application at
http://localhost:8080 - Enter your information:
- Location: City name or ZIP code
- Phone Number: Your mobile number
- Phone Carrier: Select your carrier from the dropdown
- Click "Send MMS" to register
- You'll receive a daily MMS with weather information at your scheduled time
The MMS message includes:
- πΈ Custom-generated weather image
- π‘οΈ Current temperature
- β¬οΈβ¬οΈ High/low temperatures for the day
- π§οΈ Rain probability percentage
- βοΈ UV index rating
- π Sunrise and sunset times
- π Moonrise time
GET /weather/currentManually triggers weather notifications to all registered users.
POST /weather/user
Content-Type: application/json
{
"phoneNumber": "1234567890",
"carrier": "verizon",
"location": "Seattle, WA"
}POST /weather/user/delete/{phoneNumber}weather/
βββ Frontend/ # JavaScript frontend
β βββ src/
β β βββ css/ # Stylesheets
β β βββ pages/ # HTML pages
β β βββ js/ # JavaScript modules
β βββ package.json
β βββ webpack.config.js
βββ src/
β βββ main/
β βββ java/com/weather/server/
β β βββ controller/ # REST controllers
β β βββ service/ # Business logic
β β β βββ WeatherService.java
β β β βββ EmailService.java
β β β βββ TwilioService.java
β β β βββ SQLService.java
β β β βββ ImageDrawing.java
β β βββ repository/ # Data access
β β βββ converter/ # Data transformers
β βββ resources/
β βββ application.properties
β βββ static/ # Frontend build output
βββ build.gradle
Backend:
- Spring Boot 3.0.3
- Spring Web (REST API)
- Spring Data JPA (Database ORM)
- Spring Cache (Caffeine)
- MySQL Connector
- Twilio SDK
- MaxMind GeoIP2
- Jakarta Mail (Email to SMS)
- Swagger/OpenAPI (API Documentation)
Frontend:
- JavaScript (ES6+)
- Webpack 4
- Axios (HTTP requests)
- Toastify.js (Notifications)
- HTML5/CSS3
Development Tools:
- Gradle
- JUnit & Mockito (Testing)
- Testcontainers (Integration testing)
- Spring Boot DevTools
The application supports email-to-SMS for major carriers:
- Verizon:
number@vtext.com - AT&T:
number@txt.att.net - T-Mobile:
number@tmomail.net - Sprint:
number@messaging.sprintpcs.com
Weather notifications are sent on a scheduled basis. Configure the schedule in the WeatherService class using Spring's @Scheduled annotation.
Weather images are generated using the ImageDrawing service. Customize the appearance by modifying the drawing logic in ImageDrawing.java.
Run the test suite:
./gradlew testcd Frontend
npm install
npm startThe frontend dev server will run at http://localhost:8081 with hot-reloading.
./gradlew buildThis will:
- Build the frontend (Webpack production build)
- Copy frontend assets to
src/main/resources/static - Compile Java sources
- Run tests
- Create executable JAR
Once the application is running, access the Swagger UI at:
http://localhost:8080/swagger-ui.html
- Never commit API keys or passwords to version control
- Use environment variables or secure configuration management
- For Gmail, use App Passwords instead of your main password
- Consider implementing rate limiting for API endpoints
Issue: SMS not received
- Verify email credentials are correct
- Check carrier email gateway format
- Ensure OpenWeatherMap API key is valid
Issue: Database connection error
- Verify MySQL is running
- Check database credentials in
application.properties - Ensure database exists
Issue: Weather data not fetching
- Verify API key is valid and active
- Check API rate limits
- Review application logs for errors
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under UNLICENSED - see the project for details.
Zach Chalmers
- OpenWeatherMap for weather data API
- Twilio for SMS infrastructure
- MaxMind for GeoIP2 database
- Spring Boot community
Note: This application was created as a capstone project demonstrating full-stack development, API integration, scheduled tasks, and messaging services.