Prerequisites
Before installing F1 PitLane Predict, ensure your development environment meets the following requirements:Node.js and npm
F1 PitLane Predict requires Node.js 20 (LTS) or higher.PostgreSQL
The application uses PostgreSQL as its database. You need PostgreSQL 12 or higher installed and running.Development tools
Recommended IDE setup:- VSCode with extensions:
- Volar (Vue Language Features)
- TypeScript Vue Plugin (Volar)
- Prisma (for schema editing)
If you have Vetur installed, disable it when working with Vue 3 projects. Volar is the recommended extension for Vue 3.
Installation steps
1. Clone the repository
Clone the project from GitHub:2. Install dependencies
Frontend dependencies
Install the Vue.js frontend dependencies:| Package | Version | Purpose |
|---|---|---|
vue | ^3.3.4 | Core Vue.js framework |
vue-router | ^4.2.5 | Client-side routing |
vuex | ^4.1.0 | State management |
@prisma/client | ^5.7.0 | Database client |
axios | ^1.6.2 | HTTP client |
jsonwebtoken | ^9.0.2 | JWT authentication |
typescript | ~5.2.0 | Type safety |
vite | ^5.4.20 | Build tool and dev server |
Backend dependencies
Navigate to the server directory and install backend packages:| Package | Version | Purpose |
|---|---|---|
nitropack | latest | Server framework |
bcrypt | ^5.1.1 | Password hashing |
3. Database setup
Create the database
Create a new PostgreSQL database for the application:Configure environment variables
Create a.env file in the project root directory:
.env
username- Your PostgreSQL username (default:postgres)password- Your PostgreSQL passwordlocalhost- Database host (uselocalhostfor local development)5432- PostgreSQL port (default: 5432)f1_pitlane_predict- Database name
Generate Prisma Client
Generate the Prisma Client based on your schema:node_modules/@prisma/client.
Run database migrations
Create the database schema by running migrations:- Creates migration files in
prisma/migrations/ - Applies the migration to your database
- Generates Prisma Client
Verify database schema
Open Prisma Studio to visually inspect your database:http://localhost:5555 where you can view and edit your data.
Database schema overview
The application uses the following data models:Core models
Drivers - F1 driver information- Driver ID, code, and permanent number
- Personal details (name, nationality, date of birth)
- Team association (foreign key to Teams)
- Driver image and profile URL
- Team ID, name, and nationality
- Team logo and official URL
- One-to-many relationship with Drivers
- Season, round, and race name
- Circuit information (ID, name, location, country)
- Date and time of the race
- One-to-many relationship with Results
- Links to Race and Driver (foreign keys)
- Finishing position and points awarded
- Username, email, and hashed password
- Account balance for betting features
- User type (regular/admin)
- Created date and last login tracking
- Links to User, Race, and Driver
- Bet amount, odds, and status
- Created timestamp
The Bets model is included in the schema for future betting functionality but is not fully implemented in the current version.
Configuration
Frontend configuration
The frontend uses Vite for development and building. Configuration is invite.config.ts.
Backend configuration
The Nitro.js backend is configured inserver/nitro.config.ts:
server/nitro.config.ts
Running the application
Development mode
Run both the frontend and backend in development mode: Terminal 1 - Frontend:http://localhost:5173
Terminal 2 - Backend:
http://localhost:3000
Production build
Build the frontend for production:Troubleshooting
Prisma Client errors
If you encounter “Cannot find module ‘@prisma/client’” errors:prisma/schema.prisma.
Database connection issues
Test your database connection:- Verify PostgreSQL is running:
pg_isready - Check credentials in
.env - Ensure the database exists
- Verify firewall/network settings
Type errors in Vue components
Vue 3 with TypeScript requires special handling. Ensure you have:vue-tscinstalled (dev dependency)- TypeScript Vue Plugin (Volar) enabled in VSCode
- Vetur extension disabled
Port conflicts
If ports 5173 or 3000 are in use:Next steps
API reference
Explore the REST API endpoints for drivers, teams, races, and more
Database schema
Deep dive into the Prisma schema and data relationships
Development guide
Learn best practices for developing features
Troubleshooting
Common issues and solutions for setup and development