Getting started¶
This page takes you from a blank Ubuntu server to a dashboard showing your own data. Budget about 30 minutes, most of which is waiting for the first import to finish.
Before you begin¶
You need:
- A server running Ubuntu 22.04 with root access. 2 GB of RAM is enough; the database stays small because it stores aggregates, not raw event logs.
- API keys for the marketplaces you sell on. Getting them is a separate procedure with its own permissions checklist, covered in Connect your marketplace accounts. Do that first and come back with the keys in hand.
- Your cost prices. The installer does not need them, but every profit figure is wrong until you enter them, so have the list ready.
A Telegram bot token is optional. Without one, everything works except the morning stock alert.
Install¶
Clone the repository and copy the environment template:
Open .env and fill in the database URL and your marketplace keys. Then run the
installer as root:
The script installs Python, PostgreSQL and Nginx, creates the database and applies
schema.sql, registers the API as a systemd service, and adds two cron jobs: a data
sync at 06:00 and the stock alert at 09:00.
The installer assumes /opt/analytics
Several paths are hard-coded, including the interpreter path the API uses when it triggers a sync on demand. If you install somewhere else, the dashboard's manual sync button will fail even though the scheduled cron sync keeps working. Installing to a custom location means editing those paths yourself.
Import your first batch of data¶
The scheduled sync only fetches recent days, so the first import is manual. Thirty days is a reasonable starting window:
Both marketplaces run by default. To import one at a time, which is useful when you are still verifying that a key works:
The import prints one line per marketplace and exits non-zero if either failed, so it is safe to chain in a shell script.
Requesting a long history in one go is the most common way to hit a marketplace rate limit. If you want more than about 90 days, import in chunks and leave a gap between them.
Enter your cost prices¶
Until you do this, every profit and margin figure treats cost as zero, which means the dashboard reports your revenue as if it were pure profit.
Open the Products section of the dashboard and set the cost price for each SKU, or do it over the API:
The PATCH /api/products/{source}/{sku}/cost
reference covers the parameters and the validation rules.
Open the dashboard¶
Browse to the server's address. You should see populated KPI tiles across the top and data in every section.
If the tiles show zeros, the import ran but wrote nothing, which almost always means a key lacks a permission. Troubleshooting works through the diagnosis.
Restrict access¶
The API has no authentication and its CORS policy accepts requests from any origin. That is a deliberate simplification for a single-tenant tool on a private network, and it means the installation must not be reachable from the public internet.
Put it behind one of the following before you point a domain at it:
- HTTP basic auth in the Nginx configuration, which is enough for a single user.
- An IP allowlist, if you always connect from the same place.
- A VPN or an SSH tunnel, which is the option that leaks nothing.
The shipped nginx/site.conf proxies to the API without adding any of these. Adding
one is your responsibility.