Skip to content

Latest commit

 

History

History
217 lines (165 loc) · 4.28 KB

File metadata and controls

217 lines (165 loc) · 4.28 KB

Development Guide

Quick Start

Prerequisites

Make sure you have the following installed:

  1. Rust (1.82 or later, stable toolchain recommended)

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  2. GStreamer development libraries

    # Ubuntu/Debian
    sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libcairo2-dev
    
    # Fedora
    sudo dnf install gstreamer1-devel gstreamer1-plugins-base-devel
    
    # macOS
    brew install gstreamer gst-plugins-base libnice-gstreamer
  3. WebAssembly target (for frontend)

    rustup target add wasm32-unknown-unknown
  4. Trunk (for building frontend)

    cargo install trunk

Project Structure

strom/
├── types/          # Shared types library (strom-types)
├── backend/        # Backend server (strom)
└── frontend/       # Frontend WASM app (strom-frontend)

Building

Build everything

cargo build

Build specific crates

# All crates are built from the workspace root (never use -p flag)
cargo build
# Frontend builds with trunk (see below)

Check for errors (faster than build)

cargo check --workspace

Running

Backend Server

Start the backend server:

cargo run

The server will start on http://localhost:8080 by default.

Configuration options:

# Via CLI arguments
cargo run -- --port 8080 --data-dir ./my-data

# Via environment variables
STROM_PORT=8080 STROM_DATA_DIR=./my-data cargo run

Available options:

  • --port / STROM_PORT - Port to listen on (default: 8080)
  • --data-dir / STROM_DATA_DIR - Data directory for storage files
  • --flows-path / STROM_FLOWS_PATH - Override flows file path
  • --blocks-path / STROM_BLOCKS_PATH - Override blocks file path
  • --database-url / STROM_DATABASE_URL - Database URL (e.g., postgresql://user:pass@localhost/strom)
  • --headless - Run without GUI (API only)

Default storage locations:

  • Linux: ~/.local/share/strom/
  • Windows: %APPDATA%\strom\
  • macOS: ~/Library/Application Support/strom/

Frontend (Development)

The frontend is designed to run as WebAssembly in a browser.

Option 1: Using trunk (recommended for development)

cd frontend
trunk serve

This will:

  • Build the frontend for WASM
  • Start a dev server on http://localhost:8095
  • Auto-reload on file changes

Option 2: Build for production

cd frontend
trunk build --release

The built files will be in frontend/dist/. You can serve these with any static file server, or have the backend serve them.

Full Stack Development

Run both backend and frontend simultaneously:

Terminal 1: Backend

cargo run

Terminal 2: Frontend

cd frontend
trunk serve

Then open http://localhost:8095 in your browser. The frontend will connect to the backend API at http://localhost:8080.

Testing the API

Health check

curl http://localhost:8080/health
# Expected: OK

List flows

curl http://localhost:8080/api/flows
# Expected: {"flows":[]}

Create a flow

curl -X POST http://localhost:8080/api/flows \
  -H "Content-Type: application/json" \
  -d '{"name":"Test Flow","auto_start":false}'

Get a specific flow

curl http://localhost:8080/api/flows/<flow-id>

Common Tasks

Format code

cargo fmt --all

Run linter

cargo clippy --workspace

Clean build artifacts

cargo clean

Update dependencies

cargo update

Project Status

See README.md for a full list of features and capabilities.

Troubleshooting

GStreamer not found

Make sure GStreamer development libraries are installed and pkg-config can find them:

pkg-config --modversion gstreamer-1.0

Frontend won't compile for WASM

Make sure the WASM target is installed:

rustup target add wasm32-unknown-unknown

Port already in use

Change the backend port:

cargo run -- --port 8081
# or
STROM_PORT=8081 cargo run

Then update the frontend API URL if needed.

Storage files in unexpected location

By default, storage files go to platform-specific directories. To use current directory:

cargo run -- --data-dir ./data