Welcome, candidate! This project contains intentional issues that mimic real‑world scenarios. Your task is to refactor, optimize, and fix these problems.
-
Refactor blocking I/O
src/routes/items.jsusesfs.readFileSync. Replace with non‑blocking async operations.
-
Performance
GET /api/statsrecalculates stats on every request. Cache results, watch file changes, or introduce a smarter strategy.
-
Testing
- Added unit tests (Jest) for items routes (happy path + error cases).
-
Memory Leak
Items.jsleaks memory if the component unmounts before fetch completes. Fix it.
-
Pagination & Search
- Implement paginated list with server‑side search (
qparam). Contribute to both client and server.
- Implement paginated list with server‑side search (
-
Performance
- The list can grow large. Integrate virtualization (e.g.,
react-window) to keep UI smooth.
- The list can grow large. Integrate virtualization (e.g.,
-
UI/UX Polish
- Feel free to enhance styling, accessibility, and add loading/skeleton states.
- Idiomatic, clean code with comments where necessary.
- Solid error handling and edge‑case consideration.
- Tests that pass via
npm testin both frontend and backend. - A brief
SOLUTION.mddescribing your approach and trade‑offs.
node version: 18.XX
nvm install 18
nvm use 18
# Terminal 1
cd backend
npm install
npm start
# Terminal 2
cd frontend
npm install
npm startThe frontend proxies
/apirequests tohttp://localhost:3001.