Development Guide
Development Guide
This guide will help you set up Orbit for development and explain how to contribute to the project.
Prerequisites
Before you begin development, ensure you have these tools installed:
- Go 1.21 or later
- Node.js 18 or later
- pnpm 8 or later
- Python 3.10 or later
- Ansible
- Terraform
Development Environment Setup
First, clone the repository:
git clone https://github.com/orbitscanner/orbitcd orbit
Backend Setup
The backend consists of a Go API server and Python automation scripts:
# Navigate to backend directorycd backend
# Install Go dependenciesgo mod download
# Set up Python environmentpython -m venv venvsource venv/bin/activate # On Windows: .\venv\Scripts\activatepip install -r requirements.txt
# Run the backend in development modego run main.go serve
The backend API will be available at http://localhost:8090
Frontend Setup
The frontend is built with SvelteKit and needs to be run separately during development:
# Navigate to frontend directorycd frontend
# Install dependenciespnpm install
# Start development serverpnpm dev
The frontend development server will be available at http://localhost:5173
Environment Configuration
Frontend Environment Variables
Create a .env
file in the frontend directory:
PUBLIC_POCKETBASE_URL=http://localhost:8090ORBIT_API_KEY=12345678901234567890123456789012
Backend Environment Variables
The backend uses the following environment variables:
ORBIT_API_KEY=12345678901234567890123456789012ORBIT_LOG_LEVEL=debug # Optional, defaults to info
Development Workflow
Hot Reloading
The development environment supports various levels of hot reloading:
- Frontend: Changes automatically reload in the browser
- Backend Go: Requires manual restart
- Backend Python: Files automatically reload
Code Structure
orbit/├── frontend/ # SvelteKit frontend application│ ├── src/ # Frontend source code│ └── static/ # Static assets├── backend/ # Go backend application│ ├── api/ # API endpoints│ ├── core/ # Core business logic│ └── scripts/ # Python automation scripts└── docs/ # Documentation
Building for Production
When you need to build for production:
# Build frontendcd frontendpnpm build
# Build backendcd ../backendgo build
Testing
Running Tests
# Frontend testscd frontendpnpm testpnpm test:e2e # Run end-to-end tests
# Backend testscd backendgo test ./...
Writing Tests
- Frontend tests use Vitest and Playwright
- Backend tests use Go’s testing package
- Include tests with all new features
- Ensure existing tests pass before submitting PRs
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Write or update tests
- Submit a pull request
Pull Request Guidelines
- Keep changes focused and atomic
- Follow existing code style
- Include relevant tests
- Update documentation
- Provide clear PR description
Troubleshooting
Common development issues and solutions:
Frontend Issues
- Clear
node_modules
and reinstall if dependencies act up - Check browser console for errors
- Verify environment variables are set correctly
Backend Issues
- Ensure Python virtual environment is activated
- Check Go version compatibility
- Verify all dependencies are installed
Getting Help
- Check the documentation
- Join our Discord community
- Open an issue on GitHub