A lightweight Expo-powered React Native application that fetches and displays today's global atmospheric CO₂ concentration (in parts per million). The data is sourced dynamically through OpenAI's web search capability.
-
Install dependencies
npm install
Note In the hosted sandbox used for development the install step fails with a
403 Forbiddenresponse from the npm registry. This is an environment/network restriction rather than an issue with the project. Install the dependencies locally or in any environment that has access to the public npm registry. -
Configure your OpenAI credentials
- Create a
.envfile or export the variable before starting Expo:export EXPO_PUBLIC_OPENAI_API_KEY="your_openai_api_key"
- Alternatively, edit
app.jsonand populateexpo.extra.openaiApiKey(not recommended for checked-in secrets).
- Create a
-
Run the app
npm run start
Use the Expo CLI output to open the app on an emulator, a device, or the web.
- On launch (and whenever the user pulls to refresh), the app calls the OpenAI
responsesAPI with theweb_searchtool enabled. - The assistant is instructed to return a strict JSON payload containing:
ppm: the latest measured global CO₂ concentration.source: a citation URL returned from the search.timestamp: the ISO 8601 date/time for the measurement.
- The UI presents the value, measurement timestamp, and a tappable source link.
- Error states (e.g., missing API keys or parsing issues) are surfaced to the user so they can resolve configuration problems quickly.
- Because the app depends on OpenAI's live web search, running it requires network connectivity and an account with access to the
responsesAPI and theweb_searchtool. - Expo SDK 50 is used to maximize compatibility across iOS, Android, and web targets.