Contributing Guide
Thank you for your interest in contributing to the Requests & Offers project! This guide will help you get started with contributing to our codebase.
Code of Conduct
Please read and follow our Code of Conduct to maintain a welcoming and inclusive environment for all contributors.
Getting Started
- Fork the repository
- Clone your fork
- Set up the development environment following our Installation Guide
Development Workflow
1. Branches
main: Production-ready codedevelop: Main development branch- Feature branches:
feature/your-feature-name - Bug fix branches:
fix/bug-description
2. Commit Messages
Follow the Conventional Commits specification:
type(scope): description
[optional body]
[optional footer]
Types:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changesrefactor: Code refactoringtest: Adding or modifying testschore: Maintenance tasks
Scopes:
ui: Frontend changesusers: Users Organizations featureadmin: Administration featurerequests: Requests featureorganizations: Organizations featureoffers: Offers featurestatus: Status moduletest: Test infrastructurebuild: Build system changes
3. Pull Requests
- Create a new branch for your changes
- Make your changes
- Write or update tests
- Update documentation
- Submit a pull request to the
devbranch
4. Development Standards
Code Style
- Follow Rust style guidelines for zomes
- Use SvelteKit best practices for frontend
- Maintain consistent code formatting
- All code contributions must adhere to the most possible to the standards outlined in
.windsurfrulesand the specific rule files within.cursor/rules/. - To suggest code style changes, please open a GitHub issue or pull request labeled
suggestion.
Testing
- Write unit tests for zome functions
- Include integration tests for complex features
- Test frontend components
- Verify documentation accuracy
Documentation
- Update relevant documentation
- Include code examples
- Maintain cross-references
- Follow documentation structure
Feature Development Workflow
We follow a systematic approach to feature development that ensures proper testing and integration at each level.
Step 1: DNA Development
-
Zome Planning
- Define entry types and validation rules
- Plan link types and their relationships
- Document expected behaviors
-
Zome Implementation
#![allow(unused)] fn main() { // Example: New entry type in integrity zome #[hdk_entry_helper] pub struct NewFeature { pub field1: String, pub field2: Vec<String>, } // Coordinator zome function #[hdk_extern] pub fn create_new_feature(input: NewFeature) -> ExternResult<Record> { // Implementation } } -
DNA Testing with Sweettest
#![allow(unused)] fn main() { // tests/sweettest/tests/new_feature.rs #[tokio::test(flavor = "multi_thread")] async fn basic_new_feature_crud() { let (conductors, alice, bob) = setup_two_agents_with_alice_as_progenitor().await; conductors[0] .call::<_, Record>(&alice.zome("users_organizations"), "create_user", sample_user("Alice")) .await; await_consistency(15, [&alice, &bob]).await.unwrap(); let record: Record = conductors[0] .call(&alice.zome("new_feature"), "create_new_feature", sample_new_feature()) .await; assert!(record.signed_action.hashed.hash.get_raw_39().len() > 0); } }
Step 2: Service Layer
-
Holochain Service
// ui/src/services/zomes/new-feature.service.ts export class NewFeatureService { constructor(private client: AppAgentClient) {} async createNewFeature(input: NewFeature): Promise<Record> { return await this.client.callZome({ zome_name: "new_feature", fn_name: "create_new_feature", payload: input, }); } } -
Store Implementation
// ui/src/stores/new-feature.store.ts export const newFeatureStore = writable<NewFeature[]>([]); export const createNewFeature = async (input: NewFeature) => { const result = await service.createNewFeature(input); newFeatureStore.update((features) => [...features, result]); return result; };
Step 3: UI Implementation
-
Components
<!-- ui/src/lib/components/NewFeature.svelte --> <script lang="ts"> import { newFeatureStore, createNewFeature } from '$lib/stores/new-feature.store'; async function handleSubmit(event) { const result = await createNewFeature({ field1: event.detail.value, field2: event.detail.options, }); } </script> -
Pages
<!-- ui/src/routes/new-feature/+page.svelte --> <script lang="ts"> import NewFeature from '$lib/components/NewFeature.svelte'; </script> <NewFeature />
Development Order
-
DNA First
- Implement and test entry types
- Create and verify zome functions
- Write comprehensive Sweettest tests
-
Services and Stores (Parallel)
- Create Holochain service methods
- Implement store with state management
- Add store actions and subscriptions
-
UI Components
- Develop reusable components
- Create feature pages
- Implement user interactions
Testing Strategy
-
DNA Testing
# Test specific feature bun test:new-feature # Run all tests bun test -
UI Testing
# Component tests bun test:ui # E2E tests (if applicable) bun test:e2e -
Manual Testing
- Start development environment
- Test with multiple agents
- Verify all user flows
Documentation
-
DNA Documentation
- Update zome documentation
- Document entry and link types
- Add usage examples
-
Frontend Documentation
- Document services and stores
- Add component documentation
- Update user guides
-
Testing Documentation
- Document test scenarios
- Add test data examples
- Update test instructions
Project Structure
Frontend (ui/)
- SvelteKit application
- Component documentation
- UI/UX guidelines
Backend (dnas/requests_and_offers/zomes/)
- Users Organizations Zome
- User management
- Organization handling
- Administration Zome
- System administration
- Status management
Documentation (documentation/)
- Technical specifications
- User guides
- API documentation
- Development guides
Getting Help
- Join our Community
- Ask questions on Discord
- Check GitHub Issues
- Review Technical Documentation & Architecture
Development Support
- Check Zome Documentation
- Follow Feature Development