• Townie
    AI
  • Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
eliot

eliot

F1Rankings

Public
Like
F1Rankings
Home
Code
2
README.md
H
index.ts
Branches
1
Pull requests
Remixes
History
Environment variables
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
/
Code
/
Search
index.ts
https://eliot--42f39ca0a57c11f0a6550224a6c84d84.web.val.run
README.md

F1 Rankings API

A REST API that provides current Formula 1 championship standings for both drivers and constructors. The API attempts to fetch real-time data from live F1 sources and falls back to current 2024 season data when live APIs are unavailable.

🏁 Features

  • Real-time data attempts: Tries to fetch live F1 data from multiple sources
  • Reliable fallback: Uses current 2024 F1 season data when live APIs are unavailable
  • Multiple endpoints: Separate endpoints for drivers, constructors, or both
  • Clean JSON responses: Well-structured data with metadata
  • CORS enabled: Works with web applications
  • Health check: Monitor API status

📡 Endpoints

GET /

Returns both driver and constructor standings in a single response.

Response:

{ "season": "2024", "drivers": [ { "position": 1, "driver": "Max Verstappen", "nationality": "Dutch", "team": "Red Bull Racing", "points": 393, "wins": 9 } // ... more drivers ], "constructors": [ { "position": 1, "constructor": "McLaren", "nationality": "British", "points": 593, "wins": 5 } // ... more constructors ], "source": "Static data (Live API unavailable)", "note": "This data reflects the 2024 F1 season standings as of October 2024...", "lastUpdated": "2024-10-10T00:00:00Z" }

GET /drivers

Returns only the driver championship standings.

Response:

{ "season": "2024", "standings": [ { "position": 1, "driver": "Max Verstappen", "nationality": "Dutch", "team": "Red Bull Racing", "points": 393, "wins": 9 } // ... more drivers (complete top 20) ], "source": "Static data (Live API unavailable)", "note": "This data reflects the 2024 F1 season standings...", "lastUpdated": "2024-10-10T00:00:00Z" }

GET /constructors

Returns only the constructor championship standings.

Response:

{ "season": "2024", "standings": [ { "position": 1, "constructor": "McLaren", "nationality": "British", "points": 593, "wins": 5 } // ... more constructors (complete top 10) ], "source": "Static data (Live API unavailable)", "note": "This data reflects the 2024 F1 season standings...", "lastUpdated": "2024-10-10T00:00:00Z" }

GET /health

Health check endpoint for monitoring.

Response:

{ "status": "healthy", "timestamp": "2024-10-10T02:02:41.123Z", "version": "1.0.0" }

📊 Data Structure

Driver Object

  • position: Championship position (number)
  • driver: Full name of the driver (string)
  • nationality: Driver's nationality (string)
  • team: Constructor/team name (string)
  • points: Total championship points (number)
  • wins: Number of race wins (number)

Constructor Object

  • position: Championship position (number)
  • constructor: Team/constructor name (string)
  • nationality: Constructor's nationality (string)
  • points: Total championship points (number)
  • wins: Number of race wins (number)

Response Metadata

  • season: F1 season year (string)
  • source: Data source information (string)
  • note: Additional context about the data (string, optional)
  • lastUpdated: ISO timestamp of last data update (string)

🚀 Usage Examples

# Get all standings curl https://your-val-url.web.val.run/ # Get only driver standings curl https://your-val-url.web.val.run/drivers # Get only constructor standings curl https://your-val-url.web.val.run/constructors # Health check curl https://your-val-url.web.val.run/health

🔧 Implementation Details

Data Sources

  1. Primary: Ergast F1 API (HTTPS)
  2. Secondary: Ergast F1 API (HTTP)
  3. Fallback: Current 2024 F1 season data

Current Fallback Data (October 2024)

The API includes up-to-date 2024 F1 championship standings including:

  • Driver Championship: Max Verstappen leading with 393 points
  • Constructor Championship: McLaren leading with 593 points
  • Complete standings for all 20 drivers and 10 constructors

Error Handling

  • Graceful fallback when live APIs are unavailable
  • Timeout protection (5 seconds per API call)
  • Detailed logging for debugging
  • Clear source attribution in responses

🛠️ Technical Stack

  • Framework: Hono (fast HTTP framework)
  • Runtime: Deno on Val Town
  • Language: TypeScript
  • APIs: Ergast F1 API (when available)

🔮 Future Enhancements

  • Integration with additional F1 data sources
  • Caching layer for improved performance
  • Historical season data endpoints
  • Race results and calendar information
  • WebSocket support for real-time updates
  • Rate limiting for production use

📝 Notes

  • The API prioritizes reliability over real-time accuracy
  • Fallback data is manually curated and reflects recent F1 standings
  • Live API integration attempts are made on every request
  • All timestamps are in ISO 8601 format
HTTP
  • index.ts
    eliot--42…84.web.val.run
Code
README.md
H
index.ts
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
ExploreDocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.