How cbnsndwch/zero-sources works
Project Type & Purpose
• This is a monorepo that provides custom change source implementations for @rocicorp/zero together with utility libraries. Its main services (in the apps folder, such as “source-mongodb”) are built using NestJS and are designed to be containerized (Docker support is present).
• The repository manages multiple packages via Yarn Workspaces and Turborepo, and it includes helper libraries (like “zero-nest-mongoose” for schema utilities and integrations) along with configuration utilities (eslint-config, tsconfig).
Main Components
a. Custom Change Source Apps (e.g., apps/source-mongodb)
• Health Check Module (“healthz”): responsible for system health endpoints.
• Watermark Handling Modules: shows two paths (one via a “nats” submodule and another via “zqlite”) that manage watermark-related interactions.
• Zero Module: encapsulates logic for handling custom change source behaviors (e.g., “zero” feature with contracts, gateways, services, and entities).
• Intra-module relationships such as controllers, services, providers, and utilities (like cors, serialization, etc.).
b. Shared Libraries
• “libs” folder as another major block with several sub-components:
• ESLint Config and TSConfig: shared configurations that affect coding standards and project settings.
• Zero-Nest-Mongoose Library: highlight that this library provides additional functionality (e.g., schema generation, contracts, and modules for managing entities such as “bugs” and “pokemon”).
c. External Systems & Infrastructure
• Docker: Represent the Docker configuration (e.g., under the “.docker/nats” folder) as an external deployment/infrastructure environment component. This illustrates that parts of the system (like NATS for messaging) are containerized.
• NATS (and associated configurations): Show a separate component for the NATS messaging system that the applications interact with via their watermark components.
• If applicable, you may include the “kv.sqlite” file as an indicator of lightweight, embedded persistence used by the change source.
Relationships and Interactions
• From external client calls (or even @rocicorp/zero itself) to the NestJS-based custom change sources.
Architectural Patterns & Design Principles
• It leverages a microservice/component-like approach even within a monorepo. Emphasize the separation between custom change sources (apps) and shared libraries (libs).
• Emphasis on configuration and extensibility, which might be illustrated by showing how common configuration files (YAML, tsconfig, etc.) support multiple modules.