How sanity-io/react-rx works
Project type and purpose
• This is a monorepo hosting an open-source TypeScript library (“react-rx”) that provides React hooks and reactive components on top of RxJS, plus a Next.js–based documentation/demo website.
• The core deliverable is an npm package (“react-rx”) for React+RxJS integration; the “website” directory holds docs, examples, and the marketing site.
File structure
• Top-level:
– .github/workflows: CI & release pipelines (ci.yml, prettier, react-compiler)
– package.json, pnpm-workspace.yaml: monorepo workspace config
– src/: core library source, tests, build configs (tsconfig.*, vitest)
• “website/”:
– Next.js application (pages/, components/, examples/, utils/, public/)
– Uses its own tsconfig, package.json, theming (theme.config.jsx)
• Config & tooling:
– ESLint (eslint.config.mjs), Prettier (.prettierrc, .prettierignore)
– Release config (releaserc.json), CHANGELOG, LICENSE
README for additional insights
• Describes two API styles: “reactiveComponent” and hook utilities (useObservable, useObservableEvent).
• Points to docs/guide, examples, API reference on the website.
• CI & Release via GitHub Actions and semantic-release to npm.
a. Main components
• Core Library Package (src/)
• Test Suite (vitest tests under src/__tests__)
• Documentation Site (website/)
• CI/CD Pipeline (GitHub Actions & Renovate)
• External Services:
– npm registry (publishing)
– GitHub (code host, workflows)
b. Relationships and interactions
• Developers push to GitHub → CI workflows run tests, build, lint, then semantic-release publishes to npm.
• Core Library builds artefact → consumed by Documentation Site directly via workspace link during dev or via npm install in production.
• Website shows examples that import and demonstrate the Core Library APIs.
• Renovate bot auto-opens dependency update PRs.
c. Architectural patterns and design principles
• Monorepo with pnpm workspaces (single source of truth, shared configs).
• Library built in TS, tested with Vitest, linted/formatted centrally.
• Website as a static-site generator (Next.js MDX for guides/examples).
• Strict separation of concerns: “src” for business logic, “website” for docs/UI.
d. Key technologies and frameworks
• React + RxJS (core interop)
• TypeScript (tsconfig.base/build)
• Next.js + MDX (docs site)
• Vitest (unit tests)
• ESLint, Prettier (code quality)
• GitHub Actions (CI, CD)
• Semantic-release (automated versioning)
• Renovate (dependency management)