Clone the repo: https://github.com/orthly/cad-full-stack-interview-react
Open the repository using your favourite IDE.
You can use your development setup including LSPs, just turn off AI code completion (e.g. copilot, codium, tabnine, …)
Walk us through your thinking process and explain what and why you are doing.
Install the dependencies defined in the package.json file at the root of the project.
If you are on Mac, use the dev script defined in package.json to start both server and client.
If you are on Windows, you need to run npm run dev:server in one terminal and npm run dev:client in another, to start both server and client at the same time.
Navigate to http://localhost:3000
We want to make an HTTP request to an endpoint (http://localhost:4000/api) and get the data necessary to build a THREE.Mesh.
We will then build an interactive UI to position the Mesh on top of a table.
Knowledge of Three.js is not required. You are free to read Three.js docs (https://threejs.org/docs/), or ask your interviewer for guidance.
Fetch the data from the endpoint. The response will be a serialized THREE.Mesh.
The endpoint is protected, and you should use the provided Bearer authorization token to authenticate the request.
Once you get the response from the endpoint, build the mesh using the provided useLoader component, which returns a React.RefObject<THREE.ObjectLoader>. Here (https://threejs.org/docs/#ObjectLoader) you can read the documentation for ObjectLoader.
Add the mesh to the scene.
The scene is provided by the useScene component, which returns a React.RefObject<THREE.Scene>.
The mesh that you'll receive is either a bunny or a teapot, rotated on its side, positioned near the origin.
Move the object in order for it to face upwards, and rest perfectly centered on top of the table.
Here's THREE documentation for:
- Box3: https://threejs.org/docs/#Box3
- Vector3: https://threejs.org/docs/#Vector3
- Matrix4: https://threejs.org/docs/#Matrix4
- Quaternion: https://threejs.org/docs/#Quaternion
- Euler: https://threejs.org/docs/#Euler