F1 Championship Stats 🏎
See how your favorite F1 team is progressing in the Constructors Championship using the PlanetScale serverless driver for JavaScript and edge functions.
How it works
All of the data for this application is returned through edge functions from various providers (Cloudflare Workers, Vercel Edge Functions, Netlify Edge Functions). Read more about the benefits of the PlanetScale serverless driver for JavaScript and the next generation of PlanetScale infrastruction in our latest blog post.
Each of these edge functions connects to a PlanetScale database via our serverless driver, @planetscale/database
, and returns a JSON payload with F1 stats to render the page.
You can use these as examples for how to start using your PlanetScale database from an edge function.
The frontend application is a Next.js app running on Vercel.
Note: Before using
@planetscale/database
, make sure to enroll your database in the PlanetScale serverless driver for JavaScript beta (under your database's Settings > Beta features section).
Local development
To run the frontend (UI).
npm install
npm run dev
Visit http://localhost:3000 in your browser.
Edge functions
To learn more about how to run each function, visit the subdirectories for each:
Thank you ❤️
The F1 stats shown in this application are from the Ergast Developer API.
License
The project is available as open source under the terms of the Apache-2.0 license.