This repository contains the source code for Diag‑Daddy, a motorcycle diagnostic training platform built with React, React Router, and React Three Fiber. The goal of this project is to provide a realistic, interactive learning environment where users can explore a 3D motorcycle model, practice fault diagnosis through simulated scenarios, and track their progress—all without touching a real bike.
You need Node.js (version 14 or later) and npm installed on your machine. If you don’t already have them, download from nodejs.org.
Clone the repository to your local machine:
git clone <your-fork-url>
cd diag-daddy-react
Install dependencies:
npm install
Start the development server:
npm start
The app will open at http://localhost:3000/. The page will automatically reload when you edit source files.
To create an optimised production build, run:
npm run build
This outputs a build/ directory containing static files that can be deployed to any web server.
diag-daddy-react/
├── public/ # Static assets served at the root
│ ├── index.html # Base HTML template
│ ├── hero-bg.webp # Hero background image
│ ├── logo.png # Diag‑Daddy logo
│ └── models/
│ └── free_merc_hovercar.glb
├── src/
│ ├── App.jsx # Top‑level component and routing
│ ├── index.js # Entry point rendering <App /> into #root
│ ├── index.css # Global styles and CSS variables
│ ├── components/
│ │ ├── NavBar.jsx # Fixed navigation bar
│ │ ├── Home.jsx # Landing page combining hero, 3D model and about
│ │ ├── AboutSection.jsx
│ │ └── InteractiveModel.jsx
│ ├── pages/
│ │ ├── TrainingCenter.jsx
│ │ ├── LearningCenter.jsx
│ │ ├── CompetitiveLearning.jsx
│ │ ├── SignIn.jsx
│ │ └── Register.jsx
│ └── styles/
│ ├── NavBar.css
│ ├── Home.css
│ ├── AboutSection.css
│ ├── InteractiveModel.css
│ ├── Page.css
│ └── Auth.css
└── README.md # You are here
public/index.html – The HTML template used by React to mount the app. Do not put application code here. Static files (images, models) in public are served at the root path.
src/index.js – Entry point that renders the <App /> component into #root. It also wraps the app in a BrowserRouter for client‑side routing.
src/App.jsx – Defines the navigation bar and routes. Each Route corresponds to a page component. Padding is added at the top of <main> to account for the fixed nav height.
src/components/NavBar.jsx – A fixed navigation bar with the site logo on the left and sign‑in/register links on the right. NavLink from React Router automatically adds an active class when the path matches.
InteractiveModel component.src/components/AboutSection.jsx – Describes the Training Center, Learning Center and Competitive Learning sections. Each card uses a <Link> to the corresponding route.
.glb file (public/models/free_merc_hovercar.glb by default). It provides:
--highlight-color defined in src/index.css.src/pages/TrainingCenter.jsx, LearningCenter.jsx, CompetitiveLearning.jsx – Placeholder pages describing future functionality. Each uses a common .page layout from Page.css.
src/pages/SignIn.jsx, Register.jsx – Simple forms demonstrating how the sign‑in and registration pages might look. Real authentication is not implemented. Styles are defined in Auth.css.
index.css.The app ships with a small placeholder model (free_merc_hovercar.glb) for testing. To replace it with your own motorcycle model:
.glb file in the public/models/ directory. For example: public/models/yzf-r9.glb.Open src/components/InteractiveModel.jsx and change the url prop passed to the <Model /> component:
<Model url="/models/yzf-r9.glb" highlightColor={highlightColour} />
--highlight-color in src/index.css.All primary colours are defined in src/index.css as CSS variables (--ink, --muted, --accent, --accent2, --highlight-color). Modify these to match your desired palette. Components reference these variables to maintain a consistent theme.
If you want to host the site under diagdaddy.com using GitHub Pages, follow these steps:
diag-daddy), make it public, and do not initialise with a README (we already have one).cd diag-daddy-react
git init
git remote add origin https://github.com/<your‑username>/diag-daddy.git
git add .
git commit -m "Initial commit"
git push -u origin master
npm run build
This creates a build/ directory containing static HTML, CSS and JS.
master branch (or main depending on your default) and set the folder to /build (case sensitive).diagdaddy.com through a domain registrar if you haven’t already.In your repository, create a file called CNAME (no extension) in the root (not inside src or public). Its contents should be exactly:
diagdaddy.com
Commit and push the CNAME file:
echo diagdaddy.com > CNAME
git add CNAME
git commit -m "Add CNAME for custom domain"
git push
In your DNS provider’s management console, add a CNAME record pointing www to <your‑username>.github.io. If you want the root domain (without www) to work, add an ALIAS or ANAME record pointing to the same target, or use A records pointing to GitHub’s IP addresses (check GitHub Pages documentation).
Once these steps are done, visiting https://diagdaddy.com/ should load your React app.
This project was created as a teaching tool and an example. Pull requests are welcome! You can extend the app by:
This project is open source under the MIT license.