A SvelteKit-based UI for the GoChat service. The project uses Svelte 5, TypeScript and Tailwind CSS to deliver a modern chat experience with real-time updates.
- Channels and direct messages
- REST and WebSocket clients
- Internationalisation with Paraglide
- Built with the SvelteKit static adapter
- Node.js 20+
- npm
npm installCopy .env.example to .env and set the required environment variables:
PUBLIC_WS_URL=
PUBLIC_BASE_PATH=
PUBLIC_API_BASE_URL=PUBLIC_WS_URL— websocket endpoint for real-time updates.PUBLIC_BASE_PATH— optional path prefix when serving the UI from a subdirectory (e.g./app). Set this before runningnpm run buildso the static output emits assets under<prefix>/_app.PUBLIC_API_BASE_URL— base URL for REST API calls from the browser.
Start the development server:
npm run devRun linting and type checks:
npm run lint
npm run checkCreate an optimized production build:
npm run buildPreview the built app locally:
npm run previewThe repository includes a multi-stage Dockerfile that builds the static site and serves it with Nginx.
Build the image:
docker build -t gochatui .Run the container:
docker run -p 3000:80 gochatuiThe application will be available at http://localhost:3000.
At container start an entrypoint script writes /usr/share/nginx/html/runtime-env.js with the values of PUBLIC_API_BASE_URL, PUBLIC_WS_URL and PUBLIC_BASE_PATH. The page includes this script before the Svelte bundle loads, so browser code can discover deployment-specific endpoints without rebuilding the image.
-
Leave a variable unset (or empty) to fall back to the build-time value baked into the static bundle.
-
Override the defaults by passing environment variables to
docker run(or your orchestrator):docker run -p 3000:80 \ -e PUBLIC_API_BASE_URL=https://api.example.com/v1 \ -e PUBLIC_WS_URL=wss://ws.example.com/subscribe \ -e PUBLIC_BASE_PATH=/app \ gochatui
The generated script is served as a static asset (/runtime-env.js), so the configuration is cached by browsers and CDNs just like other files. Restart the container after changing environment variables to refresh the runtime configuration.
When deploying behind a reverse proxy that only forwards a sub-path, ensure that:
PUBLIC_BASE_PATHis set to the forwarded prefix at build time.- Your proxy forwards that prefix (and its static assets) to the UI container. The provided
nginx.confserves the app at/and issues redirects for legacy/appURLs so existing bookmarks continue to work.
This project is proprietary and does not yet specify a license.