Prerequisites
Before setting up the server, ensure you have the required software installed.Install Bun
Install Node.js
Node.js 18+ is required. Download from nodejs.org:
Install Rust (for building desktop)
If you plan to build the desktop app, install Rust v1.88.0:
On Windows, you also need MSVC build tools and WebView2 runtime. See Tauri prerequisites.
Clone the Repository
Clone the BloxChat source code:Install Dependencies
Install all workspace dependencies:apps/desktop- Tauri desktop appapps/server- Bun backend serverpackages/api- Shared tRPC API logic
Configure Environment Variables
Createapps/server/.env with required variables:
apps/server/.env
See Environment Variables for complete documentation.
Development Mode
Run the backend server and desktop app in development mode:- Starts the backend server on
http://localhost:3000 - Watches for file changes and auto-reloads
- Launches the Tauri desktop app in dev mode
Configure Desktop App for Local API
By default, the desktop app connects to the production API athttps://bloxchat.logix.lol.
To test with your local server:
Production Mode
Run Backend Only
To run just the backend server (without desktop app):3000 by default:
apps/server/src/index.ts
Build for Production
Build all packages:Production Deployment
Deploy with Process Manager
Deploy with Process Manager
Use a process manager like PM2 or systemd:PM2 Example:Systemd Service:Enable and start:
/etc/systemd/system/bloxchat.service
Deploy Behind Reverse Proxy
Deploy Behind Reverse Proxy
Use nginx or Caddy to add HTTPS and handle WebSocket upgrades:Nginx Configuration:Caddy Configuration:Caddy automatically handles HTTPS with Let’s Encrypt.
/etc/nginx/sites-available/bloxchat
Caddyfile
Deploy with Docker
Deploy with Docker
Create a Dockerfile for the server:Build and run:
Dockerfile
Build Desktop App
Build the desktop app installer for distribution:- MSI Installer:
apps/desktop/src-tauri/target/release/bundle/msi/BloxChat_*.msi - Executable:
apps/desktop/src-tauri/target/release/BloxChat.exe
Building the desktop app requires Windows and all Tauri prerequisites installed.
Customize API URL for Distribution
Before building, you can set the default API URL in the app. Users can always change it in Settings, but this sets the initial value. Look for the API URL configuration in the desktop app source code (typically in settings or config files).Useful Commands
Troubleshooting
Server won't start - environment variable errors
Server won't start - environment variable errors
The server validates all environment variables on startup. Check
packages/api/src/config/env.ts for requirements:JWT_SECRET: Must be 32-64 charactersVERIFICATION_SECRET: Must be 64+ charactersVERIFICATION_PLACE_ID: Must be numeric Roblox place ID
Desktop app can't connect to server
Desktop app can't connect to server
Verify:
- Server is running on
http://localhost:3000 - API URL in app Settings is exactly
http://localhost:3000(includehttp://) - No firewall blocking local connections
WebSocket connection fails
WebSocket connection fails
The server uses
ws package and tRPC WebSocket adapter. Ensure:- WebSocket upgrades are allowed (check reverse proxy config)
- No middleware blocking upgrade headers
- CORS is configured to allow connections
apps/server/src/index.ts shows WebSocket setup:Build failures
Build failures
Common issues:Bun version mismatch:Missing Rust toolchain:Windows MSVC tools not installed:
- Install Visual Studio Build Tools
- Install WebView2 runtime
Port 3000 already in use
Port 3000 already in use
Change the port in Or find and kill the process:
apps/server/src/index.ts:Next Steps
Environment Variables
Learn about all configuration options
Game Integration
Connect your Roblox game to the backend