Installation
Sitniš runs on your own server: the app (a Go server with the web UI built in) and a PostgreSQL 18 database. NGINX sits in front of them and handles HTTPS, which is required: the camera only scans receipts over HTTPS.
The app itself is in Serbian; this guide is also in Serbian.
With Docker
A ready-made image from Docker Hub and Compose with the database. About ten minutes and one configuration file.
By hand
Build it from source and run it as a systemd service, with your own PostgreSQL.
What you need
- A Linux server (amd64 or arm64), about 1 GB of RAM and a few GB of disk. The retail price lists and the business register take a few hundred MB in the database.
- A domain pointing at the server, here
sitnis.example.rs. - NGINX and certbot on the server.
With Docker
You need Docker Engine and the Compose plugin (docker compose).
1. Get the deployment files
The image is on Docker Hub as dusnm1/sitnis. The compose file, the database schema and the NGINX config
come from the repository, at the release you install (see the list on
GitHub):
sudo git clone --branch v0.0.3 https://github.com/dusnm/sitnis.git /opt/sitnis
cd /opt/sitnis
2. Set the secrets
sudo cp docker/prod/.env.example docker/prod/.env
sudo chmod 600 docker/prod/.env
Each secret is 32 random bytes: the passwords in hex, the keys in base64.
| Setting | What it is | Format |
|---|---|---|
POSTGRES_PASSWORD | The database password. | hex |
POWERSYNC_DB_PASSWORD | The password of a role for the mobile app's future sync (PowerSync). | hex |
APP_SIGNING_KEY | Signs sessions. Changing it signs everyone out. | base64 |
APP_TOTP_KEY | Encrypts two-factor secrets. Losing it disables everyone's two-factor sign-in, so keep a copy apart from the database backups. | base64 |
SITNIS_VERSION | The release to run, e.g. 0.0.3. |
All four secrets at once:
hex() { head -c 32 /dev/urandom | od -An -tx1 | tr -d ' \n'; }
b64() { head -c 32 /dev/urandom | base64; }
sudo sed -i -e "s|^POSTGRES_PASSWORD=.*|POSTGRES_PASSWORD=$(hex)|" \
-e "s|^POWERSYNC_DB_PASSWORD=.*|POWERSYNC_DB_PASSWORD=$(hex)|" \
-e "s|^APP_SIGNING_KEY=.*|APP_SIGNING_KEY=$(b64)|" \
-e "s|^APP_TOTP_KEY=.*|APP_TOTP_KEY=$(b64)|" docker/prod/.env
The database password must be hex: it goes into the database URL (postgres://sitnis:PASSWORD@db…), and a
/ from base64 breaks it.
3. Start
sudo docker compose -f docker/prod/docker-compose.yml up -d
sudo docker compose -f docker/prod/docker-compose.yml ps
On the first start the database creates its schema, and the app fetches the NBS exchange rates and, in the background,
the price lists and the business register. The app listens on 127.0.0.1:8080.
4. NGINX and HTTPS
sudo sed 's/sitnis.example.com/sitnis.example.rs/' docker/prod/nginx.conf \
| sudo tee /etc/nginx/sites-available/sitnis.conf >/dev/null
sudo ln -s /etc/nginx/sites-available/sitnis.conf /etc/nginx/sites-enabled/sitnis.conf
sudo nginx -t && sudo systemctl reload nginx
sudo certbot --nginx -d sitnis.example.rs
If your NGINX uses conf.d/, put the config there instead. It passes the visitor's address to the app and
allows requests up to 16 MB, for profile photos.
5. The first account
Registration is invite-only. Create the first invite from the container, then open the link it prints:
sudo docker compose -f docker/prod/docker-compose.yml exec sitnis \
sitnis invite -url https://sitnis.example.rs
By hand
Without Docker: the program is built from source and runs as a systemd service. The examples are for Debian 13; other distributions have similar packages.
1. PostgreSQL 18
The schema uses uuidv7(), which exists from version 18. Debian 13 ships version 17, so install 18 from the
PostgreSQL repository. Then create the database and its
user:
DB_PASSWORD=$(head -c 32 /dev/urandom | od -An -tx1 | tr -d ' \n')
sudo -u postgres psql -c "CREATE ROLE sitnis LOGIN PASSWORD '$DB_PASSWORD'"
sudo -u postgres createdb -O sitnis sitnis
echo "$DB_PASSWORD" # you need it for APP_DATABASE_URL
2. Build the program
You need Go 1.26 and Node.js 22:
git clone --branch v0.0.3 https://github.com/dusnm/sitnis.git
cd sitnis
(cd ui && npm ci && npm run build)
CGO_ENABLED=0 go build -ldflags="-s -w -X main.version=v0.0.3" -o sitnis ./main.go
3. The database schema
The schema is in docker/provision/. Apply it as the sitnis user, so the tables are its own.
The second file, run as postgres, creates a role for the mobile app's future sync and needs a password:
PGPASSWORD="$DB_PASSWORD" psql -h localhost -U sitnis -d sitnis -v ON_ERROR_STOP=1 \
-f docker/provision/01-schema.sql
sudo -u postgres env POSTGRES_USER=postgres POSTGRES_DB=sitnis \
POWERSYNC_DB_PASSWORD=$(head -c 32 /dev/urandom | od -An -tx1 | tr -d ' \n') \
sh docker/provision/02-powersync.sh
You can ignore the warning that wal_level isn't logical: that's only needed once you run
PowerSync.
4. Install
sudo useradd --system --home-dir /var/lib/sitnis --shell /usr/sbin/nologin sitnis
sudo install -m 0755 sitnis /usr/local/bin/sitnis
sudo mkdir -p /usr/share/sitnis && sudo cp -r ui/build /usr/share/sitnis/ui
sudo install -d -o sitnis -g sitnis /var/lib/sitnis /var/lib/sitnis/storage
sudo install -d -m 0750 -g sitnis /etc/sitnis
The settings go in /etc/sitnis/sitnis.env (owner root:sitnis, mode 0640).
Generate the keys with head -c 32 /dev/urandom | base64:
TZ=Europe/Belgrade
APP_NETWORK=tcp
APP_ADDR=127.0.0.1:8080
APP_DATABASE_URL=postgres://sitnis:PASSWORD@localhost:5432/sitnis?sslmode=disable
APP_SIGNING_KEY=
APP_TOTP_KEY=
APP_UI_DIR=/usr/share/sitnis/ui
APP_STORAGE_DIR=/var/lib/sitnis/storage
APP_TRUSTED_PROXIES=127.0.0.1
APP_REQUEST_ID_HEADER=X-Request-ID
APP_TRUSTED_PROXIES=127.0.0.1 matters: with it, the app trusts the visitor address NGINX sends, so
sign-in rate limiting works per visitor rather than for everyone at once.
5. The systemd service
/etc/systemd/system/sitnis.service:
[Unit]
Description=Sitniš
After=network-online.target postgresql.service
Wants=network-online.target
[Service]
User=sitnis
Group=sitnis
EnvironmentFile=/etc/sitnis/sitnis.env
WorkingDirectory=/var/lib/sitnis
ExecStart=/usr/local/bin/sitnis serve
Restart=on-failure
NoNewPrivileges=yes
ProtectSystem=strict
ProtectHome=yes
PrivateTmp=yes
ReadWritePaths=/var/lib/sitnis
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now sitnis
journalctl -u sitnis -f
6. NGINX, HTTPS and the first account
The NGINX config is the same as with Docker (docker/prod/nginx.conf, step 4 above): it forwards to
127.0.0.1:8080. Create the first invite like this:
sudo -u sitnis sh -c 'set -a; . /etc/sitnis/sitnis.env; sitnis invite -url https://sitnis.example.rs'
After installing
On your phone
Open your domain on your phone and install Sitniš as an app: on Android from Chrome's menu or in Podešavanja → Aplikacija, on iPhone with Share → Add to Home Screen.
New releases
With Docker: get the new release's files (git fetch --tags && git checkout vX.Y.Z), set
SITNIS_VERSION in docker/prod/.env, then run docker compose … pull and
up -d. By hand: build the new release, replace the program and /usr/share/sitnis/ui, then
systemctl restart sitnis. A release that changes the database schema says so in its notes, with
instructions. Back up before every upgrade.
Backups
Keep the database (pg_dump -Fc) and the photos (/var/lib/sitnis/storage, or the Docker
volume sitnis_storage), and APP_TOTP_KEY apart from both. The exact commands for Docker are
in the guide in the repository.