Skip to content

Configuration Reference


Backend Configuration

Environment Variables

VariableDefaultDescription
PORT8080HTTP/WebSocket server listening port

Built-in Constants

The following parameters are defined in code and require recompilation to modify:

ParameterValueFileDescription
MaxMembers50internal/room/room.goMaximum members per room
writeWait10sinternal/network/client.goWebSocket write timeout
pongWait40sinternal/network/client.goRead timeout (1.5× heartbeat)
sendBufferSize256internal/network/client.goSend buffer size
maxMessageSize102400 bytesinternal/network/client.goMaximum bytes per message (includes file chunks)
rateLimitWindow10sinternal/network/client.goRate limit sliding window
rateLimitMaxCount10internal/network/client.goMaximum messages per window
Ping interval25sinternal/network/client.goHeartbeat send interval
NanoID length21 charsinternal/network/hub.goRoom ID length

Frontend Configuration

Environment Variables

VariableDefaultFileDescription
VITE_WS_URLws://localhost:8080/ws.env.developmentWebSocket server address

Environment Files

  • .env.development — Development environment configuration
  • .env.production — Production environment configuration (must be created)

Production example .env.production:

VITE_WS_URL=wss://your-backend-domain.com/ws

Built-in Constants

ParameterValueFileDescription
MAX_MESSAGES200stores/chatStore.tsMaximum messages retained in list
RATE_LIMIT_WINDOW_MS10000stores/chatStore.tsClient-side rate limit window
RATE_LIMIT_MAX10stores/chatStore.tsMaximum sends per window
TYPING_TIMEOUT_MS2000stores/chatStore.tsTyping status auto-cancel time
MAX_LENGTH500components/MessageInput.tsxMaximum characters per message
SHOW_COUNT_THRESHOLD400components/MessageInput.tsxThreshold to show character count
BACKOFF_INITIAL_MS1000network/websocket.tsReconnection initial backoff time
BACKOFF_MAX_MS30000network/websocket.tsReconnection maximum backoff time

Vite Configuration

File: arthas-client/vite.config.ts

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [react()],
})

CLI Client Configuration

Command-Line Arguments

ArgumentDefaultDescription
--serverwss://arthas-chat.onrender.com/wsWebSocket server URL
--nameInteractive promptDisplay nickname (1-20 characters)
--versionShow version and exit
--helpShow help information and exit

Environment Variables

VariableDefaultDescription
ARTHAS_SERVERWebSocket server URL (lower priority than --server flag)

Built-in Constants

ParameterValueFileDescription
joinTimeout30sinternal/chat/session.goTimeout waiting for server response
writeWait10sinternal/network/websocket.goWebSocket write timeout
pongWait40sinternal/network/websocket.goRead timeout (1.6× heartbeat)
maxMessageSize102400internal/network/websocket.goMaximum bytes per message
sendChCapacity16internal/network/websocket.goSend queue capacity
Nickname length limit20 runesinternal/ui/input.goMaximum display name length
Message length limit500 runesinternal/ui/input.goMaximum message length

Configuration Priority

--server flag > ARTHAS_SERVER environment variable > default (wss://arthas-chat.onrender.com/ws)
--name flag > interactive prompt input

Tailwind Configuration

File: arthas-client/tailwind.config.js

Uses dark theme by default, scans all TSX/TS files under src/.


Docker Configuration

File: arthas-server/Dockerfile

ParameterValueDescription
Base imagegolang:1.23-alpineBuild stage
Runtime imagealpine:3.23Minimal runtime environment
Exposed port7860Docker default port
PORT environment variable7860Server listening port

Encryption Parameters

ParameterValueDescription
AlgorithmAES-256-GCMAEAD authenticated encryption
Key length256 bits (32 bytes)AES-256
IV length96 bits (12 bytes)GCM recommended length
roomId length21 charsNanoID default length
Share code format{roomId}:{base64url(key)}Total 65 characters
Share code length65 chars21 + 1 + 43

Error Codes

CodeNameTrigger ConditionClient Message
E001ROOM_NOT_FOUNDroomId does not exist during JoinRoom”Room does not exist or has been closed”
E002ROOM_FULLRoom is full (50 members) during JoinRoom”Room is full, cannot join”
E003NOT_IN_ROOMSendMessage/Typing without joining a room”Please join a room first”
E004RATE_LIMITEDMessage rate exceeds 10 messages/10 seconds”Sending too fast, please try again later”
E005INVALID_MESSAGEInvalid message format (empty/too long)“Invalid message format”

Next Steps