Installation
Install Shelftara on your own server
Shelftara is a single Go binary with an embedded asset bundle and an embedded template set. Nothing else is required to run it: there is no front-end build, no package manager and no external service other than MySQL. The installation creates the schema itself on the first start.
Requirements
| Component | Minimum | Notes |
|---|---|---|
| Go toolchain | 1.23 or newer | Only needed on the machine that builds the binary. The go.mod of this release declares go 1.26.0, so build with a Go 1.26 toolchain to stay on the version the release was compiled with. |
| MySQL | 8.0 | Or MariaDB 10.6 or newer. The schema uses utf8mb4 and the connection is opened with parseTime=True and loc=UTC. |
| Web server | nginx, Apache or Caddy | Recommended in front of the binary for TLS, compression of the static assets and the X-Forwarded-* headers. The binary also serves the site on its own. |
| Disk | 1 GB | For the database, the uploads and the logs. The uploads grow with the pictures of the catalogue. |
| Memory | 512 MB | The connection pool opens at most 60 connections and keeps 10 idle. |
| Service account | an unprivileged user | See file permissions. The server never needs root. |
Path A — the one-click installer
The repository ships install.sh, an installer for Debian and Ubuntu. It prepares a whole server in one pass: it checks the prerequisites, creates the system account and the directories, creates the database and its user, compiles the binary, writes the configuration, registers the systemd unit, installs the nginx site and checks that the installation answers.
sudo bash install.sh --domain shop.example.com --email you@example.com \
--admin-email admin@example.com --admin-password 'a-strong-password'
The script may be run several times on the same machine: every step looks at what is already there before it changes it. The password of the database is generated when it is not given, and the credentials of the administrator are written in /etc/shelftara/admin-credentials.txt.
| Option | What it does |
|---|---|
--dir <path> | The directory of the installation. /opt/shelftara by default. |
--db-name <name> | The name of the database. shelftara by default. |
--db-user <name> | The user of the database. shelftara by default. |
--db-pass <password> | The password of the database user. A random one is generated when the option is missing. |
--domain <name> | The domain of the installation, for example shop.example.com. |
--email <address> | The address of the operator. It becomes the support address of the installation. |
--admin-email <address> | The address of the platform administrator. |
--admin-password <password> | The password of the platform administrator. |
--port <port> | The port the server listens on. 8080 by default. |
--binary <path> | A binary that is already built, used with --no-build. |
--no-build | Does not compile the sources; it installs the binary given with --binary. |
--skip-database | Does not create the database and does not touch its user. |
-h, --help | Prints the same list on the screen. |
The installer writes the configuration in /etc/shelftara/shelftara.env, registers /etc/systemd/system/shelftara.service and installs /etc/nginx/sites-available/shelftara.conf. The deployment guide of the repository describes that layout in more detail.
Working on a laptop
For a local workstation, the repository also ships scripts/dev-up.sh. It starts a local MariaDB when none is running, creates the database and the user, builds the binary, creates the storage folders and starts the server in the background. It is the fastest way to see the product without touching a production machine.
cd /path/to/shelftara
./scripts/dev-up.sh
# shelftara health: 200
The script starts the database as the mysql system user and leaves the server in a detached session. Use it to look at the product. For a real installation, follow path A or path B.
Path B — manual build and service
This is the installation we recommend on a real server. It takes five minutes and it leaves you with a binary, a service and a reverse proxy.
1. Create the account and the directory
sudo useradd --system --home /opt/shelftara --shell /usr/sbin/nologin shelftara
sudo mkdir -p /opt/shelftara/{bin,storage/uploads,logs}
sudo chown -R shelftara:shelftara /opt/shelftara
2. Build the binary
Build it on a machine with Go and copy the result, or build it directly on the server when a toolchain is available. The binary embeds the templates and the static assets, so it must not be separated from its own internal/web/views and internal/web/static folders — it does not need them at runtime.
go build -trimpath -ldflags "-s -w" -o bin/shelftara ./cmd/shelftara
sudo install -m 0755 bin/shelftara /opt/shelftara/bin/shelftara
3. Create the database
CREATE DATABASE shelftara CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'shelftara'@'127.0.0.1' IDENTIFIED BY 'a-strong-password';
GRANT ALL PRIVILEGES ON shelftara.* TO 'shelftara'@'127.0.0.1';
FLUSH PRIVILEGES;
4. Write the configuration
The server reads a .env file from the working directory, from the directory of the executable, from its parent directory, or from the file named by ENV_FILE. Real environment variables always win over the file, which is what a container platform or a systemd unit relies on.
sudo tee /opt/shelftara/.env > /dev/null <<'EOF'
APP_NAME=Shelftara
APP_ENV=production
APP_DEBUG=false
APP_URL=https://inventory.example.com
BASE_URL=https://inventory.example.com
DOMAIN=inventory.example.com
PORT=8080
APP_SECRET=6f2a9c4e1b8d3075a6e2f4c9b1d83075
DB_HOST=127.0.0.1
DB_PORT=3306
DB_USER=shelftara
DB_PASSWORD=a-strong-password
DB_NAME=shelftara
SESSION_COOKIE=shelftara_session
CSRF_COOKIE=shelftara_csrf
COOKIE_SECURE=true
SESSION_TTL_HOURS=720
STORAGE_DIR=/opt/shelftara/storage
UPLOAD_DIR=/opt/shelftara/storage/uploads
SEED_DEMO=false
DEMO_MODE=false
CURRENCY=USD
LOCALE=en
TIMEZONE=UTC
DATE_FORMAT=2006-01-02
STORE_ENABLED=true
FRAME_OPTIONS=SAMEORIGIN
FRAME_ANCESTORS=
MAIL_DRIVER=log
MAIL_FROM=no-reply@inventory.example.com
AI_PROVIDER=local
AI_ASSISTANT=true
SUPPORT_EMAIL=support@example.com
EOF
5. Run it once to create the schema
cd /opt/shelftara
sudo -u shelftara ./bin/shelftara
# Shelftara is listening on :8080
The first start creates the 116 tables, writes the four default plans and the fifteen module definitions, creates the platform administrator and, when SEED_DEMO=true, fills the demo workspace. Stop the process with Ctrl+C and continue with the service below.
Path C — containers
The repository of this release contains no Dockerfile and no compose file, so there is nothing to pull. The binary is a plain Linux executable with a static template bundle, so a container image is a two-line file; write it next to your own infrastructure:
FROM golang:1.26 AS build
WORKDIR /src
COPY . .
RUN CGO_ENABLED=0 go build -trimpath -ldflags "-s -w" -o /out/shelftara ./cmd/shelftara
FROM gcr.io/distroless/static-debian12
COPY --from=build /out/shelftara /shelftara
WORKDIR /app
ENV PORT=8080 STORAGE_DIR=/app/storage UPLOAD_DIR=/app/storage/uploads
EXPOSE 8080
ENTRYPOINT ["/shelftara"]
Mount a volume on /app/storage, pass the configuration as environment variables and put your own reverse proxy in front of the container. The server binds to the port given by PORT and does not need any other port.
The configuration file
The table below is the complete list of the variables the server reads. It is built from internal/config/config.go, which is the single place where the configuration is resolved. The configuration page explains each line in more detail, and the .env.example file of the repository is a commented template of the same list.
| Variable | Default | What it does |
|---|---|---|
APP_NAME | Shelftara | The name of the product shown in the interface. |
APP_ENV | production | The mode of the installation. development and testing switch the cookies to the insecure mode unless COOKIE_SECURE is set explicitly. |
APP_DEBUG | false | When true, the server logs every request and prints the SQL statements. |
APP_URL | http://localhost:PORT | The address of the installation. |
BASE_URL | the value of APP_URL | The public address used for the canonical links of the marketing pages. |
DOMAIN | localhost | The main domain. A host such as acme.example.com resolves the workspace acme when DOMAIN is example.com. |
PORT | 8080 | The TCP port the server listens on. |
APP_SECRET | shelftara-development-secret-change-me | The secret of the installation. Replace it with a long random string. |
DB_HOST | 127.0.0.1 | The address of the MySQL server. |
DB_PORT | 3306 | The port of the MySQL server. |
DB_USER | root | The user that opens the connection. |
DB_PASSWORD | empty | The password of the database user. |
DB_NAME | shelftara | The name of the database. |
SESSION_COOKIE | shelftara_session | The name of the session cookie. |
CSRF_COOKIE | shelftara_csrf | The name of the CSRF cookie. |
COOKIE_SECURE | true | Sends the cookies only over HTTPS. Forced to false in the development and testing modes. |
SESSION_TTL_HOURS | 720 | The lifetime of a session, in hours. Thirty days by default. |
STORAGE_DIR | storage | The storage root of the installation. |
UPLOAD_DIR | storage/uploads | The folder that holds the uploaded files. It is created when it is missing. |
SEED_DEMO | false | Fills the demo workspace on the first start. |
DEMO_MODE | false | Reserved for a later release; it is read but nothing in 1.0.0 changes its behaviour. |
CURRENCY | USD | The currency used by the panel and by the assistant. |
LOCALE | en | The locale given to a workspace when it is created. |
TIMEZONE | UTC | The time zone given to a workspace when it is created. All timestamps are stored in UTC. |
DATE_FORMAT | 2006-01-02 | The Go layout of the dates. Read but not applied by the templates of 1.0.0. |
STORE_ENABLED | true | Read but not applied by 1.0.0; the storefront of a workspace is opened per workspace in its store settings. |
FRAME_OPTIONS | SAMEORIGIN | The value of the X-Frame-Options header. The value none sends no header. |
FRAME_ANCESTORS | empty | The frame-ancestors directive of the content security policy. Empty sends no policy. |
MAIL_DRIVER | log | The transport of the outgoing mail. No transport is wired in 1.0.0. |
SMTP_HOST | empty | The SMTP server. |
SMTP_PORT | 587 | The SMTP port. |
SMTP_USER | empty | The SMTP user. |
SMTP_PASSWORD | empty | The SMTP password. |
MAIL_FROM | no-reply@shelftara.test | The sender address of the outgoing mail. |
AI_PROVIDER | local | The provider of the assistant. The assistant of 1.0.0 answers from your own database and never calls an external service. |
ANTHROPIC_API_KEY | empty | The key of the external provider. Not used by 1.0.0. |
AI_MODEL | claude-sonnet-5 | The model of the external provider. Not used by 1.0.0. |
AI_ASSISTANT | true | The flag of the assistant. The assistant answers from your own data in 1.0.0. |
ANALYTICS_ID | empty | The identifier of an analytics property. Read but not applied by 1.0.0. |
SUPPORT_EMAIL | support@shelftara.test | The address shown to the visitors of the marketing pages. |
ENV_FILE | not set | The path of an alternative .env file, tried before the usual locations. |
ADMIN_EMAIL | admin@shelftara.test | The address of the platform administrator created on the first start. It is read from the process environment, not from the .env file. |
ADMIN_PASSWORD | ShelftaraAdmin1 | The password of the platform administrator. Also read from the process environment. |
ADMIN_EMAIL and ADMIN_PASSWORD are read with a direct call to the process environment, so a line in the .env file has no effect on them. Export them in the shell, or declare them in the systemd unit, before the first start.
export ADMIN_EMAIL=operator@example.com
export ADMIN_PASSWORD=a-strong-password
./bin/shelftara
Running it as a service
Put the unit in /etc/systemd/system/shelftara.service. It reads the configuration from the .env file of the installation, restarts the server when it stops and lets the service write only inside the storage and the log folder.
[Unit]
Description=Shelftara server
Documentation=file:/opt/shelftara/README.md
After=network-online.target mysql.service
Wants=network-online.target
[Service]
Type=simple
User=shelftara
Group=shelftara
WorkingDirectory=/opt/shelftara
EnvironmentFile=/opt/shelftara/.env
ExecStart=/opt/shelftara/bin/shelftara
Restart=on-failure
RestartSec=5
KillSignal=SIGTERM
TimeoutStopSec=20
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/opt/shelftara/storage /opt/shelftara/logs
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now shelftara
sudo systemctl status shelftara
sudo journalctl -u shelftara -f
The server handles SIGTERM and SIGINT: it stops accepting requests and closes the connections within fifteen seconds, so systemctl stop and a rolling upgrade are clean.
Add Environment=ADMIN_EMAIL=operator@example.com and Environment=ADMIN_PASSWORD=... to the [Service] section before you enable the unit, or create the administrator from the login page afterwards and change the default password.
The reverse proxy
The proxy must forward the original Host header: Shelftara reads it to find the workspace of a request when the workspaces use subdomains. It must also forward the X-Forwarded-* headers, so that the address and the scheme of the visitor survive the hop.
server {
listen 80;
server_name inventory.example.com *.example.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name inventory.example.com *.example.com;
ssl_certificate /etc/letsencrypt/live/inventory.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/inventory.example.com/privkey.pem;
# the body limit of the server is 64 MB, keep the two in step
client_max_body_size 64m;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_connect_timeout 10s;
proxy_read_timeout 120s;
proxy_send_timeout 120s;
}
# the assets of the interface are embedded in the binary and never change
# without a new release
location /assets/ {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
expires 30d;
add_header Cache-Control "public";
}
}
Host drives the tenant resolution and must reach the application unchanged. The session and the audit log store the address that Fiber reports through c.IP(); the server of 1.0.0 does not rewrite it from X-Forwarded-For, so when the application and the proxy run on the same host the recorded address is the address of the proxy. Put the two on the same host, or extend the configuration of your own reverse proxy, when you need the address of the visitor in the audit log.
If you terminate TLS elsewhere, set COOKIE_SECURE=true only after the cookies really travel over HTTPS, otherwise the browser drops the session cookie.
File permissions
| Path | Owner | Mode | Why |
|---|---|---|---|
/opt/shelftara/bin/shelftara | root:root | 0755 | The binary is written by the administrator and only read by the service. |
/opt/shelftara/.env | root:shelftara | 0640 | It holds the database password. The service account must be able to read it, nobody else. |
/opt/shelftara/storage | shelftara:shelftara | 0750 | The root of the uploaded files. |
/opt/shelftara/storage/uploads | shelftara:shelftara | 0750 | The pictures of the catalogue and the other uploads. The server creates it when it is missing. |
/opt/shelftara/logs | shelftara:shelftara | 0750 | The output of the service when you redirect it to a file. |
The application only ever writes inside UPLOAD_DIR. With ProtectSystem=strict and the two ReadWritePaths lines of the unit above, the rest of the file system stays read-only for the service.
A relative UPLOAD_DIR is resolved against the working directory of the process, which is why the systemd unit sets WorkingDirectory=/opt/shelftara.
The demo seed
Set SEED_DEMO=true in the .env file and start the server once. The seed creates a workspace named demo — a coffee roastery called Northwind Supply Co. — with:
- 24 products across 5 categories and 4 brands, with barcodes, costs, prices, tax rates and stock levels;
- 2 warehouses, 4 units of measure and a supplier and a customer list;
- 45 days of invoices, purchases, payments, expenses and deposits;
- three users: an owner, a cashier and a manager;
- an online store with a coupon, an order and a review;
- records for every business module: CRM leads, a rental contract, restaurant tables and an order, bookings, assets, employees, couriers, a shipment and a bill of materials.
| Role | Address | Password |
|---|---|---|
| Owner | owner@demo.test | ShelftaraDemo123 |
| Manager | manager@demo.test | ShelftaraManager1 |
| Cashier | cashier@demo.test | ShelftaraCashier1 |
| Platform operator | admin@shelftara.test | ShelftaraAdmin1 |
The seed never runs twice: if the workspace already has products, the server leaves it alone. To remove the demo afterwards, set SEED_DEMO=false and delete the workspace from /platform/tenants.
Verifying the installation
curl -s http://127.0.0.1:8080/healthzmust answer{"status":"ok","app":"shelftara",...}.curl -I https://inventory.example.com/must return200through the proxy.- Open
/login, sign in with the platform administrator and create a workspace under/platform/tenants. - Sign in as the owner of the new workspace and check that the dashboard opens with the figures of an empty workspace.
- Open
/storeon the subdomain of the workspace and confirm that the shop answers.
The quick start page continues from the third step with the catalogue, the register and the first order.
Upgrading and backing up
Take a dump of the database before every upgrade, stop the service, replace the binary and start it again. The schema is migrated by GORM at the start: new columns and new tables are added, nothing is dropped.
mysqldump --single-transaction --routines --triggers shelftara > shelftara-$(date +%F).sql
sudo systemctl stop shelftara
sudo install -m 0755 bin/shelftara /opt/shelftara/bin/shelftara
sudo systemctl start shelftara
journalctl -u shelftara -n 50
Copy the storage/uploads folder with the dump: the pictures of the catalogue live on the disk, the rest lives in the database.