How reactplay/react-play works
Project Type and Purpose
• This is an open-source, full-frontend ReactJS web application (“ReactPlay”) that aggregates dozens of small hands-on React projects (“plays”), offers user contributions, and displays dynamic content (contributors, badges, plays, testimonials, etc.).
• It runs entirely in the browser, communicates with external services (GitHub APIs, Nhost/Hasura backend for data and auth), and is deployed via Netlify/Vercel or Docker.
File Structure
• Top-level: build & config files (Dockerfile, docker-compose, Netlify.toml, ESLint/Prettier, GitHub workflows).
• /public & /src: React App code.
• /src/common: shared UI components, hooks, routing, and service-layer functions.
• /src/plays: individual mini-apps (“plays”) each self-contained.
• /src/services: HTTP request layer to external APIs.
• E2E tests under /e2e using Playwright.
• CI/CD workflows in .github/workflows.
README for Insights
• Uses React 18, Yarn/PNPM, Husky for pre-commit hooks.
• Environment config via .env.development (Nhost, GitHub tokens).
• Deployable to Netlify or Vercel.
• E2E via Playwright.
• Emphasizes contributor workflow for adding new “plays.”
Main Components & Relationships
a. Frontend (React SPA)
• Core App shell (src/index.jsx → App.jsx).
• Shared components & utilities (src/common).
• Play modules under src/plays/*.
• Routing layer directs URL paths to plays or common pages (404, ErrorBoundary).
b. Services/Backend
• GitHub REST/GraphQL APIs (contributors, issues).
• Nhost/Hasura POST endpoints (badges, plays metadata, testimonials).
• Other third-party APIs (e.g. YouTube Embed, Unsplash).
c. External Tools
• Playwright (E2E).
• CI/CD: GitHub Actions for lint, tests, release drafting.
• Docker & docker-compose for local dev/prod containers.
• Netlify/Vercel for hosting.
Architectural Patterns & Principles
• Component-based design: each “play” is isolated.
• Service-oriented API layer: common/services/request/query/* separates HTTP concerns.
• Hooks for shared state & caching (useFetch, useCacheResponse).
• Centralized routing (RouteDefs.jsx).
• Error boundaries for robust UI (ErrorBoundary).
• CI/CD pipelines for quality gates.
Detailed Coverage
• That each “play” folder is a self-contained React component loaded via routing.
• Service queries (e.g. fetch-plays-paginated.js) as part of the API layer.
• E2E tests launching against the local/dev Docker container.