Skip to content

Free hyperlocal weather API for 50 San Francisco neighborhoods. No API key required. Claude Code and Clawdbot Skills

License

Notifications You must be signed in to change notification settings

solo-founders/sf-microclimates

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SF Microclimates API

License: MIT Free API

Real weather for 50 San Francisco neighborhoods. Free API. No key required.

🌐 Live API: microclimates.solofounders.com

Example website: view weather in all regions of San Francisco

Use with Claude Code, Clawdbot, or build into your apps.

Built by Solo Founders.


Why This Exists

SF has the most dramatic microclimates of any US city.

Weather apps say "San Francisco: 58Β°F" β€” but that's useless. It can be 52Β°F and foggy in the Outer Sunset while it's 65Β°F and sunny in the Mission, just 3 miles apart.

This API aggregates 150+ outdoor sensors and groups them by neighborhood, so you get actual local temperatures β€” not some airport reading from SFO.


Try It Instantly

curl https://microclimates.solofounders.com/sf-weather/mission
{
  "neighborhood": "mission",
  "name": "Mission District",
  "temp_f": 58,
  "humidity": 52,
  "pm2_5": 12.1,
  "aqi": 50,
  "aqi_category": "Good",
  "sensor_count": 8
}

No API key. No signup. Just use it.


Add to Claude Code or Clawdbot

Copy and paste this into your skills folder:

# Create a new skill: sf-microclimates/SKILL.md


# SF Microclimates Skill

Get real-time SF neighborhood weather.

## Triggers
- "weather in [neighborhood]"
- "sf weather mission vs sunset"
- "is it foggy in the richmond?"

## Usage
curl https://microclimates.solofounders.com/sf-weather/marina

## Neighborhoods
mission, castro, marina, soma, haight, noe_valley,
outer_sunset, inner_sunset, outer_richmond, presidio,
north_beach, pacific_heights, potrero, twin_peaks...

Use Cases

  • AI agents β€” Give your agent real local weather context
  • Home automation β€” Trigger based on your actual neighborhood temp
  • Slack/Discord bots β€” Settle "is it foggy?" arguments
  • Travel apps β€” Show tourists what to actually expect
  • Personal dashboards β€” Finally, weather that matches your window

Endpoints

Endpoint Description
GET /sf-weather All 50 neighborhoods
GET /sf-weather/:neighborhood Single neighborhood
GET /neighborhoods List all available

50 Neighborhoods

From Marina to Noe Valley, Presidio to Twin Peaks β€” every SF neighborhood mapped.

curl https://microclimates.solofounders.com/neighborhoods

Includes: mission, castro, marina, soma, haight, noe_valley, outer_sunset, inner_richmond, north_beach, pacific_heights, potrero, dogpatch, bayview, twin_peaks, presidio, tenderloin, chinatown, japantown, cole_valley, glen_park, and 30 more.


Response Format

Single Neighborhood

{
  "updated": "2026-01-25T23:00:00.000Z",
  "neighborhood": "outer_sunset",
  "name": "Outer Sunset",
  "temp_f": 52,
  "humidity": 78,
  "pm2_5": 8.3,
  "aqi": 35,
  "aqi_category": "Good",
  "sensor_count": 15
}

All Neighborhoods

{
  "updated": "2026-01-25T23:00:00.000Z",
  "neighborhoods": {
    "mission": { "temp_f": 58, "humidity": 52, "pm2_5": 12.1, "aqi": 50, "aqi_category": "Good", "sensor_count": 8 },
    "outer_sunset": { "temp_f": 52, "humidity": 78, "pm2_5": 8.3, "aqi": 35, "aqi_category": "Good", "sensor_count": 15 },
    "marina": { "temp_f": 55, "humidity": 65, "pm2_5": 18.5, "aqi": 64, "aqi_category": "Moderate", "sensor_count": 6 }
  }
}

Air Quality

Each response includes real-time air quality data from PurpleAir sensors.

Response Fields

Field Description
pm2_5 PM2.5 concentration in Β΅g/mΒ³ (10-minute rolling average)
aqi Air Quality Index (0-500 scale)
aqi_category Human-readable AQI category

AQI Categories

AQI Range Category Description
0–50 Good Air quality is satisfactory
51–100 Moderate Acceptable; moderate health concern for sensitive individuals
101–150 Unhealthy for Sensitive Groups Sensitive groups may experience health effects
151–200 Unhealthy Everyone may begin to experience health effects
201–300 Very Unhealthy Health alert; everyone may experience serious effects
301+ Hazardous Health emergency; entire population affected

Calculation Method

AQI is calculated from PM2.5 using the US EPA formula:

  1. The pm2.5_10minute field (10-minute rolling average) is used for real-time responsiveness
  2. PM2.5 concentration is mapped to AQI breakpoints per EPA standards
  3. Linear interpolation determines the final AQI value

This gives you accurate, hyperlocal air quality β€” not a city-wide average from a distant monitoring station.


Self-Hosting

Want to run your own instance?

1. Clone & Install

git clone https://github.com/solo-founders/sf-microclimates.git
cd sf-microclimates
npm install

2. Get a PurpleAir API Key

This API uses PurpleAir sensors. Sign up at develop.purpleair.com β€” free for personal use.

3. Create KV Namespace

wrangler kv:namespace create "CACHE"

Add the output to wrangler.toml:

[[kv_namespaces]]
binding = "CACHE"
id = "your-kv-namespace-id"

4. Set Your API Key

wrangler secret put PURPLEAIR_API_KEY

5. Deploy

wrangler deploy

Local Development

echo "PURPLEAIR_API_KEY=your-key" > .dev.vars
wrangler dev

Configuration

Variable Default Description
CACHE_TTL_SECONDS 3600 Cache duration (1 hour)
RATE_LIMIT_PER_MINUTE 60 Max requests per IP

How It Works

  1. Request comes in β†’ rate limit check
  2. Check Cloudflare KV cache β†’ return if fresh
  3. Cache miss β†’ fetch outdoor sensors from PurpleAir (location_type=0)
  4. Group sensors by neighborhood GPS bounding boxes
  5. Calculate averages, cache for 1 hour
  6. Return JSON with CORS headers

Fork for Your City

LA, Seattle, NYC, Chicago, Austin β€” every city has microclimates.

The neighborhood bounding boxes are in src/index.ts. To adapt:

  1. Update SF_NEIGHBORHOODS with your city's areas + GPS coordinates
  2. Change the PurpleAir bounding box to your city
  3. Update branding
  4. Deploy

PRs welcome! We'd love to see la-microclimates, nyc-microclimates, etc.


Credits


License

MIT β€” use it however you want.

About

Free hyperlocal weather API for 50 San Francisco neighborhoods. No API key required. Claude Code and Clawdbot Skills

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •