Thank you for your interest in contributing to Bayan Flow! This document provides guidelines and information for contributors.
Before you open a pull request
- Base branch: Every PR must target
develop, notmain. Themainbranch tracks production releases; day-to-day work merges intodevelopfirst.- Read the docs: Review this file, docs/DEVELOPMENT.md (workflows and patterns), and docs/ARCHITECTURE.md (system design) as they apply to your change.
- PR template: GitHub loads .github/PULL_REQUEST_TEMPLATE.md for new PRs. Keep its structure and fill in every section that applies so reviewers have full context.
- CI: All PRs must pass CI (lint, tests, build) before merge.
- Code of Conduct
- Getting Started
- Development Setup
- Contributing Guidelines
- Pull Request Process
- Issue Guidelines
- Coding Standards
- Testing
- Documentation
By participating in this project, you agree to abide by our Code of Conduct. Please be respectful and constructive in all interactions.
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/your-username/bayan-flow.git cd bayan-flow - Add the upstream remote:
git remote add upstream https://github.com/ayoub3bidi/bayan-flow.git
- Node.js (v24 or higher)
- pnpm (v8 or higher)
-
Install dependencies:
pnpm install
-
Start the development server:
pnpm dev
-
Open your browser and navigate to
http://localhost:5173
pnpm dev- Start development serverpnpm build- Build for productionpnpm preview- Preview production buildpnpm test- Run tests in watch modepnpm test:run- Run tests oncepnpm test:coverage- Generate coverage reportpnpm lint- Run ESLintpnpm lint:fix- Fix ESLint issuespnpm format- Format code with Prettier
We welcome the following types of contributions:
- Bug fixes - Fix existing issues
- New algorithms - Add sorting or pathfinding algorithms
- Feature enhancements - Improve existing functionality
- Documentation - Improve docs, comments, or examples
- Performance improvements - Optimize code performance
- UI/UX improvements - Enhance user interface and experience
- Tests - Add or improve test coverage
- Check existing issues to see if your contribution is already being worked on
- Create an issue to discuss major changes before implementing them
- Keep changes focused - one feature/fix per pull request
- Follow the coding standards outlined below
-
Sync
developand create a feature branch fromdevelop(notmain):git fetch upstream git checkout develop git pull upstream develop git checkout -b feature/your-feature-name
If you do not have
upstreamyet, add it under Getting Started, then run the commands above. -
Make your changes following the coding standards
-
Write or update tests for your changes
-
Run the test suite to ensure everything passes:
pnpm test:run pnpm lint pnpm format:check
-
Commit your changes with a clear commit message:
git commit -m "feat: add insertion sort algorithm" -
Push to your fork:
git push origin feature/your-feature-name
-
Create a pull request on GitHub:
- Set the base branch to
develop(double-check this; GitHub may default tomain). - Complete the pull request template (sections, checkboxes, and details the template asks for).
- Use a clear title and description, reference related issues, and add screenshots or GIFs for UI changes when helpful.
- Set the base branch to
We follow the Conventional Commits specification:
feat:- New featuresfix:- Bug fixesdocs:- Documentation changesstyle:- Code style changes (formatting, etc.)refactor:- Code refactoringtest:- Adding or updating testschore:- Maintenance tasks
Use the bug report template and include:
- Clear description of the issue
- Steps to reproduce
- Expected vs actual behavior
- Browser/OS information
- Screenshots if applicable
Use the feature request template and include:
- Clear description of the feature
- Use case and motivation
- Proposed implementation (if any)
- Alternative solutions considered
Use the algorithm request template and include:
- Algorithm name and type (sorting/pathfinding)
- Brief description and use cases
- Time/space complexity
- Reference links or resources
- Use ES6+ features and modern JavaScript
- Follow React best practices and hooks patterns
- Use functional components with hooks
- Implement proper error boundaries where needed
- Use TypeScript-style JSDoc for complex functions
- ESLint and Prettier are configured - run
pnpm lint:fixandpnpm format - Use camelCase for variables and functions
- Use PascalCase for components and classes
- Use UPPER_SNAKE_CASE for constants
- Keep functions small and focused
- Use descriptive variable names
src/
├── algorithms/ # Algorithm implementations
│ ├── sorting/ # Sorting algorithms
│ ├── pathfinding/ # Pathfinding algorithms
│ ├── python/ # Python code examples
│ └── index.js # Main algorithms export
├── components/ # React components
├── hooks/ # Custom React hooks
├── utils/ # Utility functions
├── constants/ # App constants
└── test/ # Test configuration
-
Create algorithm file in
src/algorithms/sorting/:import { ELEMENT_STATES } from '../../constants'; export function yourSort(array) { const steps = []; const arr = [...array]; // Implementation with step recording // Each step: { array, states, description } return steps; } export function yourSortPure(array) { // Pure implementation for testing return sortedArray; }
-
Export in
src/algorithms/sorting/index.js -
Add to settings panel dropdown
-
Add complexity metadata in constants
-
Write tests in
src/algorithms/sorting/algorithms.test.js -
Add Python implementation in
src/algorithms/python/
- Create algorithm file in
src/algorithms/pathfinding/ - Follow similar pattern with grid-based steps
- Export in pathfinding index file
- Add complexity metadata
- Write tests
- Unit tests for algorithm implementations
- Integration tests for React components
- Edge case testing for algorithms
- Accessibility testing for UI components
import { describe, it, expect } from 'vitest';
import { yourSort, yourSortPure } from './yourSort';
describe('Your Sort Algorithm', () => {
it('should sort array correctly', () => {
const input = [3, 1, 4, 1, 5];
const expected = [1, 1, 3, 4, 5];
expect(yourSortPure(input)).toEqual(expected);
});
it('should generate visualization steps', () => {
const input = [3, 1, 2];
const steps = yourSort(input);
expect(steps).toHaveLength(greaterThan(0));
expect(steps[0]).toHaveProperty('array');
expect(steps[0]).toHaveProperty('states');
expect(steps[0]).toHaveProperty('description');
});
});# Run all tests
pnpm test:run
# Run tests in watch mode
pnpm test
# Run with coverage
pnpm test:coverage
# Run with UI
pnpm test:uiBy contributing to this project, you agree that:
- Your contributions will be licensed under Elastic License 2.0 OR Commercial
- All new files must include the license header at the top:
/**
* Copyright (c) 2025 Bayan Flow
* Licensed under Elastic License 2.0 OR Commercial
* See LICENSE for details.
*/- Contributions must be compatible with the Elastic License 2.0
- You have the right to submit your contribution under this license
- Your contribution does not violate any third-party licenses
- Only add dependencies licensed under permissive licenses (MIT, Apache-2.0, BSD, ISC)
- Do not add GPL-licensed dependencies (incompatible with Elastic License 2.0)
- Document any new dependencies and their licenses in your pull request
- Use JSDoc comments for complex functions
- Include parameter types and return values
- Document algorithm complexity in comments
- Explain non-obvious logic with inline comments
- Update feature lists for new algorithms
- Add usage examples for new features
- Update installation instructions if needed
- Keep the project structure section current
- Update
docs/ARCHITECTURE.mdfor structural changes - Document new patterns or conventions
- Explain complex component interactions
- GitHub Issues - For bugs and feature requests
- GitHub Discussions - For questions and general discussion
- Code Review - Ask for feedback on pull requests
Contributors will be recognized in:
- GitHub contributors list
- Release notes for significant contributions
- Special mentions for major features
Thank you for contributing to Bayan Flow! 🎉