Backend service for decentralized OpenChat server instances.
- Project maturity:
Pre-Alpha - Stability expectation: interfaces and behavior may change without backward compatibility until Beta.
- E2EE-compatible channel message architecture.
- Membership-bound history access rules.
- Multi-device key envelope relay contracts.
- SFU-based WebRTC backend signaling and room orchestration.
- Go + Postgres module layout for implementation.
docs/architecture/README.md
go run ./cmd/openchatdDefault address: :8080
On startup, the server logs build metadata:
versioncommitbuild_timevcs_modified
RTC ICE server URLs are configurable through environment variables and default to Google STUN.
Defaults:
OPENCHAT_RTC_STUN_URLSdefaults to:stun:stun.l.google.com:19302stun:stun1.l.google.com:19302stun:stun2.l.google.com:19302stun:stun3.l.google.com:19302stun:stun4.l.google.com:19302
OPENCHAT_RTC_TURN_URLSdefaults to empty (no TURN advertised).
Config variables:
OPENCHAT_RTC_STUN_URLScomma-separated STUN URLs.OPENCHAT_RTC_TURN_URLScomma-separated TURN/TURNS URLs.OPENCHAT_RTC_TURN_USERNAMETURN username.OPENCHAT_RTC_TURN_CREDENTIALTURN credential/password.OPENCHAT_RTC_TURN_CREDENTIAL_TYPETURN credential type (for examplestatic).
To disable STUN advertisement entirely, set OPENCHAT_RTC_STUN_URLS=none (or -).
OPENCHAT_ALLOW_SERVER_CREATIONcontrols whether users can create servers through backend APIs.- Default:
true.
The backend advertises RTC subscribe receive caps and resolves effective limits per call using:
channeloverride- then
serveroverride - then
instancedefault
Defaults:
OPENCHAT_RTC_SUBSCRIBE_MAX_VIDEO_TRACKS=8OPENCHAT_RTC_SUBSCRIBE_MAX_AUDIO_TRACKS=16
Optional override env vars (CSV id=value):
OPENCHAT_RTC_SUBSCRIBE_MAX_VIDEO_TRACKS_BY_SERVEROPENCHAT_RTC_SUBSCRIBE_MAX_AUDIO_TRACKS_BY_SERVEROPENCHAT_RTC_SUBSCRIBE_MAX_VIDEO_TRACKS_BY_CHANNELOPENCHAT_RTC_SUBSCRIBE_MAX_AUDIO_TRACKS_BY_CHANNEL
Examples:
OPENCHAT_RTC_SUBSCRIBE_MAX_VIDEO_TRACKS_BY_SERVER=0d5f6a8b-1f43-4f4f-9d8e-9ab6f913f4f8=10,6b6d8f24-a39f-4f8a-9f9d-0f70f2a2e9f1=6OPENCHAT_RTC_SUBSCRIBE_MAX_AUDIO_TRACKS_BY_CHANNEL=vc_general=20,tl_vc_huddle=12
Wire contracts:
GET /v1/client/capabilitiesincludesrtc.subscribe_receive_policy.POST /v1/rtc/channels/:channel_id/join-ticketincludes resolvedsubscribe_receive_policy.
Docker builds now require a commit hash so runtime startup logs always reference the build commit.
docker build \
--build-arg BUILD_VERSION=main \
--build-arg BUILD_COMMIT=$(git rev-parse --verify HEAD) \
--build-arg BUILD_TIME=$(date -u +%Y-%m-%dT%H:%M:%SZ) \
-t openchat-backend:dev .For tagged builds, set BUILD_VERSION to the tag value you publish (for example v1.2.3).
GET /healthzGET /v1/client/capabilitiesGET /v1/servers(requester-scoped when identity headers are present)POST /v1/serversPOST /v1/servers/:server_id/ownership:claimPOST /v1/servers/:server_id/channelsPOST /v1/servers/:server_id/categoriesDELETE /v1/servers/:server_id/categories/:group_idGET /v1/servers/:server_id/settingsPUT /v1/servers/:server_id/settingsDELETE /v1/servers/:server_id/membershipGET /v1/profile/mePUT /v1/profile/mePOST /v1/profile/avatarGET /v1/profile/avatar/{assetID}GET /v1/profiles:batchPOST /v1/rtc/channels/:channel_id/join-ticketGET /v1/rtc/signaling(WebSocket)
Realtime channel events (GET /v1/realtime WebSocket):
chat.channel.createdchat.category.createdchat.server.updated
Chart path:
charts/openchat-backend
Render locally:
helm template openchat-backend ./charts/openchat-backendInstall/upgrade:
helm upgrade --install openchat-backend ./charts/openchat-backend \
--namespace openchat --create-namespaceEnable optional coturn (TURN + STUN on 3478):
coturn:
enabled: true
externalIP: "203.0.113.10"
realm: "openchat.example.com"
auth:
username: "openchat-turn"
password: "replace-me"
backend:
injectEnv: true
advertisedTURNURLs:
- "turn:turn.openchat.example.com:3478?transport=udp"
- "turn:turn.openchat.example.com:3478?transport=tcp"
advertisedSTUNURLs:
- "stun:turn.openchat.example.com:3478"
appendGoogleStunFallback: trueNotes:
coturn.externalIP,coturn.backend.advertisedTURNURLs, andcoturn.backend.advertisedSTUNURLsare required when coturn is enabled with backend env injection.- When enabled, backend STUN advertisement is
advertisedSTUNURLsfirst, then Google STUN fallback (unless disabled). - Explicit
env.OPENCHAT_RTC_*values still override coturn auto-injected RTC env.
OCI release flow:
- Push a git tag matching
chart-vX.X.X. - CI packages and publishes to GHCR as:
ghcr.io/<owner>/charts/openchat-backend:X.X.Xghcr.io/<owner>/charts/openchat-backend:chart-vX.X.X
This project is licensed under GNU General Public License v2.0 only (GPL-2.0-only).
See LICENSE.md for the full license text.