An open API service indexing awesome lists of open source software.

https://github.com/francostino/f1-graphql-api

A comprehensive and flexible GraphQL API that provides access to historical and real-time Formula 1 data.
https://github.com/francostino/f1-graphql-api

apollo apollographql f1 formula1 gqloom graphql graphql-yoga lando prisma prisma-orm typescript

Last synced: about 2 months ago
JSON representation

A comprehensive and flexible GraphQL API that provides access to historical and real-time Formula 1 data.

Awesome Lists containing this project

README

          


F1 GraphQL Logo




F1 GraphQL


The Ultimate GraphQL API for Formula 1 Data


All F1 history and statistics at your fingertips through GraphQL

[![MIT License](https://img.shields.io/badge/license-MIT-green?style=for-the-badge)](https://opensource.org/licenses/MIT)
[![Latest Release](https://img.shields.io/github/v/release/FrancoStino/f1-graphql?style=for-the-badge)](https://github.com/FrancoStino/F1-GraphQL/releases)
![Codacy grade](https://img.shields.io/codacy/grade/3c36db6085c54916b38d7b95f9a6ef4e?style=for-the-badge&logo=codacy&logoSize=aut&link=https%3A%2F%2Fapp.codacy.com%2Fgh%2FFrancoStino%2FF1-GraphQL%3Futm_source%3Dgithub.com%26utm_medium%3Dreferral%26utm_content%3DFrancoStino%2FF1-GraphQL%26utm_campaign%3DBadge_Grade)


[![SonarQube Cloud](https://sonarcloud.io/images/project_badges/sonarcloud-light.svg)](https://sonarcloud.io/summary/new_code?id=FrancoStino_F1-GraphQL)



## Table of Contents
- [โœจ Features](#-features)
- [๐ŸŽฌ Demo](#-demo)
- [๐Ÿ Quick Start](#-quick-start)
* [Prerequisites](#prerequisites)
* [Installation](#installation)
- [๐ŸŒ API Endpoints](#-api-endpoints)
- [๐Ÿ“ Example Queries](#-example-queries)
* [Get first ten Drivers](#get-first-ten-drivers)
* [Find Race Results for a Specific Grand Prix](#find-race-results-for-a-specific-grand-prix)
- [๐Ÿ› ๏ธ Tech Stack](#-tech-stack)
- [๐Ÿ“‚ Project Structure](#-project-structure)
- [๐Ÿ”„ CI/CD Workflows](#-cicd-workflows)
- [๐Ÿ“œ License](#-license)
- [๐Ÿ‘จโ€๐Ÿ’ป Author](#-author)
- [๐Ÿ† Acknowledgements](#-acknowledgements)


## โœจ Features

- **๐Ÿš€ Dual GraphQL Engines** - Choose between Apollo Server and GraphQL Yoga interfaces
- **๐Ÿ“Š Complete F1 Database** - Access comprehensive Formula 1 historical data
- **๐Ÿ”„ Automated Updates** - Database refreshed daily with the latest F1 statistics
- **โšก High Performance** - Built on modern Node.js with TypeScript and Prisma v7 ORM (Direct TCP)
- **๐Ÿงฉ Rich Query Options** - Filter, paginate, and explore F1 data with flexible queries


## ๐ŸŽฌ Demo


F1 GraphQL Demo

Watch F1 GraphQL in action



## ๐Ÿ Quick Start


### Prerequisites

- Node.js (v22.12+ or v24.0+)
- Yarn package manager
- PostgreSQL database
- [Lando](https://lando.dev/)


### Installation

```bash
# Clone the repository
git clone git@github.com:FrancoStino/F1-GraphQL.git

# Navigate to the project directory
cd F1-GraphQL

# Configure your environment
cp .env.example .env
# Edit .env with your database connection string

# Start Lando
lando start

# Import from ZIP archive
lando db-import db/f1db-sql-postgresql-single-inserts.zip

# Install dependencies
yarn install

# Generate Prisma client (v7 with Direct TCP)
yarn generate

# Start development server
yarn dev
```

### Export database to ZIP file
```bash
lando db-export
```


## ๐ŸŒ API Endpoints

Once running, access your GraphQL API through:

| Endpoint | URL | Description |
|----------|-----|-------------|
| ๐Ÿ  **Landing Page** | `http://localhost:4000/` | Main welcome page with links |
| ๐Ÿงช **GraphQL Yoga** | `http://localhost:4000/graphql` | GraphiQL interface for testing |
| ๐Ÿš€ **Apollo Server** | `http://localhost:4000/apollo` | Apollo Sandbox environment |


## ๐Ÿ“ Example Queries


### Get first ten Drivers

```graphql
query Drivers {
findManyDriver(take: 10) {
id
firstName
lastName
name
fullName
gender
dateOfBirth
}
}
```


### Find Race Results for a Specific Grand Prix

```graphql
query Race {
findManyRace(take: 50) {
year
turns
laps
}
}
```


## ๐Ÿ› ๏ธ Tech Stack

**๐Ÿ”„ Updated to Prisma v7 with Direct TCP connectivity for optimal performance**




GQLoom

GQLoom




TypeScript

TypeScript




GraphQL

GraphQL




Prisma

Prisma v7




Apollo

Apollo




GraphQL Yoga

Yoga




Lando

Lando



## ๐Ÿ“‚ Project Structure

```
f1-graphql/
โ”œโ”€โ”€ .github/ # GitHub Actions workflows for CI/CD
โ”œโ”€โ”€ assets/ # Static assets (images, CSS)
โ”œโ”€โ”€ prisma/ # Database schema and generated client
โ”œโ”€โ”€ src/
โ”‚ โ”œโ”€โ”€ providers/ # Database client provider
โ”‚ โ”œโ”€โ”€ resolvers/ # GraphQL resolvers configuration
โ”‚ โ”œโ”€โ”€ schema/ # GraphQL schema generation
โ”‚ โ”œโ”€โ”€ servers/ # Server configurations
โ”‚ โ”‚ โ”œโ”€โ”€ ApolloServer.ts
โ”‚ โ”‚ โ”œโ”€โ”€ Express.ts
โ”‚ โ”‚ โ”œโ”€โ”€ GraphQL-Yoga.ts
โ”‚ โ”‚ โ””โ”€โ”€ LandingPage.ts
โ”‚ โ”œโ”€โ”€ utils/ # Utility functions
โ”‚ โ””โ”€โ”€ index.ts # Main entry point
```


## ๐Ÿ”„ CI/CD Workflows

This project uses GitHub Actions for:

- **Daily Data Updates**: Automatically refreshes the F1 database
- **Release Management**: Generates changelogs and tags
- **Branch Syncing**: Keeps development branches in sync


## ๐Ÿ“œ License

This project is licensed under the MIT License.


## ๐Ÿ‘จโ€๐Ÿ’ป Author

**Davide Ladisa**


## ๐Ÿ† Acknowledgements

- [F1DB](https://github.com/f1db/f1db) - The comprehensive Formula 1 database
- [GQLoom](https://gqloom.dev/) - GraphQL tooling that powers our schema

---


๐ŸŽ๏ธ Ready to race with F1 data? Star this repo and buckle up! ๐Ÿ