Free, open-source screen sharing for private live streams with friends. Watch together in a browser or self-host Piik. 免费开源的私密屏幕共享,支持游戏直播、一起看电影与自部署。
# Application
# Use 127.0.0.1 instead when only a same-host reverse proxy should connect.
LISTEN_HOST=0.0.0.0
PORT=8787
# For LAN viewers, replace localhost with this computer's LAN address.
PUBLIC_BASE_URL=http://localhost:8787
# Leave empty to follow PUBLIC_BASE_URL. For multiple trusted browser addresses,
# list all exact origins (scheme, host and port), including PUBLIC_BASE_URL.
ALLOWED_ORIGINS=
# Optional direct HTTPS; leave these unset behind a reverse proxy.
# Set PUBLIC_BASE_URL=https://<LAN-IP>:8787 and TLS_SELF_SIGNED=true for
# private LAN use. The temporary certificate changes on each process restart.
# Or supply both PEM files; Piik loads them at startup, without managing renewal.
TLS_SELF_SIGNED=false
TLS_CERT_FILE=
TLS_KEY_FILE=
# Optional site access password in every environment. Unset or empty allows
# entry without a site password; room ownership and invitations still apply.
# Non-empty values are matched exactly; spaces and Unicode are supported.
SITE_ACCESS_PASSWORD=
# Rooms persist in rooms.sqlite under the working directory by default (also
# when blank). Set :memory: explicitly for process-memory rooms. Deployments
# should use an access-restricted absolute path outside the release directory,
# preserving the existing database and its writable parent across updates.
ROOM_DATABASE_PATH=
# Optional empty-room recycling. 0 keeps rooms indefinitely (default).
# 3600 expires rooms after an hour with no authenticated participants; when
# all codes are used, the oldest empty room may be reclaimed earlier.
ROOM_EMPTY_TIMEOUT_SECONDS=0
# Viewers per room, excluding the Host. Valid range: 1..20; default: 20.
MAX_VIEWERS_PER_ROOM=20
# Bounded standard-WebRTC relay/SFU controller is active for every room.
# One steady outbound media-copy capacity for every non-server endpoint.
# A peer child or Host SFU publication consumes one copy. Valid values: 1, 2, 3.
ENDPOINT_MEDIA_COPY_CAPACITY=2
# During pre-release route canaries, this enables sanitized room/ordinal events.
# PIIK_DEBUG=route
# Optional in-process automatic SFU fallback. Set SFU_UDP_PORT=7882 to enable;
# unset or empty disables it and fixes Privacy mode on for every room.
# STUN/signaling/P2P remain available. Local App modes never create this listener.
# Ingress uses the 9000-room code capacity; egress uses that capacity times the
# configured per-room Viewer admission.
SFU_UDP_PORT=
# IPv4 bind address, independent of HTTP LISTEN_HOST and advertised media IP.
SFU_LISTEN_HOST=0.0.0.0
# Optional advertised IPv4 or DNS hostname when the listener is behind NAT.
# Hostnames resolve at startup; restart Piik after the public IPv4 changes.
SFU_PUBLIC_IP=
# Require server media for every room instead of P2P-first. Requires SFU_UDP_PORT.
SFU_ONLY=false
# Ordinary peer ICE discovery. Production requires at least one STUN URL.
# These are advertised addresses, not local listener addresses. They may use
# an unproxied DNS name distinct from PUBLIC_BASE_URL. Separate URLs with commas.
STUN_URLS=
# Hosted STUN is in-process. With STUN_URLS configured, bind this IPv4 address
# on UDP 3478 (also 3479/3480 below). It is independent of HTTP LISTEN_HOST.
# Local App modes never create these listeners, even with public discovery.
STUN_LISTEN_HOST=0.0.0.0
# Optional bounded NAT traversal support. Current pages use it automatically
# on P2P-first sites after all three local STUN listeners bind. Auxiliary
# discovery uses UDP 3479/3480 at the first STUN_URLS endpoint on UDP 3478.
# Cloud security-group and host firewall rules must also allow these UDP ports.
NAT_PREDICTION_ENABLED=false
# Development example (two processes): Vite serves the Browser on 8787 and
# proxies /api, /healthz and /signal to the Go server on 8788. Keep
# PUBLIC_BASE_URL and ALLOWED_ORIGINS on the Browser origin above.
# PIIK_ENV=development
# PORT=8788
# Production example (keep any chosen password in an untracked environment):
# PIIK_ENV=production
# PUBLIC_BASE_URL=https://share.example.com
# ALLOWED_ORIGINS=https://share.example.com
# SITE_ACCESS_PASSWORD=
# STUN_URLS=stun:stun.example.com:3478
# NAT_PREDICTION_ENABLED=true
# Automatic SFU fallback (does not replace STUN above):
# SFU_UDP_PORT=7882
# SFU_PUBLIC_IP=198.51.100.5
# ENDPOINT_MEDIA_COPY_CAPACITY=2