Hey there! We welcome community contributions to Flock XR. This could be code, documentation, reporting bugs, suggesting accessibility features, adding translations, or something else!
Flock XR is a creative coding platform for 3D development using Blockly and Babylon.js. It's designed as a bridge between Scratch and professional 3D tools, making 3D programming accessible to young people and beginners.
- π Report bugs - Found something broken? Let us know!
- π Improve documentation - Help make our docs clearer
- β¨ Add features - Implement new blocks, effects, or tools
- π§ͺ Write tests - Help us improve stability
- βΏ Accessibility improvements - Make Flock more inclusive
- π Translations - Help us reach more users worldwide
- π¨ UI/UX improvements - Make the interface better
Before starting, we suggest you get in touch and ask that you read our AI contributions policy.
- Node.js (version 18 or higher)
- Git
- A modern web browser
- Fork the repo on GitHub
- Clone your fork to your local machine:
git clone git@github.com:YOUR_USERNAME/flock.git
- Navigate to the project:
cd flock - Install dependencies:
npm install
- Start the development server:
npm run dev
- Open your browser to http://localhost:5173/
-
Create a feature branch:
git checkout -b your-feature-name
-
Make your changes (see project structure below).
-
Test your changes including running the automated tests, details of how to do so follow below.
-
Format your code Run
npm run format:checkto check your code meets the formatting requirements, or usenpm run formatto automatically format it using Prettier. -
Commit your changes:
git add . git commit -m "Add your descriptive commit message"
-
Push to your fork:
git push origin your-feature-name
-
Create a Pull Request on GitHub
-
Push your fork to GitHub:
git push origin main
-
Set up GitHub Actions
- Go to your fork on GitHub at https://github.com/YOUR_USERNAME/flock/
- Click Settings > Pages
- In the 'Source' dropdown, select 'GitHub Actions'
-
Create the Flock environment:
- Still in settings, click 'Environments'
- Click 'New Environment'
- Name it
flock(all lowercase, do not change this) - Click 'Configure environment' but do not make any changes
-
Trigger the deployment
- Go back to your fork at https://github.com/YOUR_USERNAME/flock/
- Click the 'Actions' tab
- Click 'I understand my workflows, go ahead and enable them'
- Click on the new option 'Vite GitHub Pages Deploy'
- Click 'Run workflow' dropdown, then select 'Run workflow' to deploy manually
-
Visit your deployment
- Once the site has deployed you will see it at https://YOUR_USERNAME.github.io/flock/
- GitHub pages should redeploy automatically when you push to main
For more specific developer-facing documentation, please see dev-docs.md.
Understanding the codebase β key files:
index.html- Main HTML file that defines the application structure, UI layout (menu, canvas, code panel), and loads all necessary scripts and stylesheetsmain/main.js- Main application entry point that initializes Blockly workspace, handles code execution, manages UI views (canvas/blocks/split), and controls file operationsflock.js- Main Flock engineui/designview.js- Visual design interface enabling direct 3D object manipulation with gizmos, synchronizing 3D changes with Blockly blocksblocks.js- Block definitionsgenerators.js- Blockly JavaScript generators for blockstoolbox.js- Blockly toolbox configuration
Directories:
api/- Core Flock XR API functions (scene, animation, physics, etc.)blocks/- Additional Blockly block definitionsdocs/- Getting started documentationexamples/- Example project JSON files including those featured in the Demo dropdownfonts/- Fonts used in UI and 3D text generationimages/- Images used in UIlocale/- localisation / translationmain/- application file to support flock enginemodels/- 3D models (.glb files)textures/- Texture files for materialssounds/- Audio filestests/- Test files (please add tests for new features!)ui/β UI files
There is also a Flock XR Architecture diagram
We use Mocha and Chai for testing, plus Playwright for end-to-end testing. Always test your changes:
Add new tests for any features you create
- Run the development server:
npm run dev, which starts a local webserver. - Visit the test page: http://localhost:5173/tests/tests.html
- Select tests from the dropdown and click Run Tests.
- Get fast feedback by using the Run all except @slow option
- Run only your newest tests by tagging those tests with @new and picking Run tests tagged @new
- Focus on results with the failures / passes links in report
- Show the test code by clicking on test name in the report
- Tag slow tests with @slow so that they can be run separately if needed.
- Tag new tests with @new so that you can filter on those new tests. Remove tag when they're no longer new.
To add a tag, change the describe or it text in unit tests to add a tag.
- Array
testSuiteDefinitionscorresponds to the test selection dropdown. Each test file, and each selectable tag, need a definition. - Modify
testSuiteDefinitionsintests/tests.htmlto pick up the test file. Each test file needs an entry. - Modify
testSuiteDefinitionsintests/tests.htmlto add tags or names to focus. Each tag needs an entry. - Note that some test suites are selected/filtered on a name (the name from the top
describeif there's only one) and others on tag (added to all top-level describes if several).
For CI/CD or automated testing, you can run tests via command line:
# Run specific test suite
npm run test:api babylon
# Run fast tests (excludes @slow)
npm run test:api @notslow
# Run slow tests only
npm run test:api @onlyslow
# Enable detailed logging
npm run test:api babylon -- --verbose
npm run test:api glide -- --log-allFeatures:
- Automatic server startup and shutdown
- Headless browser execution (Playwright)
- Works in CI environments (GitHub Actions, etc.)
- Logging support for debugging (
--log-api,--log-tests,--log-all) - Verbose mode for diagnostics (
--verbose)
CI/GitHub Actions: The test runner is optimized for CI environments with automatic environment detection and robust server startup handling. See docs/TEST_RUNNER_CI_FIX_SUMMARY.md for details.
If you change CSP policy, security headers, analytics loading, or runtime asset origins, run:
npm run build
npm run test:csp-smokeThis validates core CSP-sensitive flows and fails if browser securitypolicyviolation events are detected.
Playwright tests are located in tests/playwright/. These are automated end-to-end tests that verify the UI loads correctly, blocks function properly, and the overall user experience works as expected.
Before running tests, ensure Playwright browsers are installed:
npx playwright installCheck that browsers are properly installed:
npx playwright install --dry-runRun all tests:
npx playwright testRun a specific test file:
npx playwright test tests/playwright/flock.spec.jsThe tests will automatically start the dev server (http://localhost:5173) before running.
View the HTML test report:
npx playwright show-reportSome tests use visual regression testing by comparing screenshots against baseline images. When running these tests for the first time or when intentional visual changes are made, you need to generate/update the snapshots:
npx playwright test --update-snapshotsAfter generating snapshots:
- Review the generated images in
tests/playwright/*-snapshots/to ensure they look correct - Run the tests again without the flag to verify they pass
- Commit the snapshot images to version control
Update specific snapshots only:
npx playwright test blocks.spec.js --update-snapshotsSeveral files and directories are generated during testing and should not be checked into git:
test-results/- Playwright test resultsplaywright-report/- Generated test reports.last-run.json- Runtime state from last test execution
These are already included in .gitignore. If you create new test artifacts, make sure to add them to .gitignore as well.
- Stability - Bug fixes and reliability improvements
- Testing - More comprehensive test coverage
- Accessibility - Making Flock usable for everyone
- UX improvements - Better user experience
- Documentation - Clearer guides and API docs
When reporting bugs, please include:
- Steps to reproduce the issue
- Expected vs actual behavior
- Browser and operating system
- Screenshots or screen recordings if helpful
- Any console errors
Before suggesting new features:
- Check existing issues to avoid duplicates
- Think about how beginners would use it
- Consider performance
- Provide use cases and examples
Help us improve documentation by:
- Fixing typos or unclear explanations
- Adding examples to the API documentation
- Creating tutorials for new features
- Improving code comments
When contributing UI/UX improvements:
- Keep accessibility in mind
- Maintain consistency with existing design
- Consider the target audience (young people and beginners)
- Test on different screen sizes
We're committed to making Flock accessible. We'll be working on:
- WCAG guidelines
- Color contrast
- Language translations
- Clear, simple language
- Keyboard navigation
- Screen reader compatibility
- Discord: Contact us via Get in touch for Discord invite
- Issues: Use GitHub issues for bugs and feature requests
- Discussions: Use GitHub discussions for questions
We follow the p5.js Web Editor Code of Conduct. Please be respectful and inclusive.
- JavaScript (considering TypeScript migration)
- Babylon.js - 3D rendering engine
- Google Blockly - Visual programming blocks
- Vite - Build tool
- Node.js - Development environment
- Progressive Web App features
- Mocha & Chai - Unit testing framework
- Playwright - End-to-end testing framework
Flock XR is licensed under the MIT License. By contributing, you agree that your contributions will be licensed under the same license.
Every contribution helps make 3D programming more accessible to young people worldwide. Thank you for being part of the Flock XR community!
New to open source? Check out these guides: