Appearance
Running the RustChat Environment
RustChat is containerized using Docker Compose for easy setup and development. The environment includes:
- Backend: Rust (Axum) API
- Frontend: Vue 3 + Vite (Served via Nginx)
- Postgres: Database
- Redis: Caching
- MinIO: S3-compatible object storage
- Meilisearch: (Optional) Full-text search engine
Prerequisites
- Docker installed.
- Docker Compose installed (usually included with Docker Desktop).
Quick Start
Build and Start Services: Run the following command in the project root to build the backend and frontend images and start all services:
bashdocker compose up --build -dThe
-dflag runs containers in detached mode (background).Verify Services: Check the status of the containers:
bashdocker compose psAll services (
backend,frontend,postgres,redis,minio,createbuckets) should beUp(orExited (0)forcreatebuckets).Access the Application:
- Frontend: http://localhost:8080
- Backend API: http://localhost:3000
- MinIO Console: http://localhost:9001 (use your
RUSTFS_ACCESS_KEY/RUSTFS_SECRET_KEY) - Meilisearch: http://localhost:7700 (if enabled)
Development Mode
If you are actively developing code:
Backend Development
You can run the backend locally while keeping infrastructure services (DB, Redis, MinIO) in Docker.
- Stop the
backendcontainer if running:docker compose stop backend - Run cargo locally:bashNote: Ensure your local
cd backend cargo run.envfile points to localhost ports for DB/Redis/MinIO.
Frontend Development
- Stop the
frontendcontainer if running:docker compose stop frontend - Run npm locally:bashAccess at http://localhost:5173.
cd frontend npm run dev
Security Modes (Dev vs Prod)
RustChat changes behavior based on RUSTCHAT_ENVIRONMENT.
development(default): CORS is permissive unless you setRUSTCHAT_CORS_ALLOWED_ORIGINS.production: CORS is deny-by-default unlessRUSTCHAT_CORS_ALLOWED_ORIGINSis explicitly set.
Recommended production settings:
- Set
RUSTCHAT_ENVIRONMENT=production - Set
RUSTCHAT_CORS_ALLOWED_ORIGINSto your exact frontend origins (comma-separated) - Use strong secrets for
RUSTCHAT_JWT_SECRETandRUSTCHAT_ENCRYPTION_KEY - Terminate TLS at the reverse proxy/load balancer (HTTPS at the edge)
- Use encrypted SSO client secrets (stored via Admin UI/API)
- Set TURN credentials explicitly if
TURN_SERVER_ENABLED=true - Query-token compatibility is removed (
RUSTCHAT_SECURITY_OAUTH_TOKEN_DELIVERY=queryandRUSTCHAT_SECURITY_WS_ALLOW_QUERY_TOKEN=trueare rejected at startup) - If
RUSTCHAT_SITE_URLis set in production, it must usehttps://;RUSTCHAT_CORS_ALLOWED_ORIGINSentries must also behttps://only.
Troubleshooting
- Database Connection Errors: Ensure the
postgrescontainer is healthy (docker compose ps). - S3 Upload Failures: Ensure the
createbucketsservice ran successfully. You can manually create the bucket in MinIO Console if needed. - Rebuild: If you change dependencies or Dockerfiles, force a rebuild:bash
docker compose up --build -d