This guide covers running RustChat from source for daily development.
| Tool | Version | Install | Check |
|---|---|---|---|
| Rust | 1.95+ | rustup.rs | rustc --version |
| Node.js | 24+ | nodejs.org | node --version |
| Docker + Compose | 24.0+ / 2.20+ | Docker Desktop | docker compose version |
| sqlx-cli | latest | cargo install sqlx-cli --no-default-features --features postgres |
sqlx --version |
Note: The frontend requires Node.js 24+. If your system has an older version, use nvm or fnm to manage versions.
# 1. Clone and enter
git clone https://github.com/rustchatio/rustchat.git
cd rustchat
# 2. Run automated setup
./scripts/dev-setup.sh
# 3. Edit .env and set secrets
# (see .env.example for required variables)The setup script starts PostgreSQL, Redis, and RustFS in Docker, then prepares the backend and frontend for local development.
# Start only infrastructure services (no backend/frontend containers)
docker compose up -d postgres redis rustfscd backend
# Install sqlx-cli if you haven't already
cargo install sqlx-cli --no-default-features --features postgres
# Run migrations
sqlx migrate run
# Verify (optional)
sqlx migrate infocd backend
# Type check (fast)
cargo check
# Run library tests (no external services needed)
cargo test --lib
# Build release binary
cargo build --release
# Run the server (uses .env for configuration)
cargo runThe backend will be available at http://localhost:3000.
These are enforced in CI. Run them before committing:
cd backend
# Format code
cargo fmt --all
# Check formatting without writing
cargo fmt --all -- --check
# Run clippy (treat warnings as errors)
cargo clippy --all-targets --all-features -- -D warningscd frontend
npm ci --ignore-scripts
npm run apply:dependency-patchesWhy
--ignore-scripts? The project policy blocks install scripts in CI for security. Patches are applied explicitly via the separate command.
cd frontend
# Development server with hot reload
npm run dev
# Production build (with type checking)
npm run build
# Preview production build locally
npm run previewThe dev server will be available at http://localhost:5173.
cd frontend
# Unit tests (vitest)
npm run test:unit
# E2E tests (requires full stack running)
npm run test:e2e
# Update E2E snapshots after intentional UI changes
npx playwright test --update-snapshots- Use
npmonly infrontend/ - Keep
frontend/package-lock.jsoncommitted - Run
npm ci --ignore-scriptsin CI - See Frontend Dependency Policy before adding dependencies
For active development, run three processes in separate terminals:
Terminal 1 — Backend:
cd backend && cargo runTerminal 2 — Frontend:
cd frontend && npm run devTerminal 3 — Push Proxy (optional):
cd push-proxy && cargo runAccess points:
| Service | URL | Notes |
|---|---|---|
| Frontend (dev) | http://localhost:5173 | Hot reload, Vite dev server |
| Frontend (prod build) | http://localhost:8080 | Nginx serving dist/ |
| Backend API | http://localhost:3000 | Direct API access |
| Push Proxy | http://localhost:3001 | Mobile push notifications |
Important: When running the backend locally (not in Docker), ensure
.envpoints tolocalhostfor database and Redis:RUSTCHAT_DATABASE_URL=postgres://rustchat:rustchat@localhost:5432/rustchat RUSTCHAT_REDIS_URL=redis://localhost:6379 RUSTCHAT_S3_ENDPOINT=http://localhost:9000
Integration tests require all infrastructure services running:
# 1. Start test infrastructure
docker compose -f docker-compose.integration.yml up -d
# 2. Set test environment variables
export RUSTCHAT_TEST_DATABASE_URL=postgres://rustchat:rustchat@127.0.0.1:55432/rustchat
export RUSTCHAT_TEST_REDIS_URL=redis://127.0.0.1:56379/
export RUSTCHAT_TEST_S3_ENDPOINT=http://127.0.0.1:59000
export RUSTCHAT_TEST_S3_ACCESS_KEY=testaccesskey
export RUSTCHAT_TEST_S3_SECRET_KEY=testsecretkey
# 3. Run all integration tests
cd backend && cargo test --no-fail-fast -- --nocapture
# 4. Run a single test file
cargo test --test channels_testRun these before opening a pull request:
# Backend
cd backend && cargo fmt --check && cargo clippy --all-targets --all-features -- -D warnings && cargo test --lib
# Frontend
cd frontend && npm run build && npm run test:unit
# Smoke test (validates Docker configs and runs compat checks)
./scripts/smoke-test.sh# Check if PostgreSQL is running
docker compose ps postgres
# Check if it's ready
docker compose exec postgres pg_isready -U rustchat
# Restart if needed
docker compose restart postgres# Ensure DATABASE_URL is set and the database is running
export DATABASE_URL=postgres://rustchat:rustchat@localhost:5432/rustchat
# For offline builds (CI), prepare query data
cd backend && cargo sqlx prepare# Find the process
lsof -i :3000
# Or use a different port
RUSTCHAT_SERVER_PORT=3001 cargo run# Check version
node --version
# If older than 24, switch versions
nvm use 24
# or
fnm use 24# Ensure patches are applied
cd frontend && npm run apply:dependency-patches
# Clear node_modules and reinstall
rm -rf node_modules package-lock.json
npm ci --ignore-scripts
npm run apply:dependency-patches
npm run buildEnsure the backend is running and CORS allows the dev server origin:
# In .env
RUSTCHAT_CORS_ALLOWED_ORIGINS=http://localhost:5173,http://localhost:8080Push proxy is optional for local development. If you don't need mobile push notifications, you can skip it. If you do need it:
cd push-proxy
RUSTCHAT_PUSH_PORT=3001 cargo runRecommended extensions:
- Rust:
rust-lang.rust-analyzer— enablecargo checkon save - Vue: Vue.volar (official Vue 3 + TypeScript support)
- Tailwind: bradlc.vscode-tailwindcss
- Docker: ms-azuretools.vscode-docker
Settings for settings.json:
{
"rust-analyzer.cargo.features": "all",
"rust-analyzer.check.command": "clippy",
"editor.formatOnSave": true
}- Rust:
rust-analyzervianvim-lspconfig - Vue:
volarlanguage server - See docs/development/local-setup.md for additional editor-specific tips.
- Contributor Workflow — Fork, branch, PR process
- Local Setup Tips — Additional IDE and environment tips
- Testing Model — Full test strategy and CI gates
- Code Style — Rust and TypeScript conventions
- Architecture Overview — System design