Verbiage

radio

created just now :: modified just now :: 2.27 KB .md

Tools

download raw

radio#

small rust + solidjs radio server. the rust backend owns the api, auth, audio storage, and production static serving; the solid frontend is used for the browser ui.

setup#

cp .env.example .env
npm --prefix frontend install
cargo check

edit .env for your local url, database, admin dids, and audio directory.

environment#

variabledefaultdescription
BIND_ADDR0.0.0.0:3000socket address the rust backend listens on
APP_URLhttp://127.0.0.1:3000public backend url used for oauth client metadata, callbacks, and service defaults
SERVICE_DIDdid:web:localhostservice DID expected as the service-auth JWT audience
SERVICE_IDS#radio_xrpccomma-separated DID document service ids; quote values starting with # in .env
SERVICE_ENDPOINTAPP_URL with http:// rewritten to https://endpoint published in /.well-known/did.json for PDS proxy service routing
OAUTH_AUTHORIZATION_SERVERhttps://bsky.socialauthorization server advertised by /.well-known/oauth-protected-resource
CORS_ORIGINhttp://127.0.0.1:5173allowed browser origin in dev; also used as the frontend redirect base
DATABASE_URLsqlite://radio.dbsqlite database url
SESSION_COOKIE_NAMEradio_sessionauth session cookie name
SESSION_TTL_DAYS30session lifetime in days
ADMIN_DIDSemptycomma-separated did allowlist for admin actions
AUDIO_DIRdata/audiouploaded audio and cover storage directory

development#

run the backend:

cargo run

run the frontend dev server:

npm --prefix frontend run dev

vite proxies /api to http://127.0.0.1:3000 in dev.

production build#

npm --prefix frontend run build
cargo run --release

npm --prefix frontend run build writes the normal vite output to frontend/dist, then copies it into the backend static/ directory. the rust backend serves static/ and falls back to static/index.html for frontend routes.

useful paths#

  • src/ rust backend
  • frontend/ solidjs frontend
  • static/ frontend bundle served by rust
  • data/audio/ default uploaded audio storage
  • migrations/ sqlite migrations