This document provides context for the Gemini Code Assistant to understand the locorda project.
locorda is a multipackage Dart library designed to facilitate offline-first, collaborative applications by synchronizing RDF data with Solid Pods. It uses state-based Conflict-free Replicated Data Types (CRDTs) to ensure data consistency and enable offline functionality.
The project is organized as a monorepo with the following packages:
locorda_core: Platform-agnostic sync logic, CRDT implementations, and abstract interfaceslocorda_solid_auth: Authentication bridge to the solid-auth library for Solid Pod loginlocorda_solid_ui: Flutter UI components including login screens and sync status widgets
The project's architecture is composed of four layers:
- Data Resource: The raw RDF data stored on a Solid Pod.
- Merge Contract: A public, discoverable set of rules that define how to merge data using specific CRDT algorithms. This is defined in
.ttlfiles in thevocabularies/directory. - Indexing Layer: An optional layer for performance optimization and data discovery, allowing for sharding and partitioning of data.
- Sync Strategy: A client-side configuration that determines how data is synchronized. The available strategies are:
FullSync: For small datasets.PartitionedSync: For large, time-series datasets.OnDemandSync: For very large datasets where only an index is synced initially.
The library is designed to be an "add-on" to an existing application, rather than a full-fledged database, giving developers control over their local storage and querying logic.
This project uses Melos for multipackage management. To set up the workspace:
dart pub get
dart pub run melos bootstrapTo run tests across all packages, use Melos:
dart pub run melos testFor coverage reporting on the entire workspace, use:
dart tool/run_tests.dartThis will execute the tests and generate a coverage report in the coverage/ directory.
The project uses GitHub Actions for continuous integration. The CI workflow is defined in .github/workflows/ci.yml and includes the following steps:
- Install dependencies (
dart pub get) - Analyze the code (
dart analyze) - Run tests with coverage (
dart test --coverage=coverage) - Upload coverage report to Codecov
The project follows the core Dart linting rules, as defined in analysis_options.yaml. All code should be formatted using dart format.
Contributions are welcome. The process is as follows:
- Fork the repository and create a branch from
main. - Open an issue to discuss the proposed changes.
- Write tests for any new features or bug fixes.
- Ensure that
dart analyzeanddart testpass. - Submit a pull request.
The project uses custom RDF vocabularies to define the CRDT and synchronization logic. These are located in the vocabularies/ directory:
crdt.ttl: Defines the low-level CRDT mechanics.sync.ttl: Defines the high-level merge contract.idx.ttl: Defines the indexing vocabulary.