How kentcdodds/react-fundamentals works
Project Type & Purpose
• This is a front-end–only tutorial/workshop repository built with Create React App.
• It provides a set of React exercises (src/exercise) alongside their final solutions (src/final), tests (src/__tests__), and helper scripts to set up, build, test, and deploy the workshop.
File Structure Analysis
• Top‐level directories:
• public/ – static assets & HTML shell
• src/ – React source, tests, styles, exercises & final solutions
• scripts/ – custom Node scripts (setup, pre-commit, update-deps, etc.)
• Config files:
• Dockerfile & docker-compose.yml – containerization for dev/test
• craco.config.js & sandbox.config.json – tooling overrides
• .github/workflows/validate.yml – CI lint/test pipeline
• Tooling: ESLint, Prettier, Gitpod, GitHub Actions, Netlify deploy hints
Key Components
A. Developer Environment
• Code Editor / IDE
• Local Node.js & npm
• Git client
• Optional: Docker & docker-compose
• Optional: Gitpod / GitHub Codespaces
B. Repository & CI/CD
• GitHub repo + branches
• GitHub Actions workflow (“validate.yml”)
• Netlify (or any static-site host) for deployment
C. Build & Dev Server
• react-scripts (webpack dev server, bundler)
• craco for config overrides
• mockServiceWorker for local mocking
D. Application
• public/index.html → React mount point
• src/index.js → React root
• src/exercise vs src/final – code variants
E. Test Runner
• Jest (npm test) + React Testing Library
• src/__tests__ → test suites
F. Supporting Scripts
• scripts/setup.js → initial project setup (npm install/config)
• scripts/pre-commit.js & pre-push.js → lint/test hooks
• scripts/update-deps → dependency management
Relationships & Data Flows
• Developer edits code in IDE → local file system
• Local code → react-scripts dev server → browser UI
• Code changes → hot reload → browser reflects updates
• Running tests → Jest picks up src/__tests__ and exercise files
• Git commit → pre-commit hook runs ESLint & tests → pushed to GitHub
• Push to GitHub → GitHub Actions CI runs lint + tests → status badge updated
• Merge to main → Netlify auto-deploy of built static site
Architectural Patterns & Principles
• Single‐Page Application (SPA)
• Convention over configuration (CRA defaults overridden by craco)
• GitOps for CI/CD (GitHub Actions + Netlify)
• Containerized dev environment (Docker + Gitpod)
• Modular exercise vs final solution separation