This repository contains the core JavaScript stack of Lynx, including ReactLynx, Rspeedy, Lynx for Web, and testing utilities. This document provides essential information for coding agents to work efficiently with this codebase.
What it does: Lynx is a cross-platform application framework that enables developers to build applications with familiar React syntax that can run natively on mobile devices and web browsers. This repository contains the core runtime, build toolchain, web platform implementation, and testing infrastructure.
Size & Structure: Large monorepo with 49 packages, ~15MB of source code Languages: TypeScript (primary), JavaScript, Rust (native bindings) Build System: Turbo monorepo + pnpm workspaces Target Runtimes: Node.js 22+, browsers, mobile devices
ALWAYS follow this exact order for reliable builds:
# Install dependencies (required first)
npm install -g corepack
corepack enable
pnpm install --frozen-lockfile
# Verify toolchain
node --version # Required
pnpm --version # Required
rustc --version # Required for native bindings# Full build (REQUIRED before running tests)
pnpm turbo build
# Development build with watching
pnpm turbo watch build# Format code (ALWAYS run before committing)
pnpm dprint fmt
# Additional formatting check
pnpm biome check
# Linting (SLOW: 2+ minutes, run with adequate timeout)
pnpm eslint .
# Fix auto-fixable lint issues
pnpm eslint --fix .# Run all tests (requires prior full build)
pnpm test
# Run tests for specific package
pnpm run test --project websocket
# Run tests for multiple packages
pnpm run test --project 'webpack/*'
# Test with coverage
pnpm run test --coverage
# Update test snapshots
pnpm run test --update# Update API documentation (ALWAYS commit changes)
pnpm turbo api-extractor -- --local# Generate changeset for your changes
pnpm changeset
# Check changeset status (requires git remote origin/main)
pnpm changeset status --since=origin/mainIssue: Build fails with Rust compilation errors Solution: Install/update Rust toolchain:
# Install Rust with wasm target
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup target add wasm32-unknown-unknownIssue: "API Report Changes Detected" error Solution: Run API extractor and commit changes:
pnpm turbo api-extractor -- --local
git add packages/**/*.api.mdIssue: Tests fail with missing build artifacts Solution: Always run full build first:
pnpm turbo build
pnpm testIssue: Out of memory during build/test Solution: Increase Node.js memory:
export NODE_OPTIONS="--max-old-space-size=32768"-
packages/react/- ReactLynx: React-like framework for Lynx applicationsruntime/- Core runtime implementationtransform/- Rust-based code transformationstesting-library/- Testing utilities for React componentscomponents/- Built-in component library
-
packages/rspeedy/- Rspeedy: Webpack/rspack-based build toolchaincore/- Main build tool implementationcreate-rspeedy/- Project scaffolding toolplugin-*/- Various build plugins
-
packages/web-platform/- Lynx for Web: Web platform implementationweb-core/- Core web runtimeweb-elements/- DOM element implementationsweb-worker-runtime/- Web worker supportweb-tests/- E2E test suite (Playwright)
-
packages/testing-library/- Testing infrastructure -
packages/tools/- Build and development utilities -
packages/webpack/- Webpack plugins and tools
turbo.json- Monorepo build orchestrationpnpm-workspace.yaml- Workspace package definitionstsconfig.json- TypeScript configuration (strictest mode)vitest.config.ts- Test runner configurationeslint.config.js- Linting rules (complex, includes React/TS rules).dprint.jsonc- Code formatting configurationbiome.jsonc- Additional code quality rulesCargo.toml- Rust workspace configuration
The CI runs these checks (replicate locally for confidence):
- Code style:
pnpm dprint check && pnpm biome check - API consistency:
pnpm turbo api-extractor - Changeset validation:
pnpm changeset status --since=origin/main - Linting:
pnpm eslint .(allow 5+ minutes) - TypeScript compilation: Part of
pnpm turbo build - Unit tests:
pnpm test(vitest-based, requires build) - E2E tests: Web platform tests with Playwright
- Rust tests:
cargo test --all-targets --all-featuresin Rust packages - Type checking:
pnpm -r run test:type
.github/workflows/test.yml- Main test orchestration.github/workflows/workflow-build.yml- Cross-platform builds.github/workflows/workflow-test.yml- Reusable test template- Multiple specialized workflows for different test suites
- Node.js (specified in .nvmrc)
- pnpm (specified in package.json, see
packageManagerfield) - Rust (for native bindings compilation)
- Use "JavaScript Debug Terminal" for debugging tests
- Extensions configured in
.vscode/extensions.json - Settings in
.vscode/settings.json
CI=1 # Enables CI mode
TURBO_TELEMETRY_DISABLED=1 # Disables telemetry
NODE_OPTIONS="--max-old-space-size=32768" # For large builds
DEBUG=rspeedy # Enable debug loggingThese instructions were generated through comprehensive analysis and testing of the repository. Trust this information and only search for additional details if:
- Commands fail with unexpected errors
- Instructions appear outdated (check git blame on this file)
- Working with packages not covered in the architecture section
Time-saving tips:
- Use
pnpm turbo build --summarizeto see build performance - Use
--projectflag to focus tests on specific packages - Always check
pnpm-workspace.yamlto understand package structure - Monitor
.turbo/directory for cached build artifacts - Check
etc/*.api.mdfiles when API changes are needed
- Core React-like implementation for cross-platform development
- Requires both TypeScript and Rust compilation
- Has extensive test suite in
__test__/directories - JSX transforms handled by custom Rust-based compiler
- Webpack/rspack-based build tool optimized for Lynx apps
- Includes CLI tool:
packages/rspeedy/core/bin/rspeedy.js - Plugin architecture for extensibility
- Template system in
create-rspeedy/
- Large collection of 20+ packages for web implementation
- Includes E2E test suite requiring Playwright
- Many packages have complex interdependencies
- Contains performance-critical rendering code
- See
packages/web-platform/web-core-wasm/AGENTS.mdfor specific instructions onweb-core-wasm.
Remember: This is a complex, multi-language monorepo. Always allow extra time for builds and tests, and follow the exact command sequences provided.
When you learn new patterns or best practices while working on the lynx-stack project, you should update or create one or more ".github/*.instructions.md" files, adding natural language instructions to the file(s).
Whitespace between instructions is ignored, so the instructions can be written as a single paragraph, each on a new line, or separated by blank lines for legibility.
Specify what files or directories the instructions apply to by adding applyTo frontmatter to the Markdown files, using glob syntax.
Specify what files or directories the instructions apply to by adding applyTo frontmatter to the Markdown files, using glob syntax. For example:
---
applyTo: "packages/**"
---
Add custom instructions here