• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
TabQuest

TabQuest

weatherAPI

TabQuest - Daily Weather API
Unlisted
Like
weatherAPI
Home
Code
3
src
6
README.md
H
main.ts
Environment variables
3
Branches
2
Pull requests
Remixes
History
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
3/15/2026
Viewing readonly version of main branch: v16
View latest version
README.md

TabQuest Weather API

A lightweight, production-ready weather proxy API built on Val Town. Powers the TabQuest browser extension.

Built on top of OpenWeatherMap with Redis-backed rate limiting and caching via Upstash.


Features

  • Current weather by city name
  • IP-based rate limiting (10 requests/min per IP)
  • 30-minute Redis cache per city — reduces OpenWeather API calls
  • Clean error responses — no internal details leaked to clients
  • CORS enabled — works from browser extensions and web clients

API Usage

Endpoint

GET https://<your-val-town-username>-weatherapi.web.val.run?city=London

Parameters

ParameterTypeRequiredDescription
citystringYesCity name to query

Example Request

curl "https://your-username-weatherapi.web.val.run?city=Chennai"

Example Response

{ "coord": { "lon": 80.2785, "lat": 13.0878 }, "weather": [{ "id": 801, "main": "Clouds", "description": "few clouds" }], "main": { "temp": 305.15, "feels_like": 309.22, "humidity": 70 }, "wind": { "speed": 5.14 }, "name": "Chennai" }

Note: Temperatures are returned in Kelvin by default (OpenWeatherMap standard). Unit conversion should be handled on the client side.

Response Headers

HeaderValueMeaning
X-CacheHIT or MISSWhether response was cached

Error Responses

StatusMessageReason
400Missing 'city' parameterNo city provided
400Invalid city nameCity contains invalid characters
404City not foundOpenWeather couldn't find city
429Rate limit exceeded. Try again in a minuteToo many requests from your IP
500Service misconfiguredMissing env vars on server
502Weather service error. Try again laterOpenWeather upstream error

Self-Hosting

This API is designed to be self-hosted on Val Town. You'll need your own API keys.

1. Fork the Val

Go to the Val Town project and click Remix.

2. Set Environment Variables

Go to val.town/settings/environment-variables and add:

VariableDescription
OPENWEATHER_API_KEYYour OpenWeatherMap API key
UPSTASH_URLREST URL from your Upstash Redis database
UPSTASH_TOKENREST token from your Upstash Redis database

See docs/env-variables.md for detailed setup instructions.

3. Deploy

Val Town deploys automatically on save. Your endpoint will be live at:

https://<your-username>-weatherapi.web.val.run

Project Structure

tabquest-weather-api/
├── src/
│   ├── config.ts       ← constants (rate limit, cache TTL, validation regex)
│   ├── env.ts          ← env var validation + types
│   ├── http.ts         ← CORS headers + JSON response helpers
│   ├── redis.ts        ← Redis client, rate limiting, caching
│   └── weather.ts      ← OpenWeather fetch + error mapping
├── main.ts             ← HTTP entry point
└── README.md

Configuration

All tuneable values live in src/config.ts:

export const RATE_LIMIT = 10; // requests per window per IP export const RATE_WINDOW_SEC = 60; // rate limit window in seconds export const CACHE_TTL_SEC = 60 * 30; // cache TTL (30 minutes)

Part of TabQuest

This API powers TabQuest — an open source browser extension.

⭐ If you find this useful, consider starring the main repo.

tabquest/tabquest — The open source browser extension this API was built for.


FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
AboutAlternativesPricingBlogNewsletterCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2026 Val Town, Inc.