How rocicorp/mono works
Main Components and Their Purposes
• Zero Product:
• Client Library: Located in packages/zero-client. This is the main client library that uses Replicache under the hood.
• Server Side: Found in packages/zero-cache, which handles server responsibilities.
• Incremental View Maintenance Engine & Query Language/API: In packages/zql; this module builds the “IVM” and query functionality.
• Bug Tracker App: In apps/zbugs, an example full-stack application built on top of the Zero libraries.
• Other supportive packages like zero-pg, zero-protocol, zero-react, zero-schema, and zero-solid provide additional features, integrations, and frontend components.
• Replicache Product:
• Client Library: Located in packages/replicache (and its associated docs within the same package structure).
• Documentation pages and related tooling (e.g., the replicache-doc content).
• Ancillary Tools and Libraries:
• Additional packages like shared, otel, datadog, ast-to-zql, and others that support logging, telemetry, and code reuse across both product lines.
• Tools directory (e.g., client-simulator, load-generator, process-tracker) and prod/sts for deployments.
Recognize Architectural Patterns from the File Structure
• Layered Architecture for Zero: For Zero, you want to show the frontend layers (e.g., bug tracker UI in apps/zbugs, zero-react, or solid-view integrations) and back-end layers (e.g., zero-cache, zero-server packages). Also, note that the client libraries interact with the server implementations using the IVM/query engine (zql).
• Common Utilities and Shared Code: The packages/shared module and similar packages are used by multiple products, so show them as supporting libraries that provide cross-cutting capabilities (e.g., configuration, logging, validation).
Relationships and Data Flow
• How the Zero client (zero-client) sends or receives data from the Zero server (zero-cache), potentially via the IVM engine provided by zql.
• How replicache and other auxiliary modules come into play: for example, the Zero client library uses Replicache functionality.
• Integration paths to external systems, such as Docker configurations (in apps/zbugs/docker) for setting up databases, as well as CI/CD pipelines defined in the .github/workflows folder which orchestrate testing, deployments, and build processes.
Technologies, Frameworks, and Design Principles
• The repo predominantly uses TypeScript (note tsconfig.json files distributed across the monorepo) and relies on modern web development practices.
• The use of packages such as Playwright for testing (see apps/zbugs/playwright) indicates an automated end-to-end testing strategy.
• The inclusion of Docker files and various deployment configurations (prod/sst, docker-compose files) suggests containerization and serverless deployment practices.