Turn an air-quality forecast into a plan your household can use.
Built for Prompt Wars Challenge 06, Airshift helps families, outdoor workers, and community organizers decide what to do during urban air pollution. It turns regional PM₂.₅ and the constraints of an actual day into a plan for outdoor activity, indoor air, and travel. Prompt Wars Virtual
| Decision | What Airshift shows |
|---|---|
| Move outdoor play indoors | In the synthetic Delhi scenario, moving the sample 30-minute session indoors avoids 30 outdoor minutes. |
| Replace one petrol-car trip | Skipping the sample 12 km drive at 14 km/L avoids about 2.0 kg of the car’s tailpipe CO₂. The model shows the fuel factor and what the estimate includes. |
| Improve air at home | A room-by-room checklist, no-purchase options, and a purifier sizing estimate based on floor area. |
| Coordinate a group | A briefing to copy for a school or residents’ group with current data status and a link to official readings. |
Use Node.js 22.12 or newer.
git clone https://github.com/JayDev-27/Airshift.git
cd Airshift
npm ci
npm run devOpen localhost:5173. The demo, regional forecasts, plan, and guided assistant work without an API key.
| Command | Purpose |
|---|---|
npm test |
Run planner, client, forecast, assistant, API, security and hosted-runtime tests |
npm run test:coverage |
Run the tests with a coverage report |
npm run lint |
ESLint with React Hooks and strict jsx-a11y accessibility rules |
npm run check |
Lint, test and build, as CI does |
npm run build |
Build the browser application |
npm start |
Serve the production build at localhost:8080 |
npm run build:site |
Package the browser app and API as a deployable Worker |
The live app runs on Render from the Dockerfile, described by render.yaml.
Copy .env.example to .env and set GEMINI_API_KEY to enable the Gemini assistant on the server. The default model is Gemini 3.5 Flash-Lite. The hosted demo currently uses guided mode. Google AI Studio keys
flowchart LR
A["City and household settings"] --> B["Plan engine"]
C["CAMS PM₂.₅ forecast or winter demo"] --> B
D["Follow-up question"] --> E["Gemini or guided mode"]
E -->|"Selected reviewed actions"| B
B --> F["Daily plan, source links, impact estimates"]
- Observation and prediction. The current forecast uses Open-Meteo and CAMS at regional resolution. CPCB station readings are linked for local decisions. The synthetic winter scenario is labeled throughout. Open-Meteo · CPCB
- Grounded assistant. Gemini returns structured action IDs and practical constraints. Airshift validates them and calculates impact from explicit inputs. Gemini structured output
- Evidence and limitations. Methodology and credits · Audit · Build narrative
src/
domain.mjs Plan engine: cities, sources, profile validation, windows, actions, guided answers
lib/ Shared forecast provider and assistant contract, client API calls, preferences and formatting
hooks/ useForecast, useGeminiStatus, useToast
components/ Layout, overview cards, chart, action list, dialogs, assistant drawer, 3D model
pages/ Overview, daily plan, indoor air, community and sources views
App.jsx State and page composition
server/ Express and Worker adapters, shared API handler, Gemini integration, forecast cache and headers
test/ node:test suites for the engine, client helpers, forecast, API and headers
| Area | How it is handled |
|---|---|
| Code quality | The UI and both runtimes share the planning engine and assistant contract. Express and the Worker use one API handler. Lint rules enforce the browser/server import boundary in CI. |
| Security | Server-side key, allowlisted model output, body and length limits, rate limits, and a shared hardening header set. See SECURITY.md. |
| Efficiency | The 3D scene is lazy-loaded behind a still preview. Hashed bundles are cached for a year, text is compressed, and forecasts are cached per city for five minutes with one shared in-flight request. |
| Testing | node:test covers city and household plans, CPCB band edges, window selection, guided routing, forecast validation and fallback, Gemini output validation, rate limiting, and HTTP behavior across both runtimes. The coverage command reports the planner, client helpers and in-process server modules. |
| Accessibility | Skip link, native <dialog> focus handling, keyboard-operable selectors with roving focus, a readings table alternative to the chart, prefers-reduced-motion support, live status regions, and strict jsx-a11y linting. |
Airshift’s code is MIT licensed. The Old Delhi map data is from OpenStreetMap contributors under ODbL, and city photography retains its individual Creative Commons licenses. OpenStreetMap attribution · Photo credits





