Skip to content

FrancoStino/F1-GraphQL-API

Repository files navigation

F1 GraphQL Logo

The Ultimate GraphQL API for Formula 1 Data

All F1 history and statistics at your fingertips through GraphQL

MIT License Latest Release Codacy grade
SonarQube Cloud


Table of Contents

✨ 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
  • MariaDB/MySQL database
  • Lando

Installation

# 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-mysql-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

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

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

Find Race Results for a Specific Grand Prix

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 - The comprehensive Formula 1 database
  • GQLoom - GraphQL tooling that powers our schema

🏎️ Ready to race with F1 data? Star this repo and buckle up! 🏁

About

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

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

  •  

Contributors 7