Repository navigation
ci: run the checks through Nx, and only for the projects a change affects - #303
Merged
Merged
Conversation
…ects Nx becomes the monorepo's task runner. The root package.json brings Nx (its only dependency); nx.json holds the shared inputs and target defaults, and each project has a project.json: backend (fastapi_backend), frontend (nextjs-frontend), installer and docs. The apps keep their own package files. CI's first job, Affected projects, asks Nx which projects a change affects (nrwl/nx-set-shas picks the base: the main a PR merges into, or main's last green run). The FastAPI and Next.js jobs keep their names and run only when their project is affected; a skipped job counts as passed. A new Other projects job runs the lint, typecheck, test and build targets of every other affected project, so a new project.json is all a new project needs to join CI; it now builds the docs site on pull requests in place of docs.yml. The make targets wrap the same Nx targets and come back from Nx's local cache when nothing changed; `make affected` checks only what changed. Nx Cloud is never connected and Nx's analytics are off. C A1EE o-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018t1esJmuFFT1yrtmWSPHqz
This was referenced Oct 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Adeel · project thread
Description
Before: every pull request ran the whole backend suite twice and the whole frontend build, whatever it changed, and each make target and CI step spelled out its own commands.
After: Nx is the monorepo's task runner. CI asks it which projects a change affects and runs only those: a docs-only PR builds the site and skips the backend and frontend jobs; a backend PR skips Next.js.
make test-backend,make lint-frontendand friends run the same Nx targets as CI and replay from the local cache when nothing they read changed.make affectedchecks just what your branch touches.package.json(Nx is its one dependency, pnpm like the frontend),nx.json(shared inputs, target defaults,neverConnectToCloud,analytics: false), and aproject.jsonper project:backend(lint, format, typecheck, test with:ciand:server, openapi-check, openapi),frontend(lint, typecheck, test, build, generate-client),installer(test),docs(build, serve). The apps keep their ownpyproject.toml/uv.lockandpackage.json/pnpm-lock.yaml; no lockfile moves, Dockerfiles untouched.ci.yml): a first job, Affected projects, usesnrwl/nx-set-shas(a PR is compared with the main it merges into, a push to main with main's last green run) and lists the affected projects in its summary. FastAPI (embedded SurrealDB), FastAPI (SurrealDB server) and Next.js keep their names and steps, run the project.json targets, and run only when their project is affected; a skipped job counts as passed, so they stay valid required checks. If the affected job itself fails, every job runs. A new Other projects job runs lint/typecheck/test/build for every other affected project, so the browser extensions and the desktop app join CI with just aproject.json. A change tonx.json, rootpackage.jsonorci.ymlaffects everything; running CI by hand checks everything. CI skips Nx's cache (NX_SKIP_NX_CACHE), so every task runs fresh.docs/contributing.mdhas a new "Monorepo and CI (Nx)" section (projects, commands, how CI decides, how to add a project); AGENTS.md and CONTRIBUTING.md point at it.Motivation and Context
Adeel asked to use Nx as the monorepo build system and CI. Several threads are adding projects in parallel (web clipper builds, desktop app); this lands the skeleton early so each one folds in with a
project.json.How
nx show projects --affectedmaps changed files to projects by folder, plus root files a target names in itsinputs(checked locally:README.md→ docs,nextjs-frontend/openapi.json→ frontend and backend's openapi-check,ci.yml/nx.json/package.json→ all,Makefile→ none). Locally on this branch: backend lint, typecheck, openapi-check (and a failing run after editing openapi.json), backend tests (make affected, 3m49s), frontend lint, typecheck,test:ci(731 passed) and build, docs build, installer tests, andpre-commit run --all-filesall pass through Nx.Types of changes
!in the title)Checklist:
make hookschecks it on commit).ci.ymlchanges affect every project.)docs/accordingly.## UnreleasedinCHANGELOG.md. (n/a: contributor tooling only.)Done questions (AGENTS.md)
make affectedorpnpm exec nx …; non-TTY output is plain (TUI off), and AGENTS.md says so.make affectedis one command; CI needs no change to pick up a new project..nx/on the machine. No new runtime surface; the threat model already scopes CI tooling out (.github/,ci/).make test-backendetc. behave the same apart from the cache replay (--skip-nx-cacheto force).pnpm-lock.yamlfrompnpm install).Refine later
extensions/browser(feat(clipper): Lens web clipper browser extension, Chrome first #277 and the Firefox/Edge/Safari PRs) anddesktop(feat(desktop): Lens.app for macOS, a menu-bar app that carries microsandbox #280) with their ownproject.jsonas they merge.threat-model.yml,matterbridge.ymland the install/launcher path filters onto Nx projects, so all PR gating comes from one graph.pre-commitonly on the changed files (--from-ref/--to-ref) and skip the frontend install when no frontend file changed.ci/local-ci.shstill replays the old commands directly; point it at the Nx targets.🤖 Generated with Claude Code
https://claude.ai/code/session_018t1esJmuFFT1yrtmWSPHqz
Generated by Claude Code