Skip to content
theashgenPublic

About

AiroPath calculates multiple routes between two points and ranks them by real-time AQI (Air Quality Index) — so you can choose the cleanest path, not just the fastest one.

Topics

Resources

Stars

10 stars

Watchers

0 watching

Forks

Repository files navigation

AiroPath — Air-quality-aware routing

Air-quality-aware routing for cyclists and pedestrians.

AiroPath calculates multiple routes between two points and ranks them by real-time AQI (Air Quality Index) — so you can choose the cleanest path, not just the fastest one.

Download APK

Features

Feature Description
🗺️ AQI-aware routing Fetches live AQI data along each route and scores them by air quality
🚴 Multi-mode Supports cycling and walking travel modes via OpenRouteService
📍 Location search Nominatim (OpenStreetMap) autocomplete for start/end points with current location detection
📊 Route cards Side-by-side route comparison with distance, duration, and AQI score
🔐 Auth Email/password + Google OAuth via Supabase
🌗 Dark / Light theme Stark monochromatic theme that auto-follows system preference

Tech Stack


Project Structure

airopath/
├── app/                        # Expo Router routes (file-based navigation)
│   ├── (auth)/                 # Unauthenticated stack
│   │   ├── _layout.tsx
│   │   ├── login.tsx
│   │   ├── register.tsx
│   │   └── onboarding.tsx      # Shown once, right after first sign-in
│   ├── (tabs)/                  # Authenticated stack
│   │   ├── _layout.tsx
│   │   └── index.tsx           # Main map & route screen
│   ├── _layout.tsx              # Root layout: providers + auth-gated redirects
│   └── profile.tsx              # User profile / settings
│
├── components/                  # Presentational, reusable UI (no routing/global state)
│   ├── common/                  # Shared across screens
│   │   ├── EmptyState.tsx       # Pre-analysis walkthrough steps
│   │   └── LoadingOverlay.tsx   # Analysis loading indicator
│   └── map/                     # Map-screen-specific pieces
│       ├── BottomSheet.tsx      # Draggable bottom sheet
│       ├── LocationSearch.tsx   # Nominatim-powered place search with GPS fallback
│       ├── PinBar.tsx           # Start/end pin selection bar
│       └── RouteCard.tsx        # Route summary card with AQI score
│
├── context/                     # App-wide React context providers
│   ├── AuthContext.tsx          # Session/profile state + Supabase auth (incl. Google OAuth)
│   └── ThemeContext.tsx         # Light/dark theme, wired into NativeWind's color scheme
│
├── lib/                         # Framework-agnostic logic (no React)
│   ├── routeService.ts          # Route fetching + AQI scoring logic
│   └── supabase.ts              # Supabase client + auto-refresh setup
│
├── constants/
│   ├── theme.ts                 # Design tokens, colors, map styles
│   └── env.ts                   # Typed accessors for env vars (via expo-constants)
│
├── supabase/
│   └── migrations/               # SQL migrations (run in Supabase SQL editor / CLI)
│
├── assets/                      # Images, icons, splash screens
│
├── app.config.js                # Expo config (reads from .env)
├── tailwind.config.js            # NativeWind/Tailwind theme tokens (light/dark)
├── babel.config.js / metro.config.js  # NativeWind build wiring
├── global.css                   # Tailwind directives, imported once in app/_layout.tsx
└── .env.example                 # Environment variable template

Where does X live?

  • Adding a new screen/route → app/
  • Adding a reusable UI piece used by more than one screen → components/common/
  • Adding something specific to the map screen → components/map/
  • Adding global state (auth, theme, etc.) → context/
  • Adding an API call / business logic with no JSX → lib/
  • Adding a color, font size, or other design constant → constants/

Getting Started

Prerequisites

1. Clone the repo

git clone https://github.com/S-Axhwin/Airopath.git
cd Airopath

2. Install dependencies

bun install
# or
npm install

3. Set up environment variables

cp .env.example .env

Then fill in your keys in .env:

GOOGLE_MAPS_API_KEY=""       # Google Cloud Console → Maps SDK for Android/iOS
WAQI_TOKEN=""                # https://aqicn.org/data-platform/token/
ORS_KEY=""                   # https://openrouteservice.org/dev/#/login
SUPABASE_URL=""              # Supabase project → Settings → API
SUPABASE_ANON=""             # Supabase project → Settings → API → anon key
API_URL=""                   # Your backend URL (e.g. http://localhost:3000)
GOOGLE_WEB_CLIENT_ID=""      # Google Cloud Console → OAuth 2.0 Credentials
GOOGLE_ANDROID_CLIENT_ID=""  # Google Cloud Console → OAuth 2.0 Credentials

Never commit .env — it is gitignored. Use .env.example as a template.

4. Run the app

# Start Expo dev server
npx expo start

# Run on Android
npx expo run:android

# Run on iOS
npx expo run:ios

Environment Variables

All secrets are injected through app.config.js via process.env and accessed in the app via expo-constants. No secrets are hardcoded in source.

Variable Where to get it
GOOGLE_MAPS_API_KEY Google Cloud Console → APIs & Services → Credentials
WAQI_TOKEN aqicn.org/data-platform/token
ORS_KEY openrouteservice.org
SUPABASE_URL Supabase Dashboard → Project Settings → API
SUPABASE_ANON Supabase Dashboard → Project Settings → API → anon key
GOOGLE_WEB_CLIENT_ID Google Cloud Console → OAuth 2.0 Client IDs → Web
GOOGLE_ANDROID_CLIENT_ID Google Cloud Console → OAuth 2.0 Client IDs → Android

How Route Scoring Works

  1. Fetch routes — OpenRouteService returns up to 3 alternative routes for the selected travel mode.
  2. Sample AQI — WAQI API is queried every ~3 km along each route; results are cached to avoid redundant calls.
  3. Score — Routes are ranked by average AQI. Lower AQI = cleaner air = better score.
  4. Display — Each route card shows distance, estimated duration, and a color-coded AQI badge (Good / Moderate / Unhealthy).

Contributing

  1. Fork the repo
  2. Create a feature branch: git checkout -b feat/your-feature
  3. Commit your changes: git commit -m 'feat: add your feature'
  4. Push and open a PR

License

MIT

About

AiroPath calculates multiple routes between two points and ranks them by real-time AQI (Air Quality Index) — so you can choose the cleanest path, not just the fastest one.

Topics

Resources

Stars

10 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages