F1 GraphQL: The Ultimate GraphQL API for Formula 1 Data
Source: Dev.to
Introduction
F1 GraphQL is an open‑source project that puts the entire history of Formula 1 racing at your fingertips via GraphQL. Whether you’re a racing enthusiast or a developer, this API offers a flexible, efficient, and developer‑friendly way to access comprehensive F1 data—without the limitations of traditional REST APIs.
Production URLs
| Interface | URL |
|---|---|
| Main site | |
| GraphQL Yoga (GraphiQL) | |
| Apollo Server (Apollo Sandbox) |
🚀 Key Features
Dual GraphQL Engines
-
GraphQL Yoga – Integrated GraphiQL interface for real‑time query experimentation.
Access: -
Apollo Server – Apollo Sandbox with advanced developer tools and introspection.
Access:
This dual approach lets you choose the environment that best fits your workflow.
Comprehensive F1 Database
- Driver information & statistics
- Team & constructor data
- Race results & qualifying information
- Circuit details
- Season statistics
- …and much more
The dataset spans the entire history of Formula 1, making it ideal for historical analysis, visualisations, and applications.
Automated Daily Updates
GitHub Actions workflows refresh the database every day using the F1DB source, ensuring the data stays accurate and up‑to‑date without manual effort.
Modern Tech Stack
- Node.js & TypeScript – Type safety and great developer experience
- Prisma ORM – Efficient database access
- GraphQL Yoga & Apollo Server – Two GraphQL endpoints
- GQLoom – Schema tooling
- GitHub Actions – CI/CD and automated data refresh
Sample Queries
# Get the first 10 drivers
query Drivers {
findManyDriver(take: 10) {
id
firstName
lastName
name
fullName
gender
dateOfBirth
}
}
# Get the first 50 races
query Race {
findManyRace(take: 50) {
year
turns
laps
}
}
Using the API in Your Projects
With fetch
// Using fetch
async function fetchF1Data() {
const response = await fetch('https://f1-graphql.davideladisa.it/graphql', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
query: `
query Drivers {
findManyDriver(take: 10) {
id
firstName
lastName
name
fullName
gender
dateOfBirth
}
}
`,
}),
});
const data = await response.json();
return data;
}
With Apollo Client
import { ApolloClient, InMemoryCache, gql } from '@apollo/client';
const client = new ApolloClient({
uri: 'https://f1-graphql.davideladisa.it/graphql',
cache: new InMemoryCache(),
});
client
.query({
query: gql`
query Drivers {
findManyDriver(take: 10) {
id
firstName
lastName
name
fullName
gender
dateOfBirth
}
}
`,
})
.then(result => console.log(result));
Running the Project Locally
# Clone the repository
git clone git@github.com:FrancoStino/F1-GraphQL.git
# Enter the project folder
cd f1-graphql
# Install dependencies
yarn install
# Set up environment variables
cp .env.example .env
# Edit .env with your database connection string
# Generate Prisma client & build
yarn build
# Start the development server
yarn dev
When the server is running you can access:
| Endpoint | URL |
|---|---|
| Landing page | |
| GraphQL Yoga | |
| Apollo Server |
Development Tips
- Use the GraphiQL or Apollo Sandbox interface for rapid query development and testing.
- Explore the generated schema documentation to discover all available types and fields.
- Enable caching (e.g., HTTP cache headers or Apollo Client cache) for better performance in production.
- Implement robust error handling and logging for production‑grade applications.
Why F1 GraphQL Matters
Previously, accessing comprehensive F1 data required juggling multiple sources, dealing with inconsistent APIs, or performing manual data entry. F1 GraphQL solves these problems by providing:
- A single source of truth for all Formula 1 data.
- Flexible querying – request exactly what you need, nothing more.
- Up‑to‑date information via automated daily refreshes.
- Developer‑friendly tooling with both Yoga and Apollo interfaces.
Enjoy building the next generation of F1 apps, dashboards, and visualisations! 🚗💨
Overview
Whether you’re building a fantasy F1 application, creating data visualizations, or simply exploring the rich history of the sport, F1 GraphQL provides the foundation you need.
Getting Involved
F1 GraphQL thrives on its community of Formula 1 enthusiasts and developers. There are many ways to contribute:
- Code contributions – submit pull requests to add new features, fix bugs, or improve documentation.
- Issue reporting – help identify and document bugs or missing features.
- Data validation – ensure the accuracy of Formula 1 data.
- Documentation – improve guides and examples for other developers.
All contributions are welcome, regardless of experience level.
Standard GitHub Workflow
- Fork the repository.
- Create a feature branch.
- Make your changes.
- Submit a pull request.
Community Channels
- GitHub Discussions – join conversations about F1 GraphQL.
- Issue Tracker – find open issues and feature requests to work on.
- Examples Repository – a collection of community‑contributed examples showing F1 GraphQL in action.
Example Projects Built with F1 GraphQL
- F1 data‑visualization dashboards
- Race prediction models
- Fantasy F1 applications
- Historical performance analysis tools
- Mobile apps for race information
If you’ve built something with F1 GraphQL, consider sharing it by submitting it to the examples repository or mentioning it in the GitHub discussions.
Resources
- Tutorials – step‑by‑step guides for common use cases.
- Query Examples – a growing collection of useful GraphQL queries.
- Schema Documentation – auto‑generated documentation of available data and relationships.
Future Enhancements
- Real‑time race data during Grand Prix weekends
- Advanced statistics and aggregations
- Additional data‑visualization tools
- Enhanced performance optimizations
Closing Thoughts
F1 GraphQL represents the intersection of modern web technology and the rich history of Formula 1 racing. By making this data accessible through GraphQL, the project opens up new possibilities for developers, data analysts, and F1 enthusiasts.
If you’re interested in Formula 1 data or want to build applications that leverage it, check out F1 GraphQL. The project is open‑source and available on GitHub under the MIT license.
Ready to race with F1 data?
⭐ Star the repo at and buckle up!
Credits
This guide is based on the F1 GraphQL project created by Davide Ladisa. All credit for the project goes to the original author. If you enjoyed this article, consider supporting the project by starring the GitHub repository and contributing to its development.