Getting started
Thank you for your interest in contributing to F1 PitLane Predict! This guide will help you set up your development environment and understand our workflow.Prerequisites
Before you begin, ensure you have the following installed:- Node.js 20 (LTS) or higher - Download here
- npm - Comes with Node.js
- Git - For version control
- PostgreSQL - For the database
- Prisma CLI - Installed via npm
Initial setup
Your application should now be running:
- Frontend:
http://localhost:5173 - Backend: Check terminal output for port
Development workflow
Branching strategy
We follow a simple Git workflow:-
Create a feature branch from
main: - Make your changes in the feature branch
- Commit frequently with clear messages
- Push your branch and create a pull request
Use descriptive branch names like
feature/add-betting-system, fix/driver-update-bug, or docs/update-readme.Code organization
Frontend components
When creating new Vue components:- Place reusable components in
src/components/ - Place page-level components in
src/views/ - Use PascalCase for component names:
DriverCard.vue,RaceResults.vue - Keep components focused on a single responsibility
Backend endpoints
When adding new API endpoints:- Group related endpoints in directories:
api/resource-name/ - Follow naming conventions:
index.ts- GET all or single itemcreate.ts- POST new itemupdate.ts- PUT/PATCH existing itemdelete.ts- DELETE item
- Use Nitro’s
defineEventHandler()for all endpoints
Database changes
When modifying the database schema:- Edit
prisma/schema.prisma - Create a migration:
npx prisma migrate dev --name description-of-change - Regenerate Prisma client:
npx prisma generate - Test the migration thoroughly
Code style
TypeScript
- Use TypeScript for all new code (
.tsand.vuefiles) - Avoid using
anytype - use specific types or generics - Define interfaces for data structures
- Leverage Prisma-generated types for database models
Vue.js conventions
- Use Composition API for new components
- Prefer
<script setup>syntax - Use TypeScript with
<script setup lang="ts"> - Keep template logic simple - move complex logic to composables
Naming conventions
- Variables and functions: camelCase (
getUserData,driverList) - Components: PascalCase (
DriverCard,RaceTable) - Files: Match component names (
DriverCard.vue) or use kebab-case for utilities - CSS classes: kebab-case (
driver-card,race-table)
Testing your changes
Frontend testing
-
Type check your code:
-
Build the frontend to catch build errors:
-
Manual testing in the browser at
http://localhost:5173
Backend testing
-
Test API endpoints using:
- Browser for GET requests
- Postman, Insomnia, or curl for other methods
- Browser DevTools Network tab
-
Verify database changes using Prisma Studio:
Integration testing
Test the full stack:- Start both frontend and backend servers
- Test user flows from the UI
- Verify data persistence in the database
- Check browser console for errors
- Monitor backend terminal for errors
Pull request process
When you’re ready to contribute your changes:Prepare your changes
- Ensure all changes are committed
- Run type checking:
npm run type-check - Test thoroughly in development
- Update documentation if needed
Create a pull request
- Go to the repository on GitHub
- Click “New Pull Request”
- Select your feature branch
- Fill out the PR template with:
- Clear description of changes
- Why the change is needed
- How to test the changes
- Screenshots (if UI changes)
Code review
- Address reviewer feedback
- Make requested changes
- Push updates to the same branch
- Respond to comments
IDE setup
Recommended: Visual Studio Code
Install these extensions for the best development experience:- Volar - Vue.js language support (disable Vetur if installed)
- TypeScript Vue Plugin (Volar) - TypeScript support in
.vuefiles - Prisma - Syntax highlighting for
.prismafiles - ESLint - Code linting (if configured)
- GitLens - Enhanced Git integration
The Volar extension replaces the older Vetur extension. Make sure to disable Vetur if you have it installed to avoid conflicts.
Editor configuration
VSCode settings for this project:Getting help
If you need assistance:- Check existing GitHub Issues
- Review the documentation
- Create a new issue with the “question” label