Get your Beacon v2 API up and running in minutes!
- Python 3.11+ installed
- uv package manager (recommended)
# Install uv if not already installed
curl -LsSf https://astral.sh/uv/install.sh | sh
# Create virtual environment and install dependencies
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uv pip install -e ".[dev]"# Copy the example environment file
cp .env.example .env
# Edit .env with your settings (optional for testing)
# The defaults will work out of the box# Start the server
uvicorn beacon_api.main:app --reload
# Or use the Python module directly
python -m beacon_api.mainThe API will be available at:
- API: http://localhost:8000
- Interactive Docs: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
- Health Check: http://localhost:8000/health
- Beacon Info: http://localhost:8000/api/info
# Health check
curl http://localhost:8000/health
# Get Beacon info
curl http://localhost:8000/api/info
# Query individuals (will return 501 until you implement services)
curl -X POST http://localhost:8000/api/individuals \
-H "Content-Type: application/json" \
-d '{
"meta": {
"requested_granularity": "boolean"
}
}'- Open http://localhost:8000/docs in your browser
- Browse available endpoints
- Click "Try it out" on any endpoint
- Execute requests directly from the browser
The skeleton is now running, but endpoints will return 501 (Not Implemented) until you add your database implementation.
-
Choose a database (PostgreSQL, MongoDB, SQLite, etc.)
-
Install database driver:
# For PostgreSQL uv pip install asyncpg # For MongoDB uv pip install motor # For SQLite uv pip install aiosqlite
-
Create service implementations:
- See
docs/implementation_guide.mdfor detailed instructions - Implement abstract methods from
src/beacon_api/services/base.py - Update
src/beacon_api/api/dependencies.pywith your implementations
- See
-
Set up your database:
- Create database schema
- Add migration scripts
- Configure connection in
.env
# Run all tests
pytest
# Run with coverage
pytest --cov=src/beacon_api --cov-report=html
# View coverage report
open htmlcov/index.html # On macOS
# xdg-open htmlcov/index.html # On Linux
# start htmlcov/index.html # On Windows# Build image
docker build -t beacon-api:latest .
# Run container
docker run -p 8000:8000 beacon-api:latest
# Test health check
curl http://localhost:8000/healthbeacon-api/
├── src/beacon_api/
│ ├── api/ # FastAPI routers
│ ├── models/ # Pydantic models
│ ├── services/ # Service interfaces (implement these!)
│ ├── core/ # Configuration
│ └── main.py # Application entry point
├── tests/ # Test suite
├── docs/ # Documentation
└── pyproject.toml # Dependencies
# Use a different port
uvicorn beacon_api.main:app --reload --port 8001# Make sure you're in the virtual environment
source .venv/bin/activate
# Reinstall in editable mode
uv pip install -e .# Reinstall all dependencies
uv pip install -e ".[dev]"- Read the full README.md
- Check the Implementation Guide
- Review the Beacon v2 Specification
- Open an issue on GitHub
✅ Complete Beacon v2 API structure ✅ All standard endpoints (individuals, biosamples, genomic variations, etc.) ✅ Request/response validation with Pydantic ✅ Configuration management ✅ Docker support ✅ GitHub Actions CI/CD ✅ Test framework ✅ Comprehensive documentation
What You Need to Add: Your database implementation!
Ready to implement? Start with docs/implementation_guide.md!