|
| 1 | +--- |
| 2 | +weight: 5 |
| 3 | +--- |
| 4 | + |
| 5 | +# Development Environment Setup |
| 6 | + |
| 7 | +This guide covers setting up a development environment for contributing to SynBioHub. This is different from the [installation guide](../1_getting_started/installation.md) which focuses on deploying SynBioHub for production use. |
| 8 | + |
| 9 | +## Prerequisites |
| 10 | + |
| 11 | +Before setting up the development environment, ensure you have the following installed: |
| 12 | + |
| 13 | +- **Git**: For version control and cloning repositories |
| 14 | +- **Docker and Docker Compose**: For running services like Virtuoso database |
| 15 | +- **Visual Studio Code** (recommended): With extensions for TypeScript, Python, and Docker |
| 16 | + |
| 17 | +### Installing Prerequisites |
| 18 | + |
| 19 | +1. Before trying to run SynBioHub2 locally on your PC, make sure that you have [Docker](https://docs.docker.com/get-started/get-docker/) installed. Be sure to also install [Git](https://git-scm.com/downloads) so that you can track your changes. |
| 20 | + |
| 21 | +## Repository Setup |
| 22 | + |
| 23 | +### Clone the Main Repositories |
| 24 | + |
| 25 | +SynBioHub consists of multiple repositories. For development, you'll need: |
| 26 | + |
| 27 | +```bash |
| 28 | +# Create a workspace directory |
| 29 | +mkdir synbiohub-dev |
| 30 | +cd synbiohub-dev |
| 31 | + |
| 32 | +# Clone the main repositories |
| 33 | +git clone https://github.com/SynBioHub/synbiohub3.git # Frontend |
| 34 | +git clone https://github.com/SynBioHub/synbiohub.git # Backend |
| 35 | +git clone -b devtools https://github.com/SynBioHub/synbiohub2-docker.git # Docker Compose Setup (devtools branch) |
| 36 | +``` |
| 37 | + |
| 38 | +## Launching |
| 39 | + |
| 40 | +```bash |
| 41 | +cd synbiohub2-docker |
| 42 | + |
| 43 | +# Start everything with build from source |
| 44 | +docker compose -f docker-compose-dev.yml up |
| 45 | +``` |
| 46 | + |
| 47 | +## Environment Configuration |
| 48 | + |
| 49 | +Within the `docker-compose-dev.yml` file there are some environment variables. These are configured for running the code on the same device you are accessing it from, ie localhost. If that is not true, ie cloudflare tunnels, then you will need to update the backend url. |
| 50 | + |
| 51 | +## Development Workflow |
| 52 | + |
| 53 | +### Code Changes |
| 54 | + |
| 55 | +1. **Frontend Changes**: Edit files in `synbiohub3/src/` |
| 56 | + - Changes are automatically reloaded |
| 57 | + - Check browser console for errors |
| 58 | + |
| 59 | +2. **Backend Changes**: Edit files in `synbiohub/` |
| 60 | + - Restart the backend server for code changes, with `docker compose -f docker-compose-dev.yml down` |
| 61 | + - Check backend server logs for errors or browse to localhost:7777 |
| 62 | + |
| 63 | +### Testing |
| 64 | + |
| 65 | +Tests are currently under development for the frontend. |
| 66 | +Backend tests are handled by github actions on commit. |
| 67 | + |
| 68 | +### Adding New Features |
| 69 | + |
| 70 | +1. Create a feature branch: `git checkout -b feature/new-feature` |
| 71 | +2. Make changes following the existing code patterns |
| 72 | +3. Write tests for new functionality |
| 73 | + |
| 74 | +### Plugin Development |
| 75 | + |
| 76 | +For developing plugins, see the [plugins documentation](../3_advanced/plugins.md). |
| 77 | + |
| 78 | +### Getting Help |
| 79 | + |
| 80 | +- Check existing [GitHub issues](https://github.com/SynBioHub/synbiohub3/issues) |
| 81 | +- Join the [developer mailing list](mailing_lists.md) |
| 82 | +- Review the [API documentation](../3_advanced/api_documentation.md) |
| 83 | + |
| 84 | +## Next Steps |
| 85 | + |
| 86 | +Once your development environment is set up: |
| 87 | + |
| 88 | +1. Explore the codebase structure |
| 89 | +2. Review existing issues for contribution opportunities |
| 90 | + |
| 91 | +Happy coding! 🎉 |
0 commit comments