How shekhawat-ajay/drizzle-weather-app works
Project Type & Purpose
• This is a client-side, single-page React application for checking weather/AQI.
• No custom backend—data comes from third-party weather/AQI APIs.
File Structure
• Top level: package.json, Vite config, public/index.html.
• src/
• components/ – presentational React components (Header, SearchBox, CurrentWeather, TodayWeather, WeeklyForecast, AirQuality, Footer)
• hooks/ – custom data-fetching hooks (useLocation, useCurrentWeather, useTodayWeather, useWeeklyForecast, useAQI) using Axios + useSWR
• utils/ – pure functions and mapping tables (weatherImageMap, uvIndexImageMap, aqiMap, getWindDirection, cn)
• Configuration: vite.config.js, eslint.config.js, .prettierrc
README for Stack & Flow
• React.js for UI, Tailwind/DaisyUI for styling
• Axios + useSWR for HTTP requests & caching
• Vite for local dev server & build
Main Components & Interactions
a. Browser (Client)
b. React App (SPA)
– UI Layer (components/)
– Data Layer (hooks/)
– Utilities (utils/)
c. External Services
– Weather API (current + forecast)
– AQI API
d. Build & Deployment
– Vite Dev Server / Vite Production Bundle
Data Flow & Relationships
1. User enters a city in SearchBox → triggers useLocation or search logic
2. Hooks (useCurrentWeather, useTodayWeather, useWeeklyForecast, useAQI) call Axios → external APIs
3. Responses pass through utils (mapping functions) → components render UI
4. useSWR manages caching and revalidation in the background
Architectural Patterns & Principles
• Component-based UI (separation of concerns)
• Custom hooks abstract data fetching + caching
• Utility modules keep transformation logic pure
• Unidirectional data flow (props & hooks → components)
Technologies & Frameworks
• React.js (JSX components)
• Tailwind CSS + DaisyUI (styling)
• Axios + useSWR (data fetching & caching)
• Vite (dev server & bundler)