RaceHub is a comprehensive platform for managing racing events, including cycling, running, and trail running competitions. Built with Symfony 7.2, it provides a robust API for event management and participant tracking.
- Multi-sport event management
- User authentication and authorization
- Participant registration system
- Race results tracking
- Admin dashboard
- PHP 8.2+
- Composer
- MySQL
- Symfony CLI
- Clone the repository:
git clone https://github.com/yourusername/racehub.git
cd racehub- Install dependencies:
composer install- Configure environment:
cp .env.example .env- Set up database:
php bin/console doctrine:database:create
php bin/console doctrine:migrations:migrate- Generate JWT keys:
php bin/console lexik:jwt:generate-keypair- Start server:
symfony server:starthttps://api.racehub.com
Endpoint: POST /api2/auth/login_check
Description: Authenticate user and get JWT token.
Request Body:
{
"email": "string",
"password": "string"
}Response:
{
"user":
{
"id": 1,
"email": "user@example.com",
"roles": ["ROLE_USER"]
},
"message": "Login successful"
}
Endpoint: POST /api/auth/logout
Description: Ends user session.
Response:
{
"message": "Logout successful"
}Endpoint: GET /api/user
Response:
[
{
"id": 1,
"email": "john@example.com",
"roles": ["ROLE_USER"],
"name": "John Doe",
"banned": false
}
]Endpoint: GET /api/user/:id
Response:
{
"id": 1,
"email": "john@example.com",
"roles": ["ROLE_USER"],
"name": "John Doe",
"banned": false
}Endpoint: PUT /api/user/:id/edit
Request Body:
{
"email": "new@example.com",
"roles": ["ROLE_ADMIN"],
"name": "John Updated",
"oldpassword": "oldpass",
"newpassword": "newpass",
"banned": false
}Response:
{
"success": true
}Endpoint: GET /api/cycling
Response:
[
{
"id": 1, "name": "Tour de Example",
"description": "Annual cycling event",
"date": "2024-06-15T09:00:00Z",
"distance_km": 150,
"location": "Paris",
"image": "url-to-image"
}
]Endpoint: GET /api/cycling/:id
Response:
{
"id": 1,
"name": "Tour de Example",
"description": "Annual cycling event",
"date": "2024-06-15T09:00:00Z",
"distance_km": 150,
"location": "Paris",
"image": "url-to-image"
}Endpoint: GET /api/cycling_participant/
Response:
[
{
"id": 1,
"user": 1,
"cycling": 1,
"time": "02:30:00",
"dorsal": 101,
"banned": false
}
]Endpoint: POST /api/cycling_participant/new
Request Body:
{
"user": 1,
"cycling": 1,
"time": "02:30:00",
"dorsal": 101,
"banned": false
}Response:
{
"id": 1,
"user": 1,
"cycling": 1,
"time": "02:30:00",
"dorsal": 101,
"banned": false
}Endpoint: DELETE /api/cycling_participant/:id
Response:
{
"success": true
}| Code | Meaning |
|---|---|
| 200 | Success |
| 201 | Created |
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not Found |
| 422 | Validation Error |
| 500 | Server Error |
Error Response Format:
{
"status": "error",
"code": 400,
"message": "Error description",
"errors":
[
{
"field": "username",
"message": "Username is required"
}
]
}- Fork the repository.
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open Pull Request.
- Follow PSR-12
- Write unit tests
- Document new features
- Issues: GitHub Issues
- Email: support@racehub.com
- Documentation: [Link to detailed documentation]
RaceHub is a web application for managing running, cycling, and trail running races with participant registration and management.
- Docker and Docker Compose
- Git
- PHP 8.1+ (for local development without Docker)
- Composer (for local development without Docker)
git clone https://your-repository-url/racehubJWT.git
cd racehubBefore starting the Docker containers:
- If you're on Windows, open Git Bash and run:
dos2unix ./backend/entrypoint.sh ./nginx/certs.sh- If you're on Linux, install dos2unix first and then run the same command:
sudo apt-get install dos2unix
dos2unix ./backend/entrypoint.sh ./nginx/certs.sh- Make sure there is no ./backend/composer.lock file the first time you start the project:
rm -f ./backend/composer.lock- Start the Docker containers:
docker-compose up --build- To run in detached mode (background):
docker-compose up -d- Web Interface: http://localhost:81
- PHPMyAdmin: http://localhost:8080
- backend/ - Symfony backend with API Platform
- nginx/ - Nginx configuration for serving the application
- docker-compose.yml - Docker configuration
The application uses JWT (JSON Web Token) for authentication. Tokens are valid for 7 days.