Fastlytics Wiki
Overview
Fastlytics is a lightning-fast platform for Formula 1 fans to explore historical data, compare drivers, and simulate race strategies. The platform provides an intuitive interface for analyzing Formula 1 data without requiring an engineering degree.
Table of Contents
- Fastlytics Wiki
Project Architecture
Fastlytics uses a modern web architecture with:
- Frontend: React-based application with Tailwind CSS and shadcn/ui
- Backend: FastAPI Python backend that processes Formula 1 data using FastF1 API
- Authentication: Supabase for user authentication and data storage
- Infrastructure: Containerized with Docker, hosted on Oracle Cloud
The application follows a client-server architecture where:
- Frontend requests data from the backend API
- Backend processes F1 data (either from cache or live processing)
- Results are cached for future requests to improve performance
Getting Started
Prerequisites
- Node.js v18+
- Python 3.10+
- Docker (for local Supabase/PostgreSQL)
Installation
-
Clone the repository:
git clone https://github.com/subhashhhhhh/Fastlytics.git -
Install frontend dependencies:
npm install -
Install backend dependencies:
git clone https://github.com/subhashhhhhh/Fastlytics-Backend.git pip install -r requirements.txt
Environment Setup
-
Configure environment variables:
cp .env.example .env -
Configure backend environment variables:
cp .env.example .env
Frontend
Frontend Tech Stack
- React: UI library
- Tailwind CSS: Utility-first CSS framework
- shadcn/ui: UI components based on Radix UI
- React Router: Client-side routing
- React Query: Data fetching and state management
- Supabase JS Client: Authentication and database interactions
Frontend Structure
src/
├── components/ # Reusable UI components
├── contexts/ # React contexts for state management
├── data/ # Static data and constants
├── hooks/ # Custom React hooks
├── lib/ # Utility functions and services
├── pages/ # Page components
└── App.tsx # Main application component
Key Components
- App.tsx: The main application component that sets up routing, providers, and layouts
- AuthProvider: Context for managing authentication state
- SeasonProvider: Context for managing the selected F1 season
- Dashboard: Main entry point after login showing F1 data overview
- Race: Detailed view for a specific race, including telemetry and comparisons
- DriverStandings/TeamStandings: Displays current championship standings
Authentication
Authentication is handled through Supabase, with protected routes that require login. The ProtectedRoute component ensures users are authenticated before accessing certain pages.
Backend
Backend Tech Stack
- FastAPI: Modern, high-performance web framework for Python
- FastF1: Python library for accessing Formula 1 data
- Pandas: Data manipulation and analysis
- Uvicorn/Gunicorn: ASGI server for running the application
API Endpoints
The backend provides several endpoint categories:
-
Schedule Endpoints: Get F1 season schedule
/api/schedule/{year}
-
Session Data Endpoints: Get data about specific sessions
/api/session/drivers- List of drivers in a session/api/laps/driver- Lap numbers for a specific driver/api/laptimes- Compare lap times between drivers/api/telemetry/speed- Speed telemetry data for a driver/api/telemetry/gear- Gear shift telemetry data/api/comparison/sectors- Sector time comparisons between drivers/api/strategy- Tire strategy data/api/lapdata/positions- Lap-by-lap position data
-
Standings Endpoints: Get championship standings
/api/standings/drivers- Driver championship standings/api/standings/teams- Constructor championship standings
-
Results Endpoints: Get race results
/api/results/races- Race results summary/api/results/race/{year}/{event_slug}- Specific race result
Data Processing
Data processing is handled by two key components:
-
Processor: A script that processes raw F1 data and caches it for faster access
- Handles race data, qualifying sessions, practice sessions
- Processes telemetry data for speed, gear shifts, etc.
- Calculates championship standings and race results
-
API Handlers: The main.py file defines API endpoints that serve processed data
- Checks cache for pre-processed data
- Falls back to live processing when needed
- Formats data for frontend consumption
Development Workflow
Running Locally
-
Start the frontend development server:
npm run dev -
Start the backend server:
uvicorn main:app --reload
Contributing Guidelines
- Fork the repository
- Create a branch:
git checkout -b feature/brazilian-gp-2023 - Commit changes:
git commit -m "Added Hamilton's magic telemetry" - Push:
git push origin feature/brazilian-gp-2023 - Submit a PR
Deployment
The application is deployed across multiple platforms:
- Frontend: Hosted on a cloud provider with static site hosting
- Backend: Deployed using Docker containers on Oracle Cloud
- Database: Supabase for PostgreSQL database hosting
Deployment is managed through CI/CD pipelines that build, test, and deploy the application automatically.
Troubleshooting
Common Issues
- API Key Errors: Ensure your FASTLYTICS_API_KEY environment variable is set correctly in the backend
- Data Cache Errors: Check that the DATA_CACHE_PATH directory exists and is writable
- FastF1 API Issues: The FastF1 library may occasionally have issues with certain race data or API changes
- Authentication Problems: Verify Supabase configuration and credentials
Getting Help
If you encounter issues not covered in this wiki:
- Check the GitHub issues for similar problems
- Submit a new issue with detailed information about the problem
- Reach out to the maintainers through the project's communication channels