Skip to content

Building from Source ​

If you want to develop Svarla or run it without pulling pre-built images, you can build everything from source.

Prerequisites ​

Building containers and APKs (Makefile) ​

  • Docker
  • Make

Everything else (Node.js, Go, Android SDK) runs inside Docker — no local runtimes needed.

Local development (without Docker) ​

  • Node.js 20+
  • PostgreSQL 16+
  • Go 1.22+ (only for working on the MediaBridge)

Using the Makefile ​

The project provides a Makefile as the primary build interface. All container and APK builds use Docker for reproducibility — no local Android SDK or Go toolchain required.

bash
git clone https://github.com/packetmoose/svarla.git
cd svarla
make help    # show all available targets

Key targets ​

TargetDescription
make apkBuild unsigned Android APK in Docker
make sign-apkSign the APK with a local keystore
make serverBuild server container image
make mediabridgeBuild MediaBridge container image
make allBuild everything (APK + sign + containers)
make release-apkBuild and sign APK locally (no tag, no publish)
make cleanRemove build artifacts

Environment overrides ​

VariableDefaultDescription
BUILD_TYPEreleaseAPK build type (debug or release)
IMAGE_TAGdevDocker image tag
KEYSTORE_PATH~/.android/release.keystorePath to Android signing keystore
REGISTRY(empty)Container registry prefix
PUSHfalsePush images to registry after build
PLATFORM(native)Docker platform(s) for cross-compilation

Examples ​

bash
# Build a debug APK
make apk BUILD_TYPE=debug

# Build server container with a version tag
make server IMAGE_TAG=v1.2.0

# Build everything with your own signing key
KEYSTORE_PATH=~/my.keystore make all

Server development (without Docker) ​

For day-to-day server development with hot-reload:

bash
npm install
cp .env.example .env
# Edit .env — set DATABASE_URL and INITIAL_PASSWORD at minimum
npm run migrate
npm run dev

npm scripts ​

CommandDescription
npm run devStart dev server with hot-reload (tsx watch)
npm run buildCompile TypeScript to dist/
npm run build:webBundle the web interface to dist/web/
npm startRun compiled production server
npm testRun tests (vitest)
npm run lintLint with ESLint
npm run migrateRun database migrations

MediaBridge development (without Docker) ​

If you need to work on the MediaBridge directly (requires Go 1.22+):

bash
cd mediabridge
go build -o mediabridge ./cmd/mediabridge/
./mediabridge

Edit mediabridge-config.yaml to set network.publicIp to your server's public IP.

Development with Docker Compose ​

The root docker-compose.yml (in the repo root, not docker/) builds everything from source with sensible defaults — no .env file needed:

bash
git clone https://github.com/packetmoose/svarla.git
cd svarla
docker compose up -d

Server is at http://localhost:3000 with password dev.

INFO

The dev compose setup is for local development only. For production deployment with TLS, a public IP, and a domain, see Installation.

Released under the AGPL-3.0 License.