This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Babel for Fast Refresh
- @vitejs/plugin-react-swc uses SWC for Fast Refresh
This application fetches real-time weather data and sends notifications (email alerts) when it detects rain in a subscribed city. The app is built using React (Vite) for the frontend, Node.js (Express) for the backend, and Capacitor for mobile compatibility.
- Frontend: React (Vite), Capacitor
- Backend: Node.js, Express
- Email Service: Nodemailer
- Mobile App Support: Capacitor for Android
- Node.js and Yarn installed
- Capacitor installed (
npm install -g @capacitor/cli) - Android Studio (for testing Android app)
-
Clone the Repository:
git clone <repository-url> cd weatherApp
-
Install Dependencies:
yarn install
-
Set Up Environment Variables:
- Update the
.envfile in the backend folder with required API keys ( email service credentials which is the password and email itself). - In WeatherFetch.jsx update with your API key
- Update the
-
Run the Backend:
cd backend yarn start -
Run the Frontend:
cd frontend yarn dev -
Run on Android (Capacitor)
- Initialize Capacitor:
npx cap init
- Add Android platform:
npx cap add android
- Sync project:
npx cap sync
- Open in Android Studio:
npx cap open android
- Initialize Capacitor:
Currently, Android Studio is not fully configured on this system, but all Capacitor commands have been executed successfully. The app should work once properly opened and built in Android Studio.
App can run smoothly on Browser
Run
yarn start or yarn run dev
- Endpoint:
/api/weather - Method:
GET - Response: JSON with weather conditions
- Endpoint:
/api/send-email - Method:
POST - Request Body:
{ "email": "user@example.com", "rainAlerts": [{ "city": "Nairobi", "time": "14:00", "date": "2025-02-27" }] } - Response:
200 OKif email is sent successfully
- Faced issues with Android Studio installation, but the Capacitor setup is complete.
- Learned how to integrate RESTful services and email notifications effectively.
- Used Vite and Yarn for optimized frontend development.