Run a refgenie server
Refgenie includes a built-in server that exposes a REST API for listing, browsing, and downloading genome assets. The server also provides GA4GH DRS endpoints and can aggregate data channels from multiple sources.
Start the server
Section titled “Start the server”refgenie serveThis starts the server on port 8000 by default.
| Flag | Description |
|---|---|
-p, --port | Port to run the server on (default: 8000) |
-r, --reload | Enable auto-reload on code changes (for development) |
Example with custom port:
refgenie serve -p 5000Configuration via environment variables
Section titled “Configuration via environment variables”The server reads the same environment variables as the CLI:
| Variable | Default | Description |
|---|---|---|
REFGENIE_HOME_PATH | ~/.refgenie | Base directory for refgenie files |
REFGENIE_DB_CONFIG_PATH | $REFGENIE_HOME_PATH/refgenie_db_config.yaml | Path to database config |
REFGENIE_GENOME_FOLDER | $REFGENIE_HOME_PATH/genomes | Directory for genome asset data |
REFGENIE_GENOME_STAGE_FOLDER | $REFGENIE_HOME_PATH/archives | Directory for staged assets (served to clients) |
REFGENIE_LOG_LEVEL | INFO | Log verbosity |
For production deployments, configure PostgreSQL as the database backend. See Database backends for setup details.
Staging workflow for serving
Section titled “Staging workflow for serving”The server serves assets from the stage folder (REFGENIE_GENOME_STAGE_FOLDER). Before assets are available to clients, they must be built and staged:
# 1. Build the assetrefgenie build hg38/fasta
# 2. Stage the asset (creates symlinks or tarballs in the stage folder)refgenie stage stage hg38/fasta
# 3. Start the serverrefgenie serveYou can combine building and staging in one step:
refgenie build hg38/fasta --stageSee Stage assets for serving for details on the staging system.
Interacting with the API
Section titled “Interacting with the API”Once the server is running, you can:
- Browse the API docs at
http://localhost:8000/docs(Swagger UI) - List available assets via the REST API
- Use
refgenie pullfrom any client machine pointed at your server
Subscribe a client to a server
Section titled “Subscribe a client to a server”On a client machine, subscribe to a remote server:
refgenie subscribe -s http://your-server:8000Then pull assets:
refgenie pull hg38/fastaServer vs. dashboard
Section titled “Server vs. dashboard”| Feature | refgenie serve | refgenie dash |
|---|---|---|
| Purpose | Serve assets to remote clients via API | Browse your local refgenie instance |
| Network | Exposes HTTP API for external clients | Local web UI only |
| Default port | 8000 | 8080 |
See Use the dashboard for dashboard documentation.
Related pages
Section titled “Related pages”- Serving modes — How asset classes declare their delivery strategy
- Configure remote storage — Push staged assets to S3 or other cloud storage
- Database backends — SQLite vs. PostgreSQL configuration
- Use the dashboard — Local web UI for browsing genomes and assets