Monorepo for:
stardive-api: modular API server intended forapi.stardive.spacestardive: companion CLI (including egui file UI)stardive-core: shared contracts, config, and client helpers
cargo run -p stardive-api
cargo run -p stardive -- api healthRecommended one-liner (downloads this repo script and runs it):
curl -fsSL https://raw.githubusercontent.com/nmb4/stardive-api/main/installers/install-stardive.sh | bashPowerShell (Windows):
irm https://raw.githubusercontent.com/nmb4/stardive-api/main/installers/install-stardive.ps1 | iexWhat this does:
- uses the pkgx cURL bootstrap to create a temporary Rust toolchain environment
- runs
cargo install stardivein that temporary environment - installs only the final
stardivebinary to/usr/local/bin/stardive(usessudoif needed) - does not require permanently installing pkgx or rustup on your system
Direct crates.io install (if you already have Rust):
cargo install stardiveLocal fallback from this repository:
cargo install --path crates/stardiveRun local without installing:
cargo run -p stardive -- --helpGET /up(top-level health endpoint for ONCE/Kamal-style checks)GET /healthPOST /search/textPOST /search/newsPOST /extractPOST /files(multipart field:file, max default1_073_741_824bytes)GET /filesGET /files/{id}POST /render/snippet(code, optionallanguage/theme,format: svg|png)GET /lostandfound/healthPOST /lostandfound/auth/loginGET /lostandfound/itemsGET /lostandfound/items/{id}POST /lostandfound/itemsPATCH /lostandfound/items/{id}/statusGET /lostandfound/claimsPOST /lostandfound/claimsGET /lostandfound/categoriesGET /installersGET /installers/{name}GET /eternalGET /eternal/{name}
lostandfound is mounted under /v1 like every module, so the full URL for login is /v1/lostandfound/auth/login.
stardive-api environment variables:
STARDIVE_BIND_ADDR(default0.0.0.0:8080)STARDIVE_DATA_DIR(defaultdata)STARDIVE_LOG_DIR(default<STARDIVE_DATA_DIR>/logs, daily-rotated debug logs)STARDIVE_INSTALLERS_DIR(defaultinstallers)STARDIVE_ETERNAL_DIR(defaulteternal)STARDIVE_API_KEY(optional; when set, bearer auth is enforced except/v1/health)STARDIVE_MAX_UPLOAD_BYTES(default1073741824)STARDIVE_MAX_SNIPPET_CHARS(default20000)STARDIVE_ENABLE_HEALTH|SEARCH|FILES|RENDER|LOSTANDFOUND|INSTALLERS|ETERNAL(defaulttrue)
Logging behavior:
- request and response logs are emitted at
infolevel - startup prints module availability and active config values at
infolevel debug+ logs are also written to a daily-rotated file:stardive-api.debug.loginSTARDIVE_LOG_DIR
stardive CLI config:
- file:
~/.config/stardive/config.toml - keys:
base_url,api_key - precedence: CLI flags > env (
STARDIVE_BASE_URL,STARDIVE_API_KEY) > config file > defaults
stardive api healthstardive search text --query \"...\"stardive search news --query \"...\"stardive extract --url \"https://...\"stardive file upload <path>stardive file liststardive file download <id> --output <path>stardive file guistardive render snippet --code \"...\" --format svg --output out.svgstardive update
stardive update detects install variants and picks an update strategy in this order:
- crates.io install (
cargo install) if detected - native pkgx install (
pkgx pkgm install) if detected - script/unknown fallback (re-runs the GitHub installer one-liner)
This workspace is set up to publish the CLI in two steps:
- Publish shared core crate:
cargo publish -p stardive-core- Publish companion CLI crate:
cargo publish -p stardiveLocal packaging checks before publish:
cargo package -p stardive-core
cargo package -p stardiveinstallers/: shell scripts served via/v1/installerseternal/: static long-lived resources served via/v1/eternal
According to ONCE compatibility requirements, the app image must:
- serve HTTP on port
80 - expose a successful health endpoint at
/up - persist data in
/storage
This repo includes a Dockerfile that does this by default.
Build:
docker build -t ghcr.io/YOUR_USER/stardive-api:latest .Run:
docker run --rm \
-p 80:80 \
-v stardive-storage:/storage \
ghcr.io/YOUR_USER/stardive-api:latestOptional ONCE backup hooks are included at /hooks/pre-backup and /hooks/post-restore.
Automate the server rollout flow (push -> remote pull/build/push -> once update -> health checks):
./scripts/deploy-stardive-server.shUse ./scripts/deploy-stardive-server.sh --help for options like --no-push, custom host, branch, or image.