Skip to content

nintang/devdays

Repository files navigation

Vera — Verification, Emissions Reporting & Accountability

Vera is a Next.js emissions insights app with an AI Copilot for exploring facility and regional emissions data on an interactive map and dashboard.

What’s inside

  • AI Copilot (/copilot): ask natural-language questions, see results as action cards (locations, stats, charts), and visualize results on a Mapbox map.
  • Dashboard (/dashboard): filter and explore assets and sector breakdowns.
  • Landing / hero pages (/, /hero).

Primary sectors include power, transportation, manufacturing, agriculture, buildings, waste, land use, and more (via upstream datasets).

Quickstart

Prerequisites

  • Node.js: 18+ recommended
  • npm: comes with Node

1) Configure environment variables

Create .env.local in the project root:

# Required: OpenAI (AI Copilot + facility research)
OPENAI_API_KEY=your_openai_api_key_here

# Required: Mapbox (map rendering in /copilot)
NEXT_PUBLIC_MAPBOX_ACCESS_TOKEN=your_mapbox_access_token_here

# Optional: Tavily (enables web search for some Q&A flows, if wired)
TAVILY_API_KEY=your_tavily_api_key_here
  • Get an OpenAI key: https://platform.openai.com/api-keys
  • Get a Mapbox token: https://account.mapbox.com

2) Install & run

npm install
npm run dev

Open:

  • http://localhost:3000 (landing)
  • http://localhost:3000/copilot (AI Copilot)
  • http://localhost:3000/dashboard (dashboard)

Example Copilot prompts

Show me the top 5 most polluted places in Louisiana
Show me power plants in Texas
Compare emissions between Texas and California
Get emissions statistics for New York
Find manufacturing facilities in Illinois

API routes

  • POST /api/copilot: AI chat endpoint (function/tool calling + streaming responses).
  • POST /api/facility-research: “Learn more with AI” facility research used from the map popups.

Scripts

npm run dev          # Start dev server (Turbopack)
npm run build        # Production build (Turbopack)
npm run start        # Start production server
npm run lint         # ESLint

npm run generate:api   # Generate fetch client from openapi.json -> lib/api/
npm run generate:types # Generate types from openapi.json -> lib/api/types.ts

Project structure (high level)

  • app/: Next.js App Router pages and API routes
    • app/copilot/page.tsx: Copilot UI (map + prompt + action sidebar)
    • app/dashboard/page.tsx: Dashboard UI
    • app/api/*/route.ts: server endpoints
  • components/: UI + action cards + layout components
  • lib/: API client, types, and climate/emissions utilities
  • openapi.json: OpenAPI spec used to generate the typed client

Data sources & notes

  • Emissions/assets: Climate TRACE (https://climatetrace.org/)
  • Map rendering: Mapbox GL JS (requires NEXT_PUBLIC_MAPBOX_ACCESS_TOKEN)
  • County/parish boundaries (Copilot overlay): fetched at runtime from a public GeoJSON dataset

Troubleshooting & docs

  • Troubleshooting: see TROUBLESHOOTING.md
  • Implementation notes: see IMPLEMENTATION_SUMMARY.md

About

Vera is a Next.js emissions insights app with an AI Copilot for exploring facility and regional emissions data on an interactive map and dashboard.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors