Installation
This guide walks you through setting up PolitikTok for local development.
Prerequisites
Before starting, make sure the following tools are installed on your system:
| Tool | Minimum Version | Purpose |
|---|---|---|
| Rust | 1.89+ | Compiler toolchain |
| dx (Dioxus CLI) | 0.7.3 | Build, serve, and hot-reload the application |
| Docker & Docker Compose | 20.10+ / 2.20+ | Run PostgreSQL, Qdrant, Keycloak, Ollama, SearXNG |
| wasm32 target | -- | WebAssembly compilation target for the frontend |
Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup default stableAdd the WebAssembly Target
rustup target add wasm32-unknown-unknownInstall the Dioxus CLI
cargo install dioxus-cli@0.7.3Verify the installation:
dx --version
# dioxus 0.7.3Clone the Repository
git clone https://github.com/your-org/politiktok.git
cd politiktokStart Infrastructure Services
PolitikTok depends on several services that run in Docker containers. Start them all with:
docker compose up -dThis launches PostgreSQL, Qdrant, Keycloak, Ollama, and SearXNG. See the Docker Setup page for details on each service and its ports.
Wait for all services to report healthy status:
docker compose psPull an Ollama Model
The application needs at least one LLM and one embedding model loaded in Ollama:
# Text generation model
docker exec politiktok-ollama ollama pull llama3.1:8b
# Embedding model
docker exec politiktok-ollama ollama pull nomic-embed-textConfigure Environment Variables
Copy the example environment file and adjust as needed:
cp .env.example .envThe defaults in .env.example are configured for the Docker Compose setup and should work out of the box for local development. See Configuration for details on every variable.
Run Database Migrations
Migrations run automatically on server startup via sqlx::migrate!("./migrations"). No manual step is required -- the server applies pending migrations each time it starts.
Start the Development Server
dx serveThis compiles both the server (--features server) and client (--features web) targets, starts the Axum server, and enables hot-reloading for RSX changes. The application will be available at:
http://localhost:8080The dx CLI proxies requests and handles WASM asset serving automatically.
Build for Production
dx build --releaseThis produces optimized server and client binaries in the dist/ directory. The server binary embeds the WASM client assets and can be deployed as a single executable.
Verify the Setup
- Open
http://localhost:8080in your browser. - You should see the PolitikTok landing page.
- Click "Get Started" to be redirected to Keycloak for login.
- Log in with the default Keycloak admin credentials (
admin/admin), or create a new user in thepolitiktokrealm. - After authentication, you will land on the dashboard.
Troubleshooting
| Symptom | Likely Cause | Fix |
|---|---|---|
wasm32-unknown-unknown compilation errors | Missing target | rustup target add wasm32-unknown-unknown |
| Database connection refused | PostgreSQL not running | docker compose up -d postgres |
| LLM requests timeout | No model loaded in Ollama | docker exec politiktok-ollama ollama pull llama3.1:8b |
| Keycloak redirect fails | Wrong APP_URL in .env | Ensure APP_URL matches the address dx serve is using |
| CORS errors in browser | Middleware ordering | Check that tower-http CORS layer is in the Axum router |