A React application that transforms its landing page based on real-time weather conditions, featuring beautiful animations and theme switching capabilities. Built with React, and DevCycle for feature management.
- 🌡️ Real-time weather data integration
- 🎨 Dynamic themes based on weather conditions:
- ❄️ Winter theme with snowfall animation
- 🌧️ Rain theme with rainfall animation
- ☀️ Summer theme with wave/sun ray effects
- 🔄 Manual theme switching
- 🎯 Feature flags using DevCycle
- 📱 Responsive design
- 🌐 Geolocation support
This project demonstrates the power of combining real-time weather data with dynamic user interfaces. The application fetches weather information based on the user's location and automatically adjusts its theme and animations accordingly. Users can also manually switch between themes, creating an engaging and interactive experience.
Key technical features:
- Dynamic weather-based theming
- Smooth animations using Framer Motion
- Real-time weather updates
- Geolocation integration
- Devcyle Feature flag management
DevCycle has been instrumental in managing feature rollouts and configurations in this project. Here's how we leveraged DevCycle's capabilities:
We integrated three main feature flags:
-
enable-weather-effects
: Controls the visibility of weather animationsconst enableWeatherEffects = dvcClient?.variable( FEATURE_FLAGS.ENABLE_WEATHER_EFFECTS, true )?.value
-
enable-manual-theme
: Toggles the ability to manually switch themesconst enableManualTheme = dvcClient?.variable( FEATURE_FLAGS.ENABLE_MANUAL_THEME, true )?.value
-
weather-refresh-interval
: Controls the frequency of weather updatesconst refreshInterval = dvcClient?.variable( FEATURE_FLAGS.WEATHER_REFRESH_INTERVAL, 300000 )?.value
- Gradual Feature Rollout: Ability to gradually enable features for different user segments
- Configuration Management: Easy management of feature flags and variables
- Real-time Updates: Instant updates to feature flags without deployment
- Safe Feature Testing: Risk-free testing of new features in production
- Create a DevCycle account and get your client key
- Set up feature flags in DevCycle dashboard:
- Create boolean variables for features
- Set up targeting rules
- Configure default values
- Initialize DevCycle in your React app:
export default withDVCProvider({ sdkKey: import.meta.env.VITE_DEVCYCLE_CLIENT_KEY, user: { user_id: 'default-user' } })(App);
-
Clone the repository
-
Install dependencies:
npm install
-
Set up environment variables:
- VITE_WEATHER_API_KEY
- VITE_DEVCYCLE_CLIENT_KEY
-
Start the development server:
npm run dev
- React + TypeScript
- Vite
- Tailwind CSS
- Framer Motion
- DevCycle
- WeatherAPI
- Axios
DevCycle has proven to be an excellent choice for feature management:
Pros:
- Intuitive dashboard interface
- Excellent documentation
- Reliable SDK
- Real-time updates
- Easy integration with React
MIT