Skip to content

Environment Variables ​

ZViewer is configured through environment variables at startup, plus settings stored in the database and edited in the admin panel.


Backend ​

Basic Configuration ​

VariableDescriptionDefault
PORTBackend service port3333
HOSTListen addressEmpty (dual-stack)
CONFIG_DIRData root directory<project-root>/config
DATABASE_URLSQLite file path<config>/dev.sqlite
CORS_ORIGINAllowed CORS origins, comma-separated*
TRUSTED_PROXY_CIDRSTrusted reverse-proxy ranges (for forwarded headers)Empty

JWT Authentication ​

VariableDescriptionDefault
JWT_ACCESS_SECRETAccess token secretGenerated and stored in config/jwt-secrets.json
JWT_REFRESH_SECRETRefresh token secretSame file
JWT_ACCESS_EXPIRES_INAccess token validity24h
JWT_REFRESH_EXPIRES_INRefresh token validity30d (guests: 1h / 7d)

Set both secrets explicitly in production so restarting does not invalidate sessions.

Voice and Sharing Media ​

Voice and screen sharing are peer-to-peer; the server carries signaling only. These ports belong to the built-in media plane and are used by the legacy voice path.

VariableDescriptionDefault
SHARE_MEDIA_PORTMedia UDP port3333
SHARE_MEDIA_TCP_PORTMedia TCP port. Must not equal PORT3337
SHARE_MEDIA_PUBLIC_IPPublic IP under NAT 1:1 (cloud / FRP)Auto

Streaming Ports ​

VariableDescriptionDefault
RTMP_PORTRTMP streaming port3334
STREAM_PUSH_ENABLED0 disables streaming entirelyEnabled
STREAM_PUSH_OFFLINE_GRACE_SECONDSOffline grace after the publisher stops60
NMS_EMBEDDED0 disables the built-in media serviceEmbedded
NMS_BINDBuilt-in RTMP listen address0.0.0.0
NMS_HTTP_FLV_URLExternal FLV upstream; when set, /live proxies insteadEmpty (in-process)
HTTP_FLV_PORTProbe port for external mode only3335
SERVER_HOSTHostname used in the generated RTMP addressRequest Host

Certificates and Updates ​

VariableDescriptionDefault
HTTPSStart with HTTPSOff
SSL_CERT_PATH / SSL_KEY_PATHCertificate and key pathconfig/ssl/cert.pem / key.pem
ZVIEWER_CERT_CHALLENGE_PORTACME HTTP-01 challenge port80
ZVIEWER_UPDATE_SOURCEUpdate source: github / gitcodeMirror
ZVIEWER_UPDATE_API_BASECustom manifest URLEmpty
ZVIEWER_DESKTOPSet by the desktop shell; web update endpoints return 409Empty

Frontend Build Environment Variables ​

Build-time only; they end up in the bundle.

VariableDescriptionDefault
VITE_API_URLAPI base URLEmpty (window.location.origin)
VITE_SOCKET_URLSocket.IO base URLEmpty (same)
VITE_FLV_BASE_URLFLV playback base URL/live
VITE_RTMP_PORTRTMP port hint3334

During development Vite proxies /api, /socket.io, /signal and /live to the backend, so no configuration is needed.


Runtime Settings (Admin Panel) ​

Stored in the database and edited in the admin panel: registration mode, room creation mode, permission matrix, feature switches (dashDisabled / playsvideoEnabled / betaFeaturesEnabled), inactive-room cleanup, update source, room floating entries and default parse modes. Changed through /api/admin/settings; the frontend reads public ones from /api/auth/public-settings.

Generating Random Keys ​

bash
openssl rand -base64 32

This project is licensed under CC BY-NC-SA.