Develop a web app for tyre engineers to manage and track tyre sets for car races. Engineers input the number of tyre sets per type (Soft, Medium, Hard) available for each weekend. They also define the race weekend's sessions (e.g., Free Practice, Qualifying, Race) and specify the number of sets to return after each session except the Race. The app should allow saving these settings for recurring race formats.
The main feature includes planning the tyre usage per session, deciding which sets to return, and visualizing remaining sets for the Race. The app tracks each set's state, indicating whether they are new or used. This tool aims to optimize tyre management during race weekends.
TyreTrack harnesses React for its user-friendly interface and Django for robust backend operations, streamlined within Docker containers for optimal deployment. The system's architecture is centered around RESTful APIs, ensuring efficient, scalable communication between front-end and back-end components. A relational database underpins the application, managing complex data with high efficiency. Additionally, API functionalities and integration are rigorously tested using Postman, guaranteeing reliable and seamless performance. This technical synergy provides a powerful, yet user-centric platform for managing race tyre logistics and strategy.
This project is designed to manage the states and data related to different sets of tyres. Additionally, it provides functionalities to manage weekend formats and sessions. The application consists of a frontend and a backend, both of which are containerized using Docker.
- Clone the repository to your local machine.
- Navigate (
cd
) to the directory containing thedocker-compose.yaml
file. - Run
docker-compose up
. - Access the frontend at http://localhost:3000/.
For backend-specific tests, you can use port 8000: http://localhost:8000/.
-
Tyre Sets
- [GET] http://127.0.0.1:8000/api/tyre_sets/: View all tyre states.
- [GET] http://127.0.0.1:8000/api/tyre_sets//: View the state of a specific tyre set by ID.
- [PUT] http://127.0.0.1:8000/api/tyre_sets//: Modify parameters of a specific tyre set by ID.
-
Weekend Format
- [GET] http://127.0.0.1:8000/api/weekend_format/: View counts of three types of tyres for the weekend.
- [POST] http://127.0.0.1:8000/api/weekend_format/: Add a new weekend object.
-
Weekend Session
- [GET] http://127.0.0.1:8000/api/weekend_session/: View all session data.
- [POST] http://127.0.0.1:8000/api/weekend_session/: Add a new session object.
-
Weekend Templates
- [POST] http://127.0.0.1:8000/api/weekend_format/save_weekend_template/: Save the current weekend format and session objects as a template.
- [GET] http://127.0.0.1:8000/api/weekend_template/: View all saved templates.
- [POST] http://127.0.0.1:8000/api/weekend_format/apply_weekend_template/: Apply the selected template data (not fully debugged).
-
Data Management
- [POST] http://127.0.0.1:8000/api/weekend_format/clear_all_data/: Clear all data, including templates.
- [POST] http://127.0.0.1:8000/api/weekend_format/clear_all_data_keepTemplate/: Clear all data except for templates (not fully debugged).
To configure environment variables for different deployment environments:
Docker Compose:
Define variables in the docker-compose.yml
file under the environment
section for each service.
frontend:
environment:
- REACT_APP_BACKEND_URL=http://your-backend-service
Local Development: For local development, create a .env file in the frontend project and define the variables.
- REACT_APP_BACKEND_URL=http://localhost:8000
The use of Docker Compose simplifies the deployment process. It enables you to set up both the frontend and backend by running a single command, making the setup effortless.
Both the frontend and backend validate input data, providing an extra layer of security.
- The backend has safeguards to restrict the number of tyres that can be returned.
- The frontend performs additional calculations on numerical inputs to ensure the correct number of tyres is used in each race session.
The application uses a relational database and object-oriented programming (OOP) for better data management.
- Data is stored as object properties, which are interconnected through foreign keys and many-to-many relationships, providing clear logic and better data integrity.
The connection between the frontend and backend adheres to RESTful API standards, offering better compatibility and stability.
The application is designed to be user-friendly. It has a straightforward interface and workflow, making it easy to understand and use.
- Comprehensive Data Model: The data model includes entities like 'car' and 'race weekend,' allowing for future extensions, such as multi-team management and multiple weekend management.
- Technology Stack: The application uses a React+Django stack, which can handle most production environments and offers excellent scalability, both in terms of size and features.
- Due to the time constraints of rapid development, some models are not fully utilized. With more time, the relationships between models, especially many-to-many relationships, should be optimized for better data integrity.
- Although the backend API adheres to RESTful API standards, token-based authentication should be added if time allows.
- A login system is required for team and multi-user management. This will likely involve adding a new data model for 'User' and more extensively utilizing the 'Car' model to manage multiple vehicles.
- Limited time has not allowed for comprehensive error handling mechanisms, such as try-catch, to be implemented in both the frontend and backend.
- More comprehensive testing, including unit tests focused on model and view behaviors, and integration tests involving various API requests and static file loading, should be conducted.
- Load testing should also be considered if the software is to be used by multiple teams.
- While Docker Compose is currently used for local deployment, cloud-based deployment should be considered for broader access across different devices like smartphones and iPads.
- The code was mostly written to meet quick development needs, resulting in redundancy and sub-optimal readability.
- The current code has not undergone performance auditing in terms of time and space complexity. A thorough review should be conducted if it is to be used in production.
- The template feature is not fully developed yet. Although the backend APIs related to templates are mostly done, the frontend lacks a stable 'Apply Template' function.
- The interface is functional but not optimized for user interaction.
- Device-specific UI improvements are needed, especially for mobile devices. One idea is to use a stack-based interface for each tyre ID, allowing detailed configurations in a sub-page.
- The current database is SQLite, which may not be adequate for production needs. A robust backup strategy or migration to a cloud-based database service may be necessary.