Install it, open the till, sell it
Stocklane is a point of sale and stock system that you run as your own software business. Shops sign up, set up their outlets and tills, invite their managers and cashiers, and sell, count cash, buy stock, invoice business customers and read their reports. You sell plans to those shops through your own Stripe account and run everything from the super-admin.
This guide is written for first-time installers. Every command is shown in full, and every setting says where to find it. Part 03 explains each screen a shop uses, so you can answer your customers' questions.
Get started
1Welcome
Thank you for choosing Stocklane. This guide takes you from the download to a running point of sale platform with your first shop selling.
What you get
- The shop for your customers and their teams: an overview of the day; a full-screen till for touch, keyboard and barcode scanners, with variants, weighed items, discounts, parked sales, split payments, receipts and refunds; shifts with a counted float and a counted close; a PIN switch between staff on a shared till; sales history; products with variants, units, barcodes, labels and CSV import; stock per outlet with low-stock alerts; transfers between outlets; suppliers and purchase orders; stock counts; customers with loyalty points, store credit and pay later; invoices and quotes for business customers; expenses; reports; outlets and tills; team and roles; an audit log; and the shop's plan and billing.
- The super-admin for you: revenue, shops, users, plans with limits, payments and subscriptions, platform settings (branding, Stripe, email, storage, sign-ups, legal pages, maintenance, email wording) and a setup check that tests every outside service live.
- Plans with limits on outlets, staff, products, sales a month and file storage, checked by the server, and a free trial without a card.
- An install wizard and sample plans, so the platform is ready the first time it opens, and sample data a new shop can try and then remove in one step.
- One-command self-hosting with Docker: the app (one compiled Rust program that also serves the web app), PostgreSQL, MinIO file storage and optional automatic HTTPS with Caddy.
What is in the download
| Path | What it is |
|---|---|
apps/backend/ | The server, written in Rust (Axum): the /api/v1 API, the Stripe webhooks, the background jobs and the built web app, compiled into one program called stocklane. |
apps/frontend/ | The web app: React 19, React Router 7, Vite, Tailwind CSS 4 and shadcn/ui components. Every screen your customers and you see, the till included. |
migrations/ | The PostgreSQL database schema. The server applies it by itself when it starts. |
docker/, compose.yaml | The Dockerfile, the Docker Compose stack and the Caddy HTTPS config. |
.env.example | Every setting, explained. Copy it to .env. |
docs/ | This documentation as one HTML file and as a PDF, plus the list of third-party licences. |
README.md, CHANGELOG.md, LICENSE.txt | A one-page overview, the version history and the licence notes. |
AI disclosure
AI tools used to create this item: Yes
- Source code: Yes. Written with Claude by Anthropic as an AI coding assistant, then reviewed, tested (server tests against a real PostgreSQL, web app unit tests and browser tests) and integrated by us.
- Documentation: Yes. Drafted with Claude by Anthropic and checked against the code and the running app.
- Graphics: No. No image was made with an AI image generator. The logo is a simple SVG drawn in code, products without a photo show line icons from the Lucide set, and every screenshot in this guide and the item's previews is a capture of the running app.
- Demo text: Yes. The sample shop, its products, customers, suppliers, invoices and expenses were written with Claude by Anthropic and edited by us.
AI-powered features: No. Stocklane has no AI features and calls no AI service.
Screenshots
The main screens of the shop, the till, the super-admin and the phone layout, from the sample shop Northgate Market. Every chapter in parts 03 and 04 has more.
2Requirements
To run it (recommended: Docker)
- A 64-bit Linux server (Intel/AMD or ARM) with Docker Engine 24 or newer and Docker Compose 2.20 or newer (the stack uses Compose's
includefeature). Docker on macOS or Windows works for trying it on your own computer. - For the first build (Docker compiles the Rust server from source): 2 processor cores and 4 GB of memory (or 2 GB plus swap). On such a server the first build takes about 3 to 4 minutes (the web app about 1 minute, the Rust server about 2) and uses up to about 2 GB of memory. Leave about 6 GB of free disk for Docker's build cache;
docker builder prunegives that space back once the app runs. - To run it the server needs far less: the app image is about 110 MB and the program uses little memory when idle. PostgreSQL and MinIO run beside it, so plan at least 1 GB of memory for a small install. You can also build on another computer and run the result on a smaller server; see Put it online.
- A domain name and HTTPS for a public launch. Stripe's webhooks need a public
https://address, and browsers only allow the camera barcode scanner on https pages (or onlocalhost). The bundled Caddy gets a free certificate for you. - A current version of Chrome, Edge, Firefox or Safari for you and your customers. The till runs in the browser of any computer, tablet or phone.
To build or change it without Docker
- Rust 1.90 or newer (stable) from rustup.rs. The Docker build uses Rust 1.99.
- Node.js 24 and pnpm 11 (
corepack enableinstalls the pnpm version the project asks for). - PostgreSQL 15 or newer (the Docker stack ships PostgreSQL 17).
- Optional: any S3-compatible storage (MinIO, AWS S3, Cloudflare R2, Backblaze B2…). Without it, files are kept in a local folder.
Hardware at the shop (optional)
- Barcode scanner: any USB or Bluetooth scanner that types the code and presses Enter (most do, often called "keyboard mode"). The camera of a phone or tablet also scans.
- Receipt printer: an 80 mm or 58 mm printer that the computer's system can print to. Receipts print from the browser's print window. A cash drawer wired to the printer can open when a receipt prints, if the printer's driver is set to do so.
- Card terminal: the shop's own terminal from its bank or payment provider. The cashier charges the card there and marks it approved on the till: Stocklane records card payments but does not connect to the terminal.
- Scale: the cashier types the weight shown on the shop's scale. Stocklane does not read a scale directly.
Accounts you need
| Account | What it is for | Needed |
|---|---|---|
| Stripe (yours) | Selling plans to the shops. | To charge shops |
| An SMTP email provider | Password resets, team invites, emailed receipts, invoices, purchase orders and notices. Without it, each email is written to the app's log with its link. | For a public launch |
| S3-compatible storage | Product photos, expense receipts and logos. The bundled MinIO does this on the same server. | Optional |
| Stripe (each shop's own) | A shop that wants its business customers to pay invoices by card connects its own Stripe account (chapter 9). | Optional, per shop |
3Extra costs you pay
Stocklane has no monthly fee of its own, and no paid service is required to run it: the Docker stack holds everything it needs. What you pay each month depends on the outside services you turn on. Each of them is run by another company with its own pricing, and you, the buyer, are responsible for every one of these costs. The prices below are the providers' published list prices in November 2026; they change, so check each provider's own pricing page before you set the prices of your plans.
| Service | Price | What that means for you |
|---|---|---|
| Stocklane itself | Free | No licence server, no usage fee, nothing calls home. |
| Stripe for your plans (pricing) | 2.9% + 30¢ | Per successful US card payment, plus 0.7% of subscription volume for Stripe Billing. On a $59 plan that is about $2.42 a month. Other countries and cards have their own rates. Without Stripe you can still run free plans. |
| Stripe for a shop's invoices | Paid by the shop | A shop that connects its own Stripe account pays Stripe's fees on its own invoice payments, in its own Stripe account. You pay nothing for them. |
| Email, for example Amazon SES (pricing) | $0.10 per 1,000 | Per email sent. Emailed receipts add up for busy shops. Other SMTP providers sell monthly plans with a free tier. |
| File storage, for example Cloudflare R2 (pricing) | $0 to $0.015 per GB | The bundled MinIO or the server's own disk costs nothing extra. R2 charges $0.015 per GB a month after the first 10 GB, with no fee for downloads. Each plan caps a shop's files. |
| Server (VPS) | about $10 to $40 a month | One server with 2 cores and 4 GB of memory runs the whole Docker stack for many shops. |
| Domain name | about $10 to $20 a year | The address of your platform, for example pos.yourbrand.com. |
| WhatsApp receipt links | Free | The till opens WhatsApp on the device with the receipt's link for the customer to read. No WhatsApp Business account and no message fees are involved. |
Card terminal fees, receipt printers, barcode scanners and the shops' own Stripe fees are paid by each shop to its own providers. Stocklane never collects or passes on those fees.
4Quick start with Docker
This runs Stocklane on your own computer or on a server. The first build compiles the server from source, so it takes longer than later starts.
- Unzip the download and open a terminal in the
stocklane/folder (the one withcompose.yamlin it). - Create your settings file:
cp .env.example .env - Open
.envin any text editor and fill in these values:
Change both passwords: the example values are public. KeepAPP_URL=http://localhost:8080 # your public https:// address on a server APP_SECRET=paste-a-random-string-here # make one with: openssl rand -hex 32 POSTGRES_PASSWORD=pick-a-long-password # letters and digits only S3_SECRET_ACCESS_KEY=pick-another-password # at least 8 charactersAPP_SECRETsafe and never change it after the install, because it encrypts the Stripe keys and other secrets you and the shops save. LeaveDATABASE_URLempty: Docker builds the database address from the values above, and that key is only for running the server without Docker. - Build and start everything:
The first build takes a few minutes, mostly for compiling the Rust server. Later builds reuse Docker's cache and are much quicker. Docker then starts PostgreSQL and MinIO (file storage), creates the storage bucket and starts the app, which applies the database migrations by itself.docker compose up -d --build - Find the install token in the app's log (if the app has restarted, use the last one):
The line readsdocker compose logs app | grep -i "install token"Install token: sl-install-… (open /install and paste it). - Open http://localhost:8080. The install wizard opens: paste the token, check the server, create your super-admin account and name your product.
See what the app is doing with docker compose logs -f app. Stop it with docker compose down; your data stays in Docker volumes. Use another port by setting APP_PORT=8090 in .env and running docker compose up -d. The app port is open on this computer only (APP_BIND=127.0.0.1); on a server, visitors come in through HTTPS as the next chapter shows.
Docker keeps a few GB of build cache so that later builds are fast. If disk is tight, run docker builder prune once the app is running: it frees that space without touching your data, and the next build simply starts from scratch again.
If the build stops with "signal: 9" or "killed", the server ran out of memory while compiling. Add swap (for example 4 GB) and run the same command again, or build on a bigger computer and copy the result, as the next chapter explains.
5Put it online
For a public launch, Stocklane must be reachable at a public https:// address: Stripe sends its webhooks there, the cookies are marked secure, and the till's camera scanner needs https.
1. Pick a server
| Size | Good for |
|---|---|
| 2 cores, 4 GB memory, 40 GB disk | Building on the server and running a growing platform (dozens of shops, each with several tills). |
| 1 to 2 cores, 1 to 2 GB memory | Running a build made on another computer (see "Build on another computer" below), or building with swap added. |
| 4+ cores, 8+ GB memory | Many busy shops. The till sends one request per sale, so even large platforms need little. |
Any provider that sells Linux servers with Docker works. Disk use grows mainly with product photos and expense receipts, so move files to outside storage once it grows (see File storage).
2. DNS
At your domain registrar, add an A record for the address you want (for example pos for pos.yourbrand.com) pointing at your server's IP address. Wait until ping pos.yourbrand.com shows that IP.
3. Settings
In .env:
APP_URL=https://pos.yourbrand.com
APP_DOMAIN=pos.yourbrand.com
TRUSTED_PROXY_HOPS=1
4. Start with HTTPS
When nothing else on the server uses ports 80 and 443, the bundled Caddy does it all. Open both ports in your server's firewall, then:
docker compose --profile https up -d --build
The https profile adds Caddy, a web server that gets and renews a free certificate for APP_DOMAIN by itself. Open https://pos.yourbrand.com; the first visit takes a few seconds while the certificate is issued. Caddy passes the live update stream through unbuffered, so the overview, the bell and the tills update at once.
Caddy needs ports 80 and 443 for itself. If Traefik, Nginx Proxy Manager, an Nginx or Apache already owns them, leave out --profile https, start with docker compose up -d --build and let your proxy pass visitors on to Stocklane, as the next part shows.
Behind a proxy you already run
Where the proxy runs decides how it reaches the app:
- Installed on the server itself (Nginx or Apache from the system's packages): point it at
http://127.0.0.1:8080(APP_PORT), the port the app opens on this server only. - In a Docker container (Traefik, Nginx Proxy Manager, an Nginx container): it cannot use
127.0.0.1:8080, because inside a container that address is the container itself. Put the app on the proxy's Docker network instead, with acompose.override.yamlfile next tocompose.yaml. Docker Compose reads it by itself on everydocker composecommand.docker network lsshows the proxy's network name; the examples call itproxy.
Traefik: the labels tell Traefik the address, the entrypoint and the certificate resolver. Use the entrypoint and resolver names from your own Traefik setup (websecure and letsencrypt are common).
# compose.override.yaml: Stocklane behind a Traefik that runs in Docker
services:
app:
networks: [default, proxy] # default: the app's own database and storage
labels:
- traefik.enable=true
- traefik.docker.network=proxy # the same network name
- traefik.http.routers.stocklane.rule=Host(`pos.yourbrand.com`)
- traefik.http.routers.stocklane.entrypoints=websecure
- traefik.http.routers.stocklane.tls.certresolver=letsencrypt
- traefik.http.services.stocklane.loadbalancer.server.port=8080
networks:
proxy:
external: true
name: proxy # your proxy's network, as docker network ls shows it
Nginx in a container, or Nginx Proxy Manager: join the network the same way and give the app a name there that no other container uses.
# compose.override.yaml: Stocklane on the network of an Nginx container
services:
app:
networks:
default:
proxy:
aliases: [stocklane]
networks:
proxy:
external: true
name: proxy # your proxy's network, as docker network ls shows it
Then send the traffic to http://stocklane:8080 (http://app:8080 also works while no other container on that network is called app). In Nginx:
location / {
proxy_pass http://stocklane:8080;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off; # the live updates are a stream
client_max_body_size 101m; # the largest upload is 100 MB
}
In Nginx Proxy Manager, add a Proxy Host with scheme http, forward hostname stocklane and port 8080, request its SSL certificate, and paste the last two lines above into the Advanced tab.
Then start the app with docker compose up -d --build and keep TRUSTED_PROXY_HOPS=1: Traefik, Nginx and Nginx Proxy Manager each add one address, as the next section explains.
5. Visitor addresses and rate limits
Stocklane limits sign-ins, sign-ups and password resets per visitor address, so nobody can guess passwords at speed. It reads the visitor's address from the X-Forwarded-For header only behind the number of proxies you trust, set with TRUSTED_PROXY_HOPS. A visitor can type any X-Forwarded-For they like, so trusting it without a proxy would let them make up a new address for every try.
| Your setup | Setting |
|---|---|
The bundled Caddy (--profile https) | TRUSTED_PROXY_HOPS=1 (the Docker default). The app port is published on 127.0.0.1 only, so Caddy is the only way in, and Caddy replaces any X-Forwarded-For a visitor sends with the real address. |
| Your own Nginx, Apache or Traefik on the same server, on the host or in Docker (above) | TRUSTED_PROXY_HOPS=1 and keep APP_BIND=127.0.0.1. Stocklane counts the address your proxy adds last, so a header a visitor makes up is never used; replacing the header is still tidiest (Nginx: proxy_set_header X-Forwarded-For $remote_addr;). Turn off response buffering for /api/v1/events (Nginx: proxy_buffering off;) so live updates work, and allow uploads up to 101 MB (Nginx: client_max_body_size 101m;). |
| A load balancer or CDN in front of your proxy (for example Cloudflare, then Caddy) | TRUSTED_PROXY_HOPS=2: one hop for each proxy that adds an address. Never set a higher number than the proxies really in front of the app. |
| No proxy at all (app port open to the internet) | TRUSTED_PROXY_HOPS=0 and APP_BIND=0.0.0.0. No header is trusted, every visitor counts as one address for the per-address limits, and the per-account limits still apply. Without HTTPS this suits only testing. |
Super-admin → Setup check shows the current setting in its "Visitor addresses" row. The full list of limits is in Security notes.
Build on another computer
If your server is small, build the program on a bigger computer with Docker and copy it over. The packed program is one file that already holds the web app.
# on the bigger computer, in the stocklane folder (add --platform linux/arm64 for an ARM server)
docker build -f docker/Dockerfile --target pack -t stocklane-pack --platform linux/amd64 .
docker create --name stocklane-pack-copy stocklane-pack
mkdir -p prebuilt
docker cp stocklane-pack-copy:/stocklane prebuilt/stocklane
docker rm stocklane-pack-copy
# copy prebuilt/stocklane into the same folder on the server, then on the server:
BUILD_TARGET=prebuilt docker compose --profile https up -d --build
Set BUILD_TARGET=prebuilt in .env to keep it for later starts. The program must match the server's processor type (Intel/AMD = linux/amd64, ARM = linux/arm64).
Without Docker
Build the web app, then the server, and run the server behind your own HTTPS proxy:
cd apps/frontend && corepack enable && pnpm install && pnpm build && cd ../..
cargo build --release -p stocklane-server
./target/release/stocklane pack apps/frontend/dist/client ./stocklane
# .env next to where you start it: DATABASE_URL, APP_URL, APP_SECRET; STORAGE_DRIVER=local or your S3 bucket
BIND=127.0.0.1:8080 ./stocklane serve
Keep it running with a service manager such as systemd. The server applies the migrations when it starts; ./stocklane migrate applies them on their own.
Two copies on one server
To run a staging copy next to the live one, unzip Stocklane into a second folder and give each copy its own .env:
# .env of the live copy
COMPOSE_PROJECT_NAME=stocklane
APP_PORT=8080
APP_URL=https://pos.yourbrand.com
# .env of the staging copy
COMPOSE_PROJECT_NAME=stocklane-staging
APP_PORT=8081
APP_URL=https://staging.yourbrand.com
SEARCH_INDEXING=off
COMPOSE_PROJECT_NAME keeps each copy's containers, database, files, network, image and build cache apart, so a docker compose command in one folder never touches the other. Left empty, it is the folder's name, so two folders with the same name (for example /srv/live/stocklane and /srv/staging/stocklane) would share everything: always set it when you run two copies. Give each copy its own passwords and its own APP_SECRET. Only one copy can run the bundled Caddy, because it needs ports 80 and 443, so put both behind one proxy you run yourself (Behind a proxy you already run) with a different router name or network alias for each, for example stocklane-staging. SEARCH_INDEXING=off keeps search engines away from the staging copy (Search engines).
6Install wizard
The first visit to a new install opens the wizard at /install. It runs once; afterwards the page is locked. Sign-up stays closed until the wizard is finished.
- Setup token. Paste the token from the app's log (
docker compose logs app | grep -i "install token"showsInstall token: sl-install-… (open /install and paste it)). The app prints it at every start until the install is finished, and a restart makes a new one, so use the last line. Lost it? SetINSTALL_TOKENin.envto a value of your choice and restart the app withdocker compose up -d. - Server check. The database, file storage, the app address, email, Stripe and the other settings from
.env, each with its status. Lines marked required must work before you go on; a red one blocks Continue until you change.env, restart the app and press Check again. Everything else can be set up afterwards in Super-admin → Settings. - Create the super-admin. Your name, email and password (at least 10 characters) and the name of your product, which you can change any time. Add the sample plans (on by default) adds three paid plans, Starter, Growth and Scale, with monthly and yearly prices and a 14-day free trial; untick it to make your own.
- Done. You are signed in as the super-admin and the wizard is locked. It lists what it created and what to set up before you invite shops: email and Stripe.
The sample plans are all paid. A shop that signs up gets the default plan's free trial; when the trial ends without a subscription, the shop moves to your free public plan if you have one, and is read-only until it chooses a plan if you don't (chapter 8). Add a free plan in Super-admin → Plans if shops should keep selling for free after the trial.
7Setup check
Super-admin → Setup check lists everything a running platform depends on, with a plain-words status, what to do about it and, where possible, a Test button that calls the service for real.
| Row | What it shows, and what the test does |
|---|---|
| Database | The number of migrations applied; the test reads the PostgreSQL version. |
| File storage | The bucket or the local folder; the test writes, reads and deletes a small test file. |
| Email (SMTP) | The sender and the mail server; the test connects and, when you type an address, sends a test email to it. |
| Stripe | Whether paid plans can be sold; the test reads your Stripe balance and says whether the key is live or test. |
| Stripe webhook | Warns about a missing signing secret and paid plans without a Stripe price ID. |
| App address | Whether APP_URL is https; the test calls APP_URL/api/health and checks this server answers. |
| Visitor addresses | The TRUSTED_PROXY_HOPS setting (chapter 5). |
| Background jobs | Jobs that failed in the last 24 hours or wait too long; below the rows, every job with the reason it failed and a Retry button (chapter 36). |
| Install | Whether the install wizard has finished. |
Connect services
Every outside service can be set in .env or in Super-admin → Settings. Values saved in the super-admin take precedence over .env, are stored encrypted with your APP_SECRET, and are never shown again once saved (only their last four characters). Change a value by typing a new one.
8Plans and subscription billing (Stripe)
You sell plans to the shops. Stocklane works with your own Stripe account: Stripe Checkout for new subscriptions, Stripe's customer portal for card changes and cancellations, and signed webhooks that switch plans on and off.
Stripe is a third-party payment service with its own pricing, and you pay its fees: in the USA 2.9% + 30¢ per successful card payment plus 0.7% of subscription volume for Stripe Billing. Other countries, cards and currencies have their own rates on Stripe's pricing page.
1. Plans
Super-admin → Plans. Each plan has a name, a line about who it suits, a monthly price and an optional yearly price, the currency, a free trial (days), a list of what is included for the pricing page, whether it is public, whether it is the default plan new shops get, and an optional "Most popular" badge. Its limits are enforced on the server:
| Limit | What happens when it is reached |
|---|---|
| Outlets | Adding another outlet is refused with an upgrade prompt. |
| Staff logins | Inviting another person is refused. Members and open invites both count. |
| Products | Adding another active product is refused; an import offers to bring in only the rows that fit. Archived products don't count. |
| Sales a month | The till warns from 90%. At 100%, new sales are refused until the next month or an upgrade; refunds, store-credit top-ups and payments on pay-later sales still go through. The month is the shop's own calendar month in its time zone. |
| File storage | An upload past the limit (a product photo, an expense receipt) is refused. |
An empty limit means unlimited. Archiving a plan takes it off sale; existing subscribers keep it, and you can put it back on sale later. The sample plans are:
| Plan | Price | Outlets | Staff | Products | Sales a month | Files |
|---|---|---|---|---|---|---|
| Starter | $29 a month, $290 a year | 1 | 3 | 500 | 2,000 | 500 MB |
| Growth (default, most popular) | $59 a month, $590 a year | 3 | 10 | 5,000 | 10,000 | 2 GB |
| Scale | $119 a month, $1,190 a year | 10 | 40 | No limit | No limit | 10 GB |
Each has a 14-day free trial. Change them to suit your market.
2. The free trial without a card
- A shop that starts on a paid plan with trial days gets that many days of free use, with no card asked for. Billing shows the trial and when it ends.
- When the trial ends without a subscription, an hourly check moves the shop to your free public plan if one exists. If there is none, the shop is suspended with the reason "Your free trial has ended. Choose a plan in Billing to sell again.": it can still read everything and open Billing, but nothing can be changed or sold.
- Choosing any plan (a Stripe checkout, or a free plan) lifts that suspension at once.
- A Stripe checkout during the trial gets only the trial days that are left, so nobody gets two trials. A shop that cancels its subscription keeps the paid plan to the end of the paid period, then the same rule applies.
- When you reopen a suspended shop by hand in the super-admin, its trial end is cleared and the plan becomes its own.
3. Stripe keys
- In the Stripe Dashboard, switch to Test mode first. Under Developers → API keys, copy the Secret key (
sk_test_…) and the Publishable key. - Paste them into Super-admin → Settings → Stripe (or
STRIPE_SECRET_KEYandSTRIPE_PUBLISHABLE_KEYin.env). Press Test.
Creating the keys costs nothing. Stripe charges its own fees on each payment, and you pay them, as described in the box above.
4. Prices
- In Stripe, open Product catalog → Add product for each paid plan, with a recurring monthly price and, if you sell yearly, a recurring yearly price.
- Copy each price's ID (
price_…) into the plan in Super-admin → Plans. Stocklane reads the price from Stripe and shows "Found in Stripe" with its amount and interval, so a wrong ID is caught before a shop sees it.
5. The webhook
- In Stripe, open Developers → Webhooks → Add endpoint with the URL
https://pos.yourbrand.com/api/v1/webhooks/stripe(Super-admin → Settings → Stripe shows yours). - Select these events:
checkout.session.completed,customer.subscription.created,customer.subscription.updated,customer.subscription.deleted,invoice.paidandinvoice.payment_failed. Addcharge.refunded,charge.dispute.createdandcharge.dispute.closedtoo, so refunds and disputes show in Payments, andcustomer.updatedandpayment_method.updatedso a shop's billing page shows a changed card at once. - Copy the endpoint's Signing secret (
whsec_…) into Super-admin → Settings → Stripe (orSTRIPE_WEBHOOK_SECRET). Without it, paid plans would never switch on, and the setup check says so.
6. The customer portal
In Stripe, open Settings → Billing → Customer portal and activate it, with payment method updates, invoice history and cancellation turned on. Shop owners reach it from Billing.
7. Go live
Test a full upgrade with Stripe's test card 4242 4242 4242 4242, then repeat steps 3 to 5 in live mode with your live keys and live price IDs.
DEMO_PAYMENTS="true" in .env turns on a test checkout that switches plans without any card. It is "false" in the shipped file. It only works while no Stripe secret key is set: once you add one, plan changes go to Stripe Checkout. Keep it off on a live site.
Plans switch on only from Stripe's signed webhooks. Each Stripe event is applied once, in the same database transaction as its changes, so Stripe's retries never double anything. Payments and subscriptions are never deleted with a shop: a deleted shop is closed and kept, so refunds and disputes still find their invoices.
Charging the shops through Stocklane (selling plans or subscriptions) requires the Envato Extended Licence. The Regular Licence covers a single product whose end users are not charged.
When a card payment fails
- While Stripe retries the card (on the retry schedule in your Stripe billing settings), the subscription is past due, not suspended: the shop keeps working, its owners get a "payment failed" email, and the failed payment shows in the super-admin.
- After Stripe's last retry (Stripe marks the subscription unpaid), the shop is suspended with the reason "Payment failed: the card was declined on every retry." and its owners and managers are told. A suspended shop is read-only: it can still read everything and open Billing.
- When the shop pays, the subscription and the shop are both active again. This lifts only the suspension for non-payment: one a super-admin set stays until a super-admin lifts it.
9Card payments for a shop's invoices
Shops can send invoices to business customers (chapter 24). To let those customers pay by card, a shop connects its own Stripe account. The money goes straight to the shop's Stripe account; it never passes through yours.
- The shop's owner opens Settings → Payments → Invoices by card and chooses Connect.
- In the shop's own Stripe Dashboard, under Developers → Webhooks → Add endpoint, they add the Webhook endpoint address the sheet shows (
https://pos.yourbrand.com/api/v1/stripe/shops/<shop id>/webhook) for the eventcheckout.session.completed, and copy its signing secret. - Back in Stocklane they paste the shop's secret key (
sk_live_…,sk_test_…or a restrictedrk_…key) and the signing secret (whsec_…). Stocklane checks the key with Stripe before saving and stores both encrypted.
From then on every invoice has a pay link. The customer opens it, sees the invoice and pays on Stripe's own Checkout page, so card numbers never touch the shop's page or your server; the webhook marks the invoice paid (once, even when Stripe sends the event again) and the pay link closes. Disconnect stops pay links taking cards; invoices can still be paid by bank transfer and recorded by hand.
Stripe is a third-party service with its own pricing. The shop pays Stripe's fees on its invoice payments, in its own Stripe account. You, the buyer, pay nothing for them.
10Email (SMTP)
Stocklane sends password reset links and team invites, and a few platform notices: a payment failed, a plan limit was reached and a shop was suspended (each sent once per event). Shops also send their own emails through it: receipts, invoices and quotes with their reminders, purchase orders to suppliers, Z reports and a morning low-stock email.
- Get SMTP details from any email provider (Amazon SES, Postmark, Brevo, Mailgun, your own mail server…): host, port, username, password and a sender address on a domain you have verified with that provider.
- Enter them in Super-admin → Settings → Email (or the
SMTP_*keys in.env). Usestarttlson port 587,tlson port 465. - Press Test on the email row of the setup check, with your own address.
Every email is sent from your one sender address. Receipts, purchase orders and the low-stock email show the shop's name as the sender name. A customer's reply to an emailed receipt goes to the shop: to the address in Settings → Receipts → Replies to emailed receipts, or to the shop's own email when that is empty. A purchase order carries its own reply-to address, so the supplier's answer reaches the shop too. Without SMTP, each email is written to the app's log with its link (docker compose logs app), which is enough for testing. The wording of the five platform emails is editable in Super-admin → Settings → Email.
Email providers are third-party services with their own pricing, and you pay them for every email the platform sends, the shops' receipts and invoices included: Amazon SES, for example, charges $0.10 per 1,000 emails, and most other providers sell monthly plans with a small free tier.
11File storage
Product photos, expense receipts, shop logos and your brand logo are stored in an S3-compatible bucket. The Docker stack includes MinIO with a private bucket on the same server, so this works out of the box.
- Another bucket (AWS S3, Cloudflare R2, Backblaze B2, Wasabi, DigitalOcean Spaces…): set
S3_ENDPOINT,S3_REGION,S3_BUCKET,S3_ACCESS_KEY_IDandS3_SECRET_ACCESS_KEYin.env, or enter them in Super-admin → Settings → Storage. Keep the bucket private. - A local folder:
STORAGE_DRIVER=localkeeps files in theapp-storageDocker volume. Fine for one server.
Shop files are private: the app serves each one only to signed-in members of its shop. Uploads are checked by their content, not their name: product photos (JPEG, PNG or WebP up to 5 MB), expense receipts (a photo or a PDF up to 10 MB), shop logos (PNG, JPEG or WebP up to 1 MB) and your brand logo (PNG, SVG or WebP up to 1 MB). Every shop file counts toward the plan's file storage. Super-admin → Settings → Storage shows how much space is used.
The bundled MinIO and the server's own disk cost nothing extra. Outside storage providers are third-party services with their own pricing, and you pay them for space and sometimes for downloads: Cloudflare R2, for example, charges $0.015 per GB a month after the first 10 GB, with no download fees.
The shop (your customers)
Each of your customers works in their own shop: its outlets, tills, products, stock, customers, sales and settings, kept apart from every other shop. A person can belong to several shops and switch between them. What each person sees depends on their role (chapter 28): cashiers sell and see their own shifts; managers run the stock, customers, invoices, expenses and reports of their outlets; the owner sees everything and changes the shop's settings, team and plan. The server checks every role on every request; the screens only hide what a role cannot use, and say "Your role can't open this" with a button that asks the owner for access.
The chapters below use the sample shop of the demo, Northgate Market, with its two outlets, Main Street and Harbour Road.
12Overview and the first day
The first page after signing in. The owner sees today across every outlet; a manager sees their outlet; a cashier sees their own shift.
- Takings, the average sale, profit and the cash in the drawers, with sales by hour against the same day last week.
- The tills now: who is selling on each one and how their shift is going; each outlet's day for the owner and each cashier's day for a manager.
- Low stock, today's best sellers, what needs attention (a drawer that didn't balance, an overdue invoice, a delivery to receive, a plan limit close) and the plan's use.
- The bell collects notices as they happen: payments, low stock, deliveries and transfers to receive, shift closes, limits and access requests.
The first day
A new shop sees a setup checklist instead: shop details and logo, the first outlet and till, products (or a CSV import), the team with their till PINs, the opening stock, and the first shift (count the float, ring up a test sale, then refund it).
The Add sample products and sales box on the sign-up form (on by default) fills a new shop with sample products, two customers and a week of sales, so every screen has something to show. When the shop is ready to sell for real, the owner presses Remove sample data on the overview and types REMOVE: the sample products, customers, sales, shifts, orders, invoices and expenses go, and anything the shop's real work already uses is kept as its own.
13The till
A full-screen till at /till, made for touch, keyboard and barcode scanners. One screen, no page loads between sales. It works on a computer, a tablet and a phone.
Starting
Pick the register. A register needs an open shift before it sells (chapter 15). When an owner or manager opens the till on a register, that browser is set up as the register's till, so the team can switch on it with their PINs (chapter 16).
Adding items
- Scan with a hand scanner at any time while selling, or with the device's camera. A scanned barcode or SKU goes straight into the sale.
- Search by name, SKU or barcode (F2), or tap a product tile; the category chips across the top narrow the grid.
- A product with variants (colour, size, scent) asks which one; number keys pick it.
- A weighed item (sold by weight) asks for the weight: the cashier types what the scale shows, and the line shows the weight and the price per unit.
- When an item shows no stock, the till warns. Whether it may still be sold is the shop's setting ("Sell when stock shows zero").
Lines and discounts
- Tap a line to change its quantity, give it a new price, a discount with a reason (printed on the receipt) or a note.
- Discount (F6) takes money off the whole sale, spread over its lines after any line discounts, with a reason.
- Each person has a discount limit (10% unless the owner changes it). A discount over it, or a new price, needs a manager's PIN: a manager or the owner picks themselves on the till and types their PIN, and that approval works for this one action for two minutes.
Customers, notes and parked sales
- Customer (F4): find them by name, phone, email or card number, see their points and store credit and what this sale earns, or add a new one with a name and an email or phone.
- Note (F7) adds a note to the sale.
- Park (F8) puts the sale aside to serve the next customer. Parked in the top bar lists the register's parked sales; recalling one parks the current sale first, so nothing is lost. Deleting a parked sale asks for a reason, which goes to the audit log.
Taking payment
Charge (Enter) opens the pay screen. A sale can be split across as many payments as the customer likes:
| Way to pay | How it works |
|---|---|
| Cash | Type what was handed over or tap a quick note; the till shows the change. Cash may be more than what is due. |
| Card | Charged on the shop's own card terminal; the cashier marks it approved or declined. A declined card stays on the list and nothing is counted twice. |
| Store credit | From the customer's balance, up to what they hold (chapter 23). |
| Points | Loyalty points as money off (100 points = 1.00 unless the shop changes it), up to what they have. |
| Pay later | On the customer's account, for customers the shop allows, up to their limit. It becomes a due the customer pays later (chapter 23). |
Card, store credit, points and pay later can never take more than is still due. The sale saves when the payments add up to the total, and each shop turns the ways to pay on and off in Settings → Payments.
The receipt
The done screen shows the change to hand back and the receipt, ready in one tap: print on 80 mm or 58 mm paper, an A4 PDF, an email with the receipt's link, a WhatsApp link (opens WhatsApp on the device with the link, for the customer's phone), or none. A receipt has the shop's header and footer, the lines with their tax letters, tax per rate, the payments, the customer's points, a barcode for returns and a QR code to the receipt online. The link opens the receipt without signing in, with a Download PDF button.
When the connection drops
Each sale gets its own id on the till the moment it starts. If the connection drops while a sale is being saved, the cart stays on the till, the till retries by itself and shows what was and wasn't charged, and the cashier can park the sale to serve the next customer. A retry that reaches the server twice is still one sale: the server answers with the sale it already saved.
Keys
F2 search · F4 customer · F6 discount · F7 note · F8 park · F9 print · F10 returns · Enter charge or the screen's main button · Esc back. The till's menu also has cash in and out, close the shift, switch till, the back-office pages, light or dark, and sign out.
When the shop has used 90% of its plan's sales this month, the till says so; at 100% new sales stop until an upgrade or the next month (chapter 8).
14Returns and refunds
Returns (F10) on the till finds the sale: scan the receipt's barcode or QR code, type its number, or find the customer and pick one of their receipts.
- Pick what comes back, line by line. Nothing can come back twice: each line allows only what was sold less what was already refunded, and the total never exceeds what was paid.
- Choose where the money goes: back the way it was paid (cash from the drawer, back to the card on the shop's terminal, store credit, points), or all of it as store credit.
- Stock comes back to the outlet unless the cashier ticks that the item is damaged ("don't restock"). Points the sale earned are taken back in proportion.
- A cashier's refund needs a manager's PIN. A receipt older than the shop's refund window (30 days unless changed) also needs one.
- The refund gets its own number and a refund receipt. Refunds still work when the shop has reached its monthly sales limit.
15Shifts and cash
- Open a shift: count the float note by note and coin by coin; the till shows it against what was left in the drawer at the last close. A register has at most one open shift.
- Cash in or out during the shift (a window cleaner paid, a float top-up) with a reason. Up to the shop's limit (50.00 in the shop's currency unless changed) needs no approval; more needs a manager's PIN. A cash expense recorded in the back office is also a cash out of its shift (chapter 25).
- Close the shift: a blind count of the drawer (what it should hold stays hidden), then the check: what the till expected, what was counted and the difference, big and clear as balanced, short or over. A difference over the shop's limit (5.00 in the shop's currency unless changed) needs a note before it closes.
- The till expects: float + cash sales − cash refunds + cash in − cash out.
- The Z report prints on 80 mm paper, can be emailed to the owner, and is kept with the shift, also as a PDF. A closed shift can't change.
Shifts in the back office lists every shift the person may see (the owner all, a manager their outlets, a cashier their own) with its float, expected and counted cash and the difference, tabs for short or over and still open, filters and a CSV. A shift's page shows the drawer's verdict, the shift at a glance (sales, payments, sales by hour, refunds, discounts, cash out, tax), the count by note and coin, and the close note.
16Shared tills and the PIN switch
Most shops share one till between several people. Each person has a 4-digit till PIN. The owner sets it in Team and tells them in person (it is never emailed), and each person can change their own in Settings → Your profile → Till PIN. Easy PINs (such as 1111, 1234 or 4321) and a PIN another member of the shop already uses are refused.
- Lock in the top bar locks the till between customers. The sale on screen stays exactly as it was, behind a blur.
- Whoever unlocks picks themselves and types their PIN, and the till sells as them from then on: every sale, refund and cash move carries the name of the person who made it.
- Three wrong PINs in a row make that till wait a minute, and the managers are told.
- The PIN switch works only on a browser an owner or manager has set up as the register's till (opening the till on it does this). A session opened by a PIN lasts at most a working day and ends when someone else unlocks that till.
- The same PIN pad approves a cashier's discount, refund or large cash move when a manager types their PIN.
17Sales history
Sales lists every receipt the person may see: the owner all, a manager their outlets, a cashier their own shifts. Tiles at the top total the money for the current filters; tabs by outlet or status; filters for the date, till, cashier and way of payment; search by receipt number, customer or item.
- A sale opens in a side sheet: when and where, the customer and their points, the lines, the totals with tax per rate, every payment (declined cards too), the refunds so far and what happened, step by step.
- From there: Reprint (80 mm, 58 mm or A4), Email receipt, PDF and Refund (the refund itself happens on the till).
- Export writes one CSV for a range of dates and outlets, with the sales, their lines, payments and refunds as you choose. It opens in Excel, Numbers or Google Sheets.
Receipt numbers are per till: the outlet's code, the till's number and five digits, for example MS1-21187.
18Products
Products lists the catalog with each product's SKU, category, supplier, price, cost, margin and stock at each outlet (Low and Out where they are), with tabs for all, low, out of stock and archived, filters by category and supplier, and search.
A product
- Details: name, category, supplier and the supplier's code, a description and photos (JPEG, PNG or WebP up to 5 MB each).
- Variants: an option such as Colour or Size, and its values. Each value is a variant with its own SKU, barcode, price, cost and switch for the till. A SKU and a barcode are unique within the shop.
- How it is sold: by each, by weight (kilogram or gram), by volume (litre), by length (metre) or in packs; the units a shop sells by are turned on under Categories and units. An open price product asks the cashier for the price.
- Price and tax: the price and cost of every variant, the tax rate (a category can give its products a default), and the margins. The average cost is kept by Stocklane from what was received and is only shown.
- Stock: what each variant has at each outlet, its reorder point (low at or below this) and order-up-to level, and whether the product tracks stock at all.
- Archive takes a product off the till and out of the plan's count; a product that never sold or moved can be deleted instead.
Categories and units
Categories are the till's tabs, in the order you drag them, each with a default tax rate and whether the till shows it. The same page turns on the units the shop sells by and shows which categories each tax rate covers.
Import from CSV
Import takes a CSV file in four steps: upload, match each column to a field, check every row (errors and warnings per row; a mapping can fix every row with the same value at once), then import. Rows whose SKU already exists update that product; the rest are new. When the new products don't fit the plan, the import offers to bring in only the rows that fit. Nothing is saved before Import, and an import can be undone for a day: its new products go (unless one has sold) and changed products get their old values back. Export writes every active variant with its prices, codes and stock per outlet in the same columns.
Barcode labels
Labels prints barcode labels for picked products: one per item in stock at an outlet, one each, or a typed number. Sizes: US Letter with 30 labels a sheet (2.625 × 1 in) for shops in the US and Canada, A4 elsewhere, a label printer roll or a shelf edge. Choose what shows on a label and which label on a used sheet to start from. Codes print as EAN-13 when they are valid EAN-13 codes and as Code 128 otherwise.
19Stock levels and movements
- Stock shows what every variant has at each outlet against its reorder point, what is on the way (transfers and purchase orders), the average cost and the value. Low stock comes first.
- Adjust adds or takes off stock by hand, or sets the count, always with a reason. Set reorder points and order-up-to levels here too.
- Low-stock alerts: when an item falls to its reorder point, the managers get one notice in the bell. The overview and the reports list what is low, with the transfer or purchase order that fixes each line.
- Low-stock email: once a morning, at 07:00 in the shop's time zone, the owner and managers get one email when anything is at or under its reorder point: up to 50 items by outlet, then how many more, with a link to Stock. It is on for a new shop; the owner turns it off in Settings → Payments.
- Movements is the history of every change to stock, with who, when and why: sales and refunds, deliveries and transfers, counts and adjustments, invoices sent and voided. Each line links to what made it.
- On a phone, Stock opens on the stock check: scan or type an item to see its price, cost, margin, its stock at every outlet and what is on order, then move stock, count it or print its label.
Every change to stock is a movement written in the same database transaction as the new level, so the history always adds up to the stock on hand. Untracked products (services, for example) are never counted.
20Transfers between outlets
- New transfer: pick the outlet it leaves and the one it goes to, and add products (search or scan). Each line is checked against what the source has; what is low at the destination can be added in one go. A transfer becomes a draft with its number (
TR-0042) as soon as it has a product, and saves itself as it changes. - Send: the stock leaves the source now (never more than it has) and the transfer is on its way. A packing list prints for the driver.
- Receive at the destination: every line starts as arrived in full; scanning items counts the lines from the scans instead. Anything short gets a reason and is either written off once or kept open.
The list shows drafts, transfers on the way, received ones (with anything short) and cancelled ones, with who sent and received each and when.
21Suppliers and purchase orders
Suppliers
Each supplier has its contact details, the email purchase orders go to, its terms, lead time and free-delivery amount, its products with stock at each outlet, what you bought from it this year and its last orders. Archiving a supplier keeps its orders and products.
Purchase orders
- New order: pick the supplier and the outlet; Stocklane suggests what to order from the reorder points (up to each item's order-up-to level). Change any number. The order shows how far it is from the supplier's free delivery. Order low stock on the list drafts one order per supplier for everything low at an outlet.
- Send: an email to the supplier with the order as a PDF attached, on the shop's paper (US Letter for US and Canadian shops, A4 elsewhere), with your copy, reply-to address and message.
- Receive any part, any number of times: what arrived now, at the cost on the supplier's invoice, and what happens to the rest (still expected on a date, or not coming). Receiving more than was ordered needs a tick. The page says how each new cost moves the item's average cost, before and after.
An order is a draft, sent, partly received, received or cancelled. Its number looks like PO-0187.
22Stock counts
- Start a count at an outlet: everything, a category, a supplier's products or one product. A blind count hides what Stocklane expects. Choose whether the till keeps selling during the count. The expected numbers are taken the moment it starts.
- Count: each scan adds one to its line (or jumps to it to type the number), and every count is saved as it is made, so a count can carry on from another device. Finishing asks what happens to lines nobody counted: count them as zero, or leave them as they are.
- Review: every line with what was expected, what was counted and the difference at cost. Correct a line or send it back for a recount.
- Apply with a reason: counted lines replace the stock with a movement for each difference; lines not counted stay as they are. An applied count can't change.
23Customers, points, store credit and pay later
Customers lists everyone a sale or an invoice was made for, with their tier, points, store credit, what they owe and their visits; tabs for credit, money owed and business customers; filters by home outlet and tier. A customer's profile shows what they spent, their purchases, the points and store credit ledgers (with the balance after every line), their details, dues and a staff note. Cashiers can look, add customers and edit contact details; managers do the rest. Import and Export work with CSV files: customers already in the shop (matched by phone or email) are updated, not doubled, and an import can set opening points but never store credit.
Loyalty points
- A customer attached to a sale earns points on the sale's net after discounts and before tax (1 point per 1.00 unless the shop changes it), on the part paid with money: the part paid with points or pay later earns nothing at once.
- Points are spent at the till as a payment (100 points = 1.00 unless changed) and come off at once.
- A refund takes back the points its items earned; a pay-later sale earns its points when it is paid in full.
- Tiers (member, silver, gold, by what a customer spent in the last 12 months) are labels only: points work the same for everyone.
Store credit
- Store credit comes only from a refund to store credit or a paid top-up. Nobody can type credit in.
- A top-up is sent from the customer's profile to a till with an open shift; the credit lands when that till takes the customer's cash or card payment.
- Customers spend credit at the till as a payment, and the receipt shows what is left.
- Only the owner can take credit off, as a correction, with a reason. Every change is in the ledger and the audit log.
- Expiry is off unless the owner sets it (Settings → Payments → Credit expires: Never, After 12 months or After 24 months). A balance with no credit line for that long (no spend, refund to credit or top-up) goes to zero, with the ledger line "Expired · Not used for 12 months" (or 24). An hourly check does it.
Pay later (customer accounts)
- The shop allows pay later per customer, with a limit. At the till, "Pay later" puts all or part of a sale on the customer's account, up to what the limit leaves.
- Collect a payment on the profile: the open dues, the amount (oldest due first; a part payment leaves the rest owing), paid by cash, card or store credit on a till with an open shift.
24Invoices and quotes
For business customers who buy on terms. Owners and managers only.
- New invoice or quote: the customer, the terms and due date (or how long a quote is valid), the outlet its stock comes from, and the lines: a product (search or scan) or a custom line, with quantity, price and tax rate. Totals show tax per rate. Numbers look like
INV-0142andQT-0031. - Send emails the customer a link to it, where they can read it, download its PDF and pay. Sending an invoice takes its stock out of the outlet; voiding it puts the stock back.
- The link opens the invoice without signing in. With the shop's own Stripe connected (chapter 9) the customer pays by card on Stripe's page; otherwise the page shows the shop's bank details. A paid invoice can never be charged twice, and its link closes once it is paid in full.
- Record a payment that came another way (a bank transfer, cash or card, with its date and reference). Part payments leave the rest due.
- Reminders: with reminders on, an unpaid invoice gets a reminder the morning after its due date, then a week after each reminder, three at most. Remind sends one now with a fresh link. A customer with an old link can ask for a fresh one.
- A quote is accepted or declined by the customer from its link (or by you), and an accepted quote converts into a draft invoice with the same lines.
- Void with a reason. "Overdue" is shown from the due date; nothing needs updating by hand.
25Expenses
Rent, bills and anything paid out of a till's cash, a month at a time: the receipt photo or PDF (up to 10 MB), the amount with the tax inside it, the date, what for, payee, category, outlet and where the money came from. An expense paid from till cash names a till with an open shift and is saved as a cash out of that shift, so the count at closing still balances; deleting it puts the cash back, so it can only be deleted while that shift is open. Tiles show where the money came from; filters, search, the total and a CSV. Owners and managers only.
26Reports
For this month, the last 7 days or today, for every outlet or one. Every figure adds up to the one above it; each tab exports as CSV and prints. Owners see every outlet, managers their own; cashiers have no reports.
| Tab | What it shows |
|---|---|
| Sales | Sales by day stacked by outlet, refunds, the plan's sales this month, and the money split by category, product, staff and outlet. |
| Profit | Net sales and cost of goods before tax, profit and margin by category and product, the thinnest margins and the products that earn the most. Refunds take their profit back. |
| Tax and payments | Tax per rate after refunds (the figure to report), what the tills took by way of payment and what went back out, invoice payments outside the till, and the store credit and points customers hold. |
| Stock | Stock value at average cost per outlet and category, as it stands now, what is on the way, and the low stock list with the transfer or order that fixes each line. |
27Outlets and tills
- An outlet is one shop front or warehouse: its name, a short code for its receipt numbers (
MS), address and phone, opening hours, and whether receipts use the shop's header or the outlet's own lines. Each outlet has its own stock. The plan limits how many a shop has. - A register (till) belongs to an outlet: its number and name, the float it opens with, the receipt printer and whether it has a cash drawer. The page shows who is on each one now.
- The owner adds and changes them; managers look. An outlet that has registers, sales, stock or documents can't be deleted, and a register with an open shift can't be removed.
28Team and roles
| Area | Owner | Manager | Cashier |
|---|---|---|---|
| Till, parked sales, own shift | Yes | Yes | Yes |
| Refunds, discounts over the limit, large cash moves | Yes | Yes, and approves others' | With a manager's PIN |
| Sales and shifts lists | All | Their outlets | Their own shifts |
| Products, stock, transfers, purchase orders, suppliers, counts | Yes | Their outlets | Look up stock only |
| Customers | Yes, plus export and removing credit | Yes, plus export | Look, add, edit contact details |
| Invoices and quotes, expenses, reports | Yes | Their outlets | No |
| Outlets, team, settings, plan | Yes | Look only | No |
| Audit log | Yes | No | No |
- Invite by email as a manager or cashier. The link works for 7 days and can be resent or withdrawn. Members and open invites count against the plan's staff logins.
- Each person's till rights: their role, the outlets they work at (or every outlet), and how much discount they may give without a manager's PIN. Owners always have every outlet and no limit; the last owner can't step down.
- PINs: the owner sets a new 4-digit PIN for someone (to tell them in person), and sees everyone's discount limits on one screen. Each person can also change their own PIN in their profile (chapter 16).
- Removing someone signs them out of the shop; their sales and shifts keep their name.
29Settings
The owner changes the shop's settings; managers see them; everyone has their own profile.
| Section | What it sets |
|---|---|
| Shop profile | The logo, the shop's names, address and contact details, currency, time zone, date format, tax permit and numbering, and the brand colour. |
| Outlets, Team | Chapters 27 and 28. |
| Taxes | The tax rates, each with what it covers and its letter on the receipt; whether prices include tax; how tax is worked out (chapter 32), with a worked example from a real receipt. A change affects new sales only. |
| Receipts | What the printed and emailed receipt shows: logo, header and footer lines, paper width (80 or 58 mm), tax per rate, points and store credit, the cashier's name and the returns barcode, and where customers' replies to emailed receipts go, with a live preview of the last sale and a test print. |
| Payments | The ways the tills take money (cash, card on the shop's terminal, store credit, points, pay later), invoices by card through the shop's own Stripe (chapter 9) with pay link and reminder settings, the refund window, selling when stock shows zero, the morning low-stock email, top-ups at the till, when unused store credit expires, and loyalty points (earn, spend, tiers). |
| Audit log | Chapter 30 (owner only). |
| Plan and billing | Chapter 31. |
| Your profile | Your name and picture, password, your own till PIN, and which notices reach you in this shop by email and in the browser. |
| Delete shop | Owner only, after typing the shop's name: the shop closes at once and its subscription is cancelled (chapter 38). |
30Audit log
Every money change, PIN approval and setting change, newest first: who did it, when, at which outlet, and the details. Filter by kind, person, outlet and time, search, and export up to 50,000 lines as CSV. Nothing in it can be changed or deleted from the app. Every change to money or stock writes its audit line in the same database transaction as the change itself. Owner only.
31Plan and billing (in the shop)
The owner sees the plan, its state (the free trial and when it ends, active, past due), the price, renewal and card, this month's use of every limit, the plans to move to (whether each fits what the shop has today), and the billing history with each invoice's PDF from Stripe. Managers can look; cashiers never see billing.
- Choose a plan opens Stripe Checkout with the plan's monthly or yearly price; the plan switches on when Stripe confirms the payment, usually within seconds. A free plan switches at once.
- Manage in Stripe opens Stripe's customer portal: card, invoices, cancellation.
- Cancel keeps the paid plan until the end of the paid period. During a free trial without a card there is nothing to cancel.
- When a limit is reached, the screen that was refused opens an upgrade dialog with the next plan that has room.
32How the numbers work
The rules the server follows for money and stock. Each one has a server test.
- Money is kept in whole cents and quantities in thousandths (0.840 kg), so nothing is lost to rounding.
- Amounts show in the shop's currency (Settings → Shop profile) with thousands grouped, such as $1,234.50 or €1,234.50; a currency without its own symbol shows its code (NOK). Plan prices show in each plan's own currency.
- Tax is worked out per tax rate on that rate's lines after discounts, then shared over those lines, so the lines add up exactly to the tax the receipt prints. Prices can be with tax added (the default) or with tax included. Rounding is half away from zero.
- A sale is saved once. The till gives each sale its own id; a retry with the same id answers the sale already saved.
- Payments add up. The payments of a sale (cash counted after change) equal its total. Card, store credit, points and pay later can't exceed what is due.
- Points are earned only on what was paid, on the net before tax, when the sale completes.
- Spends are atomic. Points and store credit come off with one conditional database update inside the sale; when two tills try to spend the same balance at once, one of them is refused and nothing of it is saved.
- Store credit only comes from a refund to credit or a paid top-up. Every change to it, expiry included, is a ledger line with the balance after it.
- Refunds never return more than was sold or paid, go back the way the sale was paid or to store credit, put stock back unless damaged, and take back points in proportion.
- Profit uses the average cost of an item at the moment it sold. Receiving stock at a new cost moves the average: (old quantity × old average + received × new cost) ÷ (old quantity + received).
- Stock changes only through movements, each written with the new level in one transaction under a lock, so twenty sales of the same item at once land exactly.
- Plan limits are counted under a per-shop lock in the transaction that adds the row, so two requests at once can never pass a limit together.
- Numbers (receipts, invoices, orders, transfers, counts, shifts) are taken inside the transaction that uses them, so they never repeat or skip.
- Days and months are cut in the shop's own time zone.
Run the platform
33Super-admin
The super-admin is your side of the platform, under /platform. The install wizard makes you its first admin. Give a colleague the admin role (everything) or the viewer role (sees everything, changes nothing) in Users.
Overview
Monthly recurring revenue (a yearly plan counts as a twelfth), shops (active, in a trial, suspended), the sales the shops rang up this month and what they took, revenue over the last 12 months, what needs attention (failed payments, trials ending soon, shops at a limit), the server's health and the newest shops.
Shops
Every shop with its owner, plan and price, outlets, sales this month, products and the one status that matters most; filters by paying, free and suspended and by plan; CSV export. The detail sheet shows the owner, subscription, money paid, this month's usage, members and payments, and lets you:
- Grant a plan by hand (Stripe is not charged);
- Suspend with a reason (the shop's owners and managers are told and the shop becomes read-only) or reactivate. A suspension for a failed payment lifts itself when the shop pays; one you set stays until you lift it;
- Delete: the shop is closed and its paid subscription cancelled, and its payment records are kept;
- Open as owner, to see exactly what the shop sees. The borrowed session lasts 30 minutes, shows a banner with an Exit button and is written to the audit log; inside it you cannot see or change passwords, keys or other secrets.
Users, plans, payments
- Users: everyone who can sign in, across all shops, with their shops and roles; suspend a person (which signs them out everywhere) or give them a platform role. You cannot change your own role or suspend yourself.
- Plans: chapter 8.
- Payments and subscriptions: this month's money (collected, failed and waiting for a retry, refunded), every payment with its status and why it failed, and every subscription with its status, interval and renewal date.
Settings
| Section | What it sets |
|---|---|
| Branding | Product name, logo, brand colour, support email, Documentation URL and Support URL (chapter 34). |
| Stripe | Secret key, publishable key and webhook signing secret, with a live test and the webhook address (chapter 8). |
| The SMTP server, a test email, and the wording of the five platform emails (password reset, invite, payment failed, plan limit reached, shop suspended) with a preview (chapter 10). | |
| Storage | Bucket or local folder, its keys, a live test and the space used (chapter 11). |
| Sign-ups | Open to everyone, by invite only, or closed; the plan new shops start on. |
| Legal pages | Terms of service, privacy policy and refund policy in Markdown, shown at /legal/terms, /legal/privacy and /legal/refunds and linked from the public pages and the sign-up form. Write your own: they are your agreement with the shops. |
| Maintenance | Maintenance mode with your message (shops see a maintenance page; you and your staff keep working), Remove demo data, and this server's facts. |
34Rebrand
Super-admin → Settings → Branding changes the product name, the logo, the brand colour and the support email without touching code. They show in the sidebar, the till, the sign-in and sign-up pages, the public landing and pricing pages, the emails and the browser tab. The brand colour recolours every button, active row, badge and chart in light and dark. The logo must be a square PNG, SVG or WebP of at most 1 MB; SVG files with scripts are refused. Each shop can also put its own logo on its receipts (chapter 29).
Help links
Stocklane never links to an address of ours. Two fields in Branding decide where its help links go:
| Field | Where it shows | When it is empty |
|---|---|---|
| Documentation URL | The address where you published this guide (docs/index.html from your download), for example https://help.yourbrand.com/docs. The super-admin menu shows Help and docs, and the setup pages link straight to the right chapter. | No docs link in the menu; the setup pages name the file and the chapter to read instead. |
| Support URL | Your own help or contact page, for the shops. Every shop's menu shows Help, which opens it. | Help opens an email to the support email instead, or is hidden when that is empty too. |
Both must be full addresses starting with https:// (or http://). The shops never see this guide: it is written for you, so the shop's Help link goes to your own support page.
To change the text of the public landing page, the pricing page wording or anything else beyond these settings, edit the React pages (chapter 41) and rebuild.
Search engines
Stocklane answers /robots.txt itself: search engines may index the public pages (landing, pricing, legal pages, sign-in and sign-up), while the shops, the till, the super-admin, the install wizard, invitations, password resets and the API stay closed. With SEARCH_INDEXING=off in .env, for a staging copy, /robots.txt closes every page and every answer also carries X-Robots-Tag: noindex, nofollow. Restart the app after changing it (docker compose up -d).
35Demo mode and the seed commands
Demo mode
DEMO_MODE=true turns an install into a public demo, like the item's live preview. Never turn it on for a real platform. It is not in .env.example and is off unless you add it. With it on:
- The demo data is added on start: the sample shop Northgate Market with two outlets (Main Street and Harbour Road), three tills, four staff, about 50 products, 60 customers, suppliers, a month of shifts and sales, purchase orders with deliveries, transfers, a stock count, invoices and quotes, expenses and stock history, plus the sample plans and payments for the super-admin.
- The shop keeps trading: every ten minutes, the sales whose time has come arrive, so the overview and the tills look like a real day.
- The sign-in page shows one-click sign-ins for the owner, a manager, a cashier and a read-only super-admin. They work inside the marketplace's preview frame too (the session cookie is then
SameSite=None; Secure; Partitioned). One address can use them 60 times an hour; after that the page says how long to wait. - Plan changes are test checkouts, the install wizard is off, and passwords, till PINs, emails, keys, the shop's Stripe connection, deleting the shop and other risky settings are locked for the demo accounts. Leave SMTP empty on a demo copy, so no email leaves it. The demo shop never sends the low-stock email.
- The demo data is removed and added again every night at 03:00 UTC.
The demo's one-click accounts and their till PINs exist only in demo data. A buyer's own install has no such accounts.
Seed commands
| Command | What it does |
|---|---|
docker compose exec app stocklane seed-demo | Adds the demo data, every row marked as demo. It only adds rows and never deletes anything. It refuses to run on a database that has any real account; --confirm adds the demo shop next to real data anyway (for a staging copy). |
docker compose exec app stocklane reset-demo | Removes the demo rows and adds them again. It refuses to run when the database holds any real account, with no way round it. |
| Super-admin → Settings → Maintenance → Remove demo data | Deletes only rows marked as demo. A demo shop with a real payment is kept. |
docker compose exec app stocklane migrate | Applies the database migrations and stops (the server also does this on every start). |
Real accounts, shops, payments and subscriptions are never marked as demo, so no seed or reset command can touch them. The sample data a new shop gets at sign-up (chapter 12) is separate: it belongs to that shop and its owner removes it.
36Background jobs
Work that talks to outside services or runs on a schedule goes through a job queue kept in PostgreSQL, run by the app itself. There is no separate worker, cron or Redis to set up.
| Job | When | What it does |
|---|---|---|
housekeeping | Every hour | Deletes expired sessions and rate-limit windows, password reset links a day past their expiry, finished jobs older than 14 days and invitations that expired over 30 days ago, ends free trials that ran out (chapter 8), expires unused store credit in shops that chose an expiry (chapter 23), and sends each shop's low-stock email at 07:00 in its time zone (chapter 19). |
receipt.email | When a receipt is emailed | Sends the receipt's link to the customer. |
till.shift_email | When a Z report is emailed | Sends a closed shift's Z report to the owner. |
po.send | When a purchase order is sent | Emails the order to the supplier with its PDF. |
invoice.remind | The morning after an invoice is due, then a week apart | Sends a reminder while the invoice is unpaid and reminders are on, three at most. |
demo.trade | Every 10 minutes, demo only | Adds the demo shop's sales whose time has come. |
demo.reset | 03:00 UTC, demo only | Puts the demo data back. |
JOB_WORKERS(default 4) sets how many jobs run at once in each copy of the server. Each job is taken by one worker only, even with several copies running.- A failed job is tried again after 10 seconds, then twice as long each time, at most an hour apart. A job whose worker stopped is given back after 10 minutes.
- The hourly and nightly jobs carry a key for their hour or day, so they run once per period however many copies of the server run.
Check that the jobs run
- Super-admin → Setup check → Background jobs is green when nothing failed in the last 24 hours and nothing waits longer than 10 minutes.
- Below the rows, the job list shows every job with its kind, status, tries and the reason it failed. Retry queues a failed job again.
docker compose logs appshows the same failures. When jobs wait and none run, restart the app withdocker compose up -d.
Security and privacy
37Security notes
What the server checks and limits, so you can answer the shops' questions and know what to keep safe.
Shops are kept apart
- The current shop always comes from the signed-in session, never from the request. Every query is filtered by it, and links between rows of a shop are composite database keys, so a row cannot point at another shop's row even by mistake. Another shop's id answers "not found".
- Roles and outlets are checked by the server on every request; the screens only hide what a role cannot use.
Accounts, sessions and PINs
- Passwords (at least 10 characters) are hashed with Argon2id. A password change or reset signs the person out on every other device.
- The session cookie (
sl_session) is HttpOnly, Secure on https and SameSite=Lax; it lasts 30 days and is renewed while in use, or only until the browser closes when "Keep me signed in" is off. - Every change made with the session cookie must carry the header
x-stocklane: 1, which browsers cannot add from another site, so other sites cannot make changes for a signed-in person. - Session tokens, password reset links, invites, till devices, receipt links, pay links and approvals are stored only as hashes. Till PINs are stored as a keyed hash; three wrong PINs in a row make a till wait a minute.
- A manager's PIN approval works for one action on one till, for two minutes, once.
- Your Stripe keys, the shops' Stripe keys and every secret saved in the super-admin are encrypted with AES-256-GCM, with a key derived from
APP_SECRET. KeepAPP_SECRETand your backups safe, and never change it after the install. - "Open as owner" sessions last 30 minutes, are audit-logged and cannot reveal or change secrets.
Webhooks
- Your Stripe: every event is checked against its signature and timestamp, and applied once, in the transaction that applies it.
- Shops' Stripe: each shop's webhook is checked with that shop's own signing secret and applies each invoice payment once (one payment per Stripe payment).
Rate limits
These limits are kept in PostgreSQL, so they hold across restarts and several copies of the server. They are keyed by a keyed hash of the account or the visitor address (taken only from trusted proxies, chapter 5), never by a plain address:
| Limit | Allowed | What it protects |
|---|---|---|
| Sign-in, per address | 20 per 15 minutes | Sign-in attempts from one address |
| Sign-in, per account | 5 per 15 minutes | Wrong passwords for one account; after five the account waits, even for the right password |
| Sign-up, per address | 5 per hour | New accounts from one address |
| Password reset, per address | 5 per hour | Password reset emails asked for from one address |
| Password reset, per account | 3 per hour | Password reset emails sent to one account |
| Reset and invite links, per address | 20 per hour | Tries at a reset or invite link from one address |
| Demo sign-in, per address | 60 per hour | Public demo sign-ins from one address |
| Invites, per shop | 50 per hour | Invites sent by one shop |
Every other API call takes from short-term allowances in memory: each signed-in person may make 240 calls at once and then 20 a second, and all calls from one visitor address together (counted only behind a trusted proxy) 1,200 at once and then 60 a second. Stripe webhooks are never limited. A refused call answers 429 with a Retry-After header.
Uploads and files
- Uploads are checked by their content, not their name, against the types and sizes in chapter 11. An SVG logo with scripts or event handlers is refused, and logos are served with a strict content policy.
- Shop files are private: only signed-in members of the shop can open them.
Money
- Plans switch on only from verified Stripe events; a shop cannot give itself a plan. Free test checkouts exist only with
DEMO_PAYMENTS="true"and no Stripe key, or on the public demo. - Every write that changes money or stock runs in one transaction with its audit line. Points and store credit are spent with one conditional update, so parallel requests cannot spend the same balance twice (chapter 32).
- Payment and subscription records are never deleted with a shop or a plan.
- The demo seed and reset commands touch only rows marked as demo and refuse to run on a database with real data (chapter 35).
What loads from other servers
The web app loads nothing from other servers: its fonts, icons, barcode scanner and QR code maker are part of the build. Stripe Checkout and the Stripe portal open on Stripe's own pages, and a WhatsApp receipt link opens WhatsApp. No visitor data goes to any other server. Every page is served with a content security policy that runs scripts only from your own site.
Keep it safe
- Use https (chapter 5), long unique passwords and two-factor sign-in on your Stripe, email and server accounts.
- Keep
.envand your backups private; anyone withAPP_SECRETand a backup can read the saved keys. - Install Stocklane updates; security fixes are marked as such in the changelog.
38Personal data and deletion
You run the platform, so you are responsible for the personal data in it. This chapter lists where personal data is kept, what is deleted by itself and when, and how to handle a request to delete someone's data. Say the same in your privacy policy (Super-admin → Settings → Legal pages).
Where personal data is kept
| Table | Whose data | What |
|---|---|---|
users | Shop staff and your platform staff | Name, email, picture and a password hash. |
sessions | Signed-in people | A hash of the session cookie, the browser's user agent and times. |
invites, password_resets | Invited people, people resetting a password | Email and a hash of the link. |
customers | The shops' customers | Name, email, phone, company, tax number, address, staff note, points, store credit and dues. |
sales, invoices, the ledgers | The shops' customers | What they bought and paid, linked to the customer. |
shop_members, audit_log | Shop staff | Their role, outlets and PIN hash; what they did and when. |
suppliers | Suppliers' contact people | Name, email and phone. |
File storage (shops/<shop id>/) | Varies | Product photos, expense receipts and logos. |
Rate limits keep only keyed hashes of addresses, never a plain IP address. Card numbers never reach Stocklane: cards are typed on Stripe's pages or on the shop's own terminal.
What is deleted by itself
- Every hour: expired sessions, expired rate-limit windows, password reset links a day after they expired, invitations 30 days after they expired, and finished background jobs (with their email addresses) after 14 days.
- Nothing else is deleted by itself. Sales, invoices, customers and the audit log are the shops' business records, kept until they are deleted as below. Many countries require shops to keep sales and tax records for several years.
Deleting a shop
The owner (Settings → Delete shop) or you (Super-admin → Shops → Delete) close the shop: it disappears for its members at once, its sessions leave it, and its subscription is cancelled. Its rows stay in the database, so your payment records and Stripe's refunds still find it. To erase a closed shop completely, for example after your own retention period, run these in the Stocklane folder with the shop's id (shown in the super-admin's shop sheet and its address):
docker compose exec -T postgres sh -c 'psql -U "$POSTGRES_USER" "$POSTGRES_DB"' <<'SQL'
begin;
delete from payments where shop_id = 'SHOP-ID';
delete from subscriptions where shop_id = 'SHOP-ID';
delete from shops where id = 'SHOP-ID'; -- removes everything the shop holds
commit;
SQL
Then delete the shop's files from your storage: the folder shops/SHOP-ID/ in your bucket (MinIO, S3, R2) or in the app-storage volume. Staff accounts that belonged only to that shop stay as accounts; delete them as below if asked.
A shop's customer asks to be deleted
- A customer who has no sales or invoices, owes nothing and holds no store credit can be deleted by a manager or the owner from their profile.
- A customer with sales or invoices stays on the shop's books. Edit them instead: replace the name with something like "Removed customer" and clear the email, phone, company, tax number, address and staff note. Their purchases keep their amounts without the personal details.
A person asks for their account to be deleted
- Each shop owner removes them from the team (an owner must first hand ownership to someone else). You can suspend the account at once in Super-admin → Users.
- Delete the account in the database. Their sales, shifts and audit lines stay, without the link to the person:
docker compose exec -T postgres sh -c 'psql -U "$POSTGRES_USER" "$POSTGRES_DB" -c "delete from users where email = '"'"'person@example.com'"'"'"'
Backups keep deleted data until they are replaced, so keep backups only as long as you need them (chapter 44).
For developers
39Every key, explained
Every setting in .env. The outside-service keys can also be set in Super-admin → Settings, which takes precedence. This table is generated from .env.example and the server's own settings code when the release is built.
| Key | Required | What it does |
|---|---|---|
| Required | ||
APP_URL | Yes | The public address of the app, without a trailing slash, for example https://pos.example.com. Links in emails, receipt and pay links, the Stripe webhook addresses and secure cookies come from it. Use https on a public server. |
APP_SECRET | Yes | A long random string of at least 32 characters (openssl rand -hex 32). It encrypts the Stripe keys and other secrets saved in the app (yours and the shops') and keys the hashed visitor addresses and till PINs. Never change it after the install: saved keys could no longer be read. |
POSTGRES_DB | No | The name of the database the stack creates. Default stocklane. |
POSTGRES_USER | No | The database user the stack creates. Default stocklane. |
POSTGRES_PASSWORD | Yes | The database password. Letters and digits only, because it goes into a connection address. |
DATABASE_URL | Outside Docker | The database address, only when you run the server without Docker. Leave it empty with Docker: the stack builds its own from the three keys above. |
INSTALL_TOKEN | No | The token the install wizard asks for. Empty: a new one is printed in the app's log on first start. |
| File storage (shop uploads and logos) | ||
STORAGE_DRIVER | No | s3 (the bundled MinIO, AWS S3 or Cloudflare R2) or local (files in a folder; in Docker a volume). Default s3 in Docker, local without Docker. |
S3_ENDPOINT | With s3 | The storage address. The bundled MinIO is http://minio:9000; for R2 use your account's S3 address; for AWS S3 leave it empty. |
S3_REGION | No | The bucket's region. Default us-east-1; R2 uses auto. |
S3_BUCKET | No | The bucket name. Default stocklane; the stack creates it in MinIO. |
S3_ACCESS_KEY_ID | With s3 | The storage access key. With the bundled MinIO this is also its admin user. |
S3_SECRET_ACCESS_KEY | Yes | The storage secret, at least 8 characters. With the bundled MinIO this is also its admin password, so Docker refuses to start without it. |
| Payments (Stripe; empty = paid plans off) | ||
STRIPE_SECRET_KEY | For paid plans | Your Stripe secret key (sk_live_…, or sk_test_… while testing), for selling plans to the shops. Empty: only free plans can be chosen. A shop's own Stripe for its invoices is set in that shop's settings, not here. |
STRIPE_WEBHOOK_SECRET | For paid plans | The signing secret of your Stripe webhook endpoint (whsec_…), chapter 8. |
STRIPE_PUBLISHABLE_KEY | No | Your Stripe publishable key (pk_…); the settings page reads live or test mode from it. |
DEMO_PAYMENTS | No | "true" turns on a test checkout that changes plans without a card, only while no Stripe secret key is set. Keep "false" on a live site. |
| Email (SMTP; empty = emails are written to the app's log) | ||
SMTP_HOST | For email | Your email provider's SMTP server. Empty: emails (resets, invites, receipts, invoices, purchase orders) are written to the app's log instead of being sent. |
SMTP_PORT | No | The SMTP port. Default 587. |
SMTP_USERNAME | For email | The SMTP user name. |
SMTP_PASSWORD | For email | The SMTP password or API key. |
SMTP_SECURE | No | starttls (port 587, the default), tls (port 465) or none. |
SMTP_FROM | For email | The sender, for example Stocklane <hello@example.com>. Use an address on a domain your provider has verified. |
| Network | ||
APP_PORT | No | The port on this server where the app answers. Default 8080. |
APP_BIND | No | Which address the port is open on. Default 127.0.0.1: this server only, so visitors come in through Caddy or your own proxy. Use 0.0.0.0 only with TRUSTED_PROXY_HOPS=0 or a firewall that lets only your proxy reach the port. |
APP_DOMAIN | With Caddy | The domain Caddy gets an HTTPS certificate for: the host of APP_URL, for example shop.example.com. |
TRUSTED_PROXY_HOPS | No | How many reverse proxies in front of the app add the visitor's address to X-Forwarded-For. 1 = the bundled Caddy (the default in Docker); 0 = trust no proxy (the default without Docker). Never set it higher than the proxies really in front of the app (chapter 5). |
| Advanced | ||
COMPOSE_PROJECT_NAME | No | Only for a second copy on the same server (for example staging): give each copy its own name, so their containers, database, files, network, image and build cache stay apart. Empty = the name of the Stocklane folder (chapter 5, Two copies on one server). |
SEARCH_INDEXING | No | on (the default): search engines may index the public pages (landing, pricing, legal, sign-in), never the app or the API. off, for a staging copy: /robots.txt closes every page and every answer carries X-Robots-Tag: noindex, nofollow. |
JOB_WORKERS | No | Background job workers in this server, 1 to 32. Default 4 (chapter 36). |
RUST_LOG | No | How much the server logs: info (the default), warn or debug. |
| Set by Docker, or for development | ||
ASSET_ARCHIVE | No | For your own zero-downtime deploys: a folder that keeps older builds' files, so pages still open in a browser keep working. |
BIND | No | The address the server listens on. Default 0.0.0.0: plus PORT. |
BUILD_TARGET | No | How Docker gets the program: built (the default, built on this server) or prebuilt (uses prebuilt/stocklane, built elsewhere; chapter 5). |
DEMO_MODE | No | Only for a public demo: true adds the sample shop Northgate Market with one-click sign-ins, keeps its sales coming through the day, locks risky settings and resets the data every night at 03:00 UTC (chapter 35). Never on a live site. |
DRAIN_SECS | No | For your own zero-downtime deploys: seconds a stopping server keeps answering while the health check reports it is stopping. Default 0. |
LOCAL_STORAGE_DIR | Set by Docker | The folder for files with STORAGE_DRIVER=local (/app/storage in Docker, a volume). |
PORT | Set by Docker | The port the server listens on inside its container (8080). |
READY_FILE | No | For your own zero-downtime deploys: the health check passes only once this file exists. |
STRIPE_API_URL | No | For tests only: another address for Stripe's API. |
WEB_DIST | Set by Docker | Where the built web app is, when it is not packed into the program. |
40File structure
stocklane/
├── apps/
│ ├── backend/ the Rust server (Axum): crate stocklane-server, program "stocklane"
│ │ ├── src/main.rs the commands: serve, migrate, health, seed-demo, reset-demo, pack
│ │ ├── src/lib.rs the HTTP app: /api/health, /api/v1, the web app, middleware
│ │ ├── src/api/ one module per area: auth, public (install, Stripe webhook), shop
│ │ │ (team), setup (settings, outlets, registers, taxes), overview,
│ │ │ till/ (till, shifts, sales, refunds, receipts), stock/ (products,
│ │ │ stock, transfers, counts, suppliers, purchase orders), back/
│ │ │ (customers, ledgers, invoices, pay page, shop Stripe, expenses,
│ │ │ reports, audit), sample, events, media, billing, admin
│ │ ├── src/money.rs tax per rate and the largest-remainder spreads
│ │ ├── src/inventory.rs the one way stock changes: level, movement, low-stock notice
│ │ ├── src/upkeep.rs the morning low-stock email and store-credit expiry
│ │ ├── src/numbers.rs receipt and document numbers
│ │ ├── src/limits.rs plan limits, counted under a lock
│ │ ├── src/billing.rs Stripe checkout, portal, webhooks and the free trial
│ │ ├── src/pdf.rs the PDFs (receipts, Z reports, invoices, purchase orders)
│ │ ├── src/jobs.rs the background job queue (PostgreSQL, FOR UPDATE SKIP LOCKED)
│ │ ├── src/settings.rs super-admin settings over .env
│ │ ├── src/setup_check.rs the setup check rows and live tests
│ │ ├── src/rate_limit.rs visitor addresses and limits
│ │ ├── src/realtime.rs the live event stream (Server-Sent Events)
│ │ ├── src/demo.rs, sample/ sample plans, the demo shop and new shops' sample data
│ │ ├── tests/ server tests (need a PostgreSQL, see chapter 41)
│ │ └── README.md every module of the server, for developers
│ └── frontend/ the web app (React Router 7, Vite, Tailwind CSS 4)
│ ├── src/routes.ts every page: URL → file
│ ├── src/pages/ shop/ (one folder per screen, till/ included), platform/
│ │ (super-admin), auth/, install/, public/ (site, receipt, pay page)
│ ├── src/components/ui/ shadcn/ui components
│ ├── src/ui/ tables, sheets, charts, toasts shared by the pages
│ ├── src/layout/ the app shell, sidebar and sign-in guard
│ ├── src/api/ the API client and types
│ ├── src/lib/ barcode drawing, scanning, dates
│ ├── src/styles.css colours, fonts and sizes (design tokens)
│ ├── e2e/ browser tests (Playwright)
│ └── README.md the web app's stack, scripts, folders and build
├── migrations/ the database schema (applied on start)
├── docker/ Dockerfile, docker-compose.yml, Caddyfile
├── compose.yaml "docker compose up" from this folder
├── Cargo.toml, Cargo.lock the Rust workspace
├── .env.example every setting
└── docs/ this guide (HTML and PDF) and the third-party licences
41Customise and rebuild
Run it for development
- Start a PostgreSQL (for example
docker compose up -d postgres, withports: ["127.0.0.1:5432:5432"]added to the postgres service in acompose.override.yaml, or your own) and setDATABASE_URLin.env. For development setSTORAGE_DRIVER=local. - Start the server from
apps/backend:cargo run(it reads.envfrom the folder or the ones above it and listens on port 8080). - Start the web app from
apps/frontend:pnpm install, thenpnpm dev, and openhttp://localhost:5173. Calls to/apigo to the server on port 8080 (API_ORIGINchanges that). Screens reload as you save.
Change the web app
apps/frontend/README.mdexplains the web app's stack, its scripts and folders, changing the brand and the production build.- Colours, fonts and sizes live in
apps/frontend/src/styles.cssas CSS variables (for example--brand). The brand colour set in Super-admin → Branding overrides--brandat run time. - Pages are in
apps/frontend/src/pages/, one folder per area;src/routes.tsmaps each URL to its file. The public landing and pricing pages aresrc/pages/public/Landing.tsxandPricing.tsx; the till issrc/pages/shop/till/. - Components are shadcn/ui (
src/components/ui/) on the Base UI and Radix primitives, with Lucide icons. - Checks:
pnpm typecheck,pnpm lint(Biome),pnpm test(Vitest) andpnpm e2e(Playwright).
Change the server
- Each area of the API is one module or folder in
apps/backend/src/api/; itsroutes()function lists the addresses. The money and stock rules are inmoney.rs,inventory.rsandlimits.rs;apps/backend/README.mdlists every module and what it does. - A database change is a new file in
migrations/namedYYYYMMDDHHMMSS_what.sql. Never edit a migration that has already run: the server checks them. - Checks:
cargo clippy --workspace --all-targets -- -D warningsandcargo test --workspace. The server tests need a PostgreSQL user that may create databases:TEST_DATABASE_URL=postgres://user:password@127.0.0.1:5432/postgres cargo test -p stocklane-server(each test gets a fresh database); without it they say so and pass.cargo deny checkchecks advisories and licences.
Worked example: add an API route
Say a shop wants to know how many receipts a customer has. In apps/backend/src/api/back/customers.rs, add the address to routes():
.route("/customers/{id}/receipt-count", get(receipt_count))
and the handler. Taking Cashier makes it work for any member of the current shop; the query filters by ws.id, so it can never read another shop:
/// How many sales a customer has at this shop.
async fn receipt_count(
State(state): State<AppState>,
Cashier(ws): Cashier,
Path(id): Path<Uuid>,
) -> ApiResult<Json<Value>> {
let n: i64 = sqlx::query_scalar(
"select count(*) from sales where shop_id = $1 and customer_id = $2 and kind = 'sale'",
)
.bind(ws.id)
.bind(id)
.fetch_one(&state.db)
.await?;
Ok(Json(json!({ "receipts": n })))
}
In the web app, call it with the shared client, which adds the session and the security header:
import { get } from "@/api/client";
const { receipts } = await get<{ receipts: number }>(`/customers/${customerId}/receipt-count`);
Then rebuild (below). Add a test next to the others in apps/backend/tests/api/.
Rebuild and deploy your changes
docker compose up -d --build # or with --profile https on your server
Docker rebuilds only what changed, and a change to the web app alone reuses the compiled server and is quicker still. Keep your changes in a Git repository, so you can compare them with each new Stocklane version.
42API reference
The web app and the till use the same /api/v1 API. These 230 addresses are generated from the server code when the release is built.
- JSON in and out with camelCase keys; times in ISO 8601 UTC; money in whole cents (
…Cents); quantities as numbers with up to three decimals (0.815kg). - Errors:
{"error": {"code": "…", "message": "…", "details": {…}}}. Common codes:bad_request(400),unauthorized(401),plan_limit(402, withdetails.limitone ofoutlets,staff,products,salesMonth,storageMb),forbidden,csrf,demo_locked,shop_suspended,wrong_pin(403),not_found(404),conflict,insufficient_points,insufficient_credit(409),rate_limited(429),unavailable,maintenance(503). - Lists:
?page=1&size=50plus each list's filters →{rows, total, page, size}. Many lists also export the same filters as CSV at…/export.csv. - "Member" means any member of the current shop (a cashier and up); "Manager" a manager or owner; "Owner" the owner; "Super-admin (viewer reads)" lets the read-only viewer role read too.
POST /salestakes aclientRef(a uuid made when the cart starts): a retry with the same one answers the saved sale withreplayed: true.- Live events:
GET /api/v1/eventsis a Server-Sent Events stream for the current shop, with apingevery 25 seconds.
| Method | Address | Who may call it | What it does |
|---|---|---|---|
| System | |||
GET | / | Anyone | 200 while the server is serving, 503 while a new copy takes over (the health check and proxies read it) |
GET | / | Anyone | The running build, so open pages can offer a reload after an update |
GET | / | Anyone | Tells search engines which pages they may index: the public pages, or none with SEARCH_INDEXING=off |
| Public pages, install and the Stripe webhooks | |||
GET | / | Anyone | Brand, sign-up mode, legal pages, maintenance, whether the install has run and the demo sign-ins, for the pages before sign-in |
GET | / | Anyone | The public plans for the pricing page |
GET | / | Anyone | A legal page (terms, privacy or refunds) in Markdown |
GET | / | Anyone, until the install is done (install token) | Whether the install wizard has run and the database answers |
POST | / | Anyone, until the install is done (install token) | Checks the install token and runs the server checks |
POST | / | Anyone, until the install is done (install token) | Creates the super-admin, the product name and the optional sample plans; runs once |
POST | / | Stripe (signed webhook) | Events from your Stripe account: signature checked, each event applied once |
GET | / | Anyone | A shop logo file, without sign-in (the name holds the file's hash, so it is cached for a year) |
GET | / | Anyone with the link | The receipt a customer opens from its link, without signing in |
GET | / | Anyone with the link | The same receipt as a PDF, without signing in |
GET | / | Anyone with the link | The invoice or quote behind a link, without signing in |
POST | / | Anyone with the link | Starts paying an open invoice by card on Stripe's page, through the shop's own Stripe |
POST | / | Anyone with the link | Emails a fresh link to the customer's address on file when an old link stopped working |
GET | / | Anyone with the link | The invoice or quote as a PDF, without signing in |
GET | / | Anyone with the link | The receipt of the card payment, without signing in |
POST | / | Anyone with the link | The customer accepts a quote |
POST | / | Anyone with the link | The customer declines a quote |
POST | / | The shop's own Stripe (signed webhook) | Events from a shop's own Stripe: checked with the shop's signing secret, each payment applied once |
GET | / | Anyone | The brand logo file, without sign-in (the name changes with the file, so it is cached) |
| Sign-in and account | |||
POST | / | Anyone | Creates an account and its first shop, with or without sample data (when sign-ups are open) |
POST | / | Anyone | Signs in with email and password; after five wrong passwords the account waits |
POST | / | Signed in | Signs out of this browser |
GET | / | Signed in | The signed-in person, their shops, the current shop and what their role may do |
GET | / | Anyone | The same as /auth/me when signed in, or no one |
POST | / | Signed in | Makes another of the person's shops the current one |
POST | / | Signed in | Creates another shop with the person as owner |
POST | / | Anyone | Emails a password reset link (always answers ok, so it never tells whether an account exists) |
POST | / | Anyone | Sets a new password from a reset link and signs in; each link works once |
GET | / | Anyone | Whose reset link this is (404 when it expired or was used) |
POST | / | Signed in | Ends an "open as owner" session and goes back to the super-admin's own |
GET | / | Anyone | The shop, role and email of an invitation link |
POST | / | Anyone | Accepts an invitation, creating the account when needed |
PATCH | / | Signed in | Changes the person's name, email or picture |
POST | / | Signed in | Changes the password (the current one is asked for) and ends the person's other sessions |
POST | / | Anyone, public demo only | One-click sign-in as the demo owner, manager, cashier or read-only super-admin |
POST | / | Member | The signed-in member sets their own 4-digit till PIN |
| Shop, outlets, team, files and live events | |||
GET | / | Member | The current shop |
PATCH | / | Owner | Changes the shop's name, time zone, business hours or settings |
DELETE | / | Owner | Closes the shop after its name is typed, and cancels its subscription |
GET | / | Member | The members with their till rights and, for managers, the open invitations |
POST | / | Owner | Invites someone by email as manager or cashier (counted against the plan's staff logins) |
POST | / | Owner | Sends an invitation again with a new link |
DELETE | / | Owner | Withdraws an invitation |
PATCH | / | Owner | Changes a member's role, outlets or discount limit |
DELETE | / | Owner | Removes a member (never the last owner) and signs them out of the shop |
PATCH | / | Owner | Changes a member's role, outlets or discount limit (the same as /team/members/{id}) |
POST | / | Owner | Sets a member's 4-digit till PIN, to tell them in person |
POST | / | Manager | Uploads the shop logo (PNG, JPEG or WebP up to 1 MB) |
DELETE | / | Manager | Removes the shop logo |
POST | / | Owner | Uploads the shop logo from the settings pages and answers the settings |
GET | / | Member | My notice choices in this shop: per event, email and browser |
PUT | / | Member | Saves my notice choices |
GET | / | Member | The overview page in one answer: today's figures, sales by hour, tills, outlets, low stock, best sellers and what needs attention |
GET | / | Member | The sidebar's badges and the bell's dot |
GET | / | Member | The newest notices with the member's read marks and the unread count |
POST | / | Member | Marks every notice the member sees as read |
POST | / | Member | Tells the owner that this member asked to open a page their role can't |
GET | / | Manager | Everything the settings pages show: profile, taxes, receipts, payments and loyalty |
PATCH | / | Owner | Changes any part of the shop's settings; the rest stay |
GET | / | Member | The shop's outlets with their registers |
POST | / | Owner | Adds an outlet, within the plan's outlets |
PATCH | / | Owner | Changes an outlet's details, hours or receipt header |
DELETE | / | Owner | Deletes an outlet that has no registers, sales, stock or documents |
GET | / | Member | The shop's registers by outlet and number |
POST | / | Owner | Adds a till to an outlet |
PATCH | / | Owner | Renames a register or changes its float, printer or cash drawer |
DELETE | / | Owner | Removes a register, never while a shift is open on it |
GET | / | Member | The shop's tax rates, the default first |
POST | / | Owner | Adds a tax rate |
PATCH | / | Owner | Renames a rate, changes its percent, receipt letter or what it covers, or makes it the default |
DELETE | / | Owner | Removes a rate that no product uses and that is not the default |
GET | / | Manager | Whether the shop's own Stripe is connected, and its webhook address |
PUT | / | Owner | Connects the shop's own Stripe with its secret key and webhook signing secret (checked with Stripe, stored encrypted) |
DELETE | / | Owner | Disconnects the shop's own Stripe; pay links stop taking cards |
POST | / | Owner | Removes the shop's sample data after REMOVE is typed; anything real work uses is kept |
GET | / | Member | The live update stream (Server-Sent Events) for the current shop |
POST | / | Member | Uploads a shop file (type checked by content, within the plan's file storage) |
GET | / | Member | Downloads a shop file (members of that shop only) |
| Till, shifts and sales | |||
GET | / | Member | Everything a till needs to start on a register: shop, outlet, shift, cashier, settings, taxes, ways to pay and plan use |
GET | / | Member | Every sellable variant with its price, tax, unit and stock at the outlet |
GET | / | Member | The till's customer search (the latest buyers without a search) |
POST | / | Member | Adds a customer from the till |
GET | / | Member | Store-credit top-ups waiting to be paid at this register |
POST | / | Manager | Sets this browser up as the till of one register, so staff can switch on it with their PIN |
POST | / | Member | Unlocks the till for the member whose PIN it is (three wrong PINs make the till wait a minute) |
POST | / | Member | Locks the till between customers |
POST | / | Member | A manager's or owner's PIN for one action on this till; the token works once, for two minutes |
GET | / | Member | The sales parked on a register, newest first |
POST | / | Member | Parks a cart on a register |
DELETE | / | Member | Deletes a parked sale with a reason, or after it was recalled |
GET | / | Member | Shifts with their figures, the week's tiles and the filter choices |
GET | / | Member | The filtered shifts as CSV |
POST | / | Member | Opens a shift on a register with its counted float |
GET | / | Member | One shift with its Z report figures |
POST | / | Member | Cash into or out of the drawer, with a reason (a manager's approval over the shop's limit) |
POST | / | Member | Closes a shift with its counted drawer (a note when the difference is over the shop's limit) |
POST | / | Manager | Emails a closed shift's Z report to the owner |
GET | / | Member | The Z report as an A4 or Letter PDF |
GET | / | Member | One page of sales with the tiles, refunds and filter choices |
POST | / | Member | Completes a sale, a top-up or a payment on dues; a retry with the same clientRef answers the saved sale |
GET | / | Member | The filtered sales as one CSV, with their lines, payments and refunds as asked |
GET | / | Member | One sale in full |
POST | / | Member | Refunds lines of a sale to the original ways of payment or to store credit |
GET | / | Member | The receipt as an A4 or Letter PDF |
POST | / | Member | Emails the receipt's link to the customer |
| Products and stock | |||
GET | / | Manager | One page of products by tab (all, low, out, archived), category and supplier, with stock per outlet |
POST | / | Manager | Adds a product with its variants and opening stock (an active product counts toward the plan) |
GET | / | Member | The outlets, categories, suppliers, taxes and units the product forms pick from |
GET | / | Manager | Every active variant with its prices, codes and stock per outlet, in the import's columns |
POST | / | Manager | Checks the rows of a product CSV against the catalog before anything is saved |
POST | / | Manager | Imports the checked rows, within the plan's products |
POST | / | Manager | Takes an import back within a day |
GET | / | Manager | One product with its variants, stock, photos, last delivery and recent movements |
PATCH | / | Manager | Changes a product, or archives it or brings it back |
DELETE | / | Manager | Deletes a product that never sold or moved; others are archived instead |
POST | / | Manager | Adds a JPEG, PNG or WebP photo up to 5 MB (it counts toward the plan's file storage) |
DELETE | / | Manager | Removes a photo and its file |
GET | / | Manager | The categories with their tax, till tab and stock value, and the units |
POST | / | Manager | Adds a category at the end of the till's tabs |
PATCH | / | Manager | Renames a category, or changes its icon, tax rate, till tab or place |
DELETE | / | Manager | Deletes an empty category |
POST | / | Manager | Turns on a unit the shop sells by |
GET | / | Member | Variants whose name, SKU or barcode match a search |
GET | / | Member | One variant by barcode or SKU, as scanned, or 404 |
GET | / | Manager | The chosen variants with their prices and codes, for printing labels |
GET | / | Member | One page of stock levels per outlet, with what is low, out or on the way |
GET | / | Member | One page of stock movements by outlet, product, kind and day |
POST | / | Manager | Adds or takes off stock by hand, with a reason |
PATCH | / | Manager | Sets an item's reorder point and order-up-to level at an outlet |
GET | / | Manager | One page of transfers by status and destination |
POST | / | Manager | Starts a draft transfer with its number |
GET | / | Manager | One transfer with its lines |
PATCH | / | Manager | Changes a draft's outlets, note and lines |
DELETE | / | Manager | Deletes a draft transfer (nothing has moved yet) |
POST | / | Manager | Sends a transfer: the stock leaves the source now |
POST | / | Manager | Receives a transfer at its destination, with a reason for anything short |
GET | / | Manager | One page of stock counts at the member's outlets |
POST | / | Manager | Starts a count of an outlet, a category, a supplier's products or one product |
GET | / | Manager | One count with its lines |
PATCH | / | Manager | Moves a count between counting and review, and changes its settings |
DELETE | / | Manager | Cancels a count that hasn't been applied (nothing moves) |
PATCH | / | Manager | Saves counted numbers as they are made |
POST | / | Manager | Applies a finished count with a reason: each counted difference becomes a stock movement |
GET | / | Manager | One page of suppliers with what is on order with each |
POST | / | Manager | Adds a supplier |
GET | / | Manager | One supplier with their products and last orders |
PATCH | / | Manager | Changes a supplier, or brings an archived one back |
DELETE | / | Manager | Archives a supplier (their orders and products stay) |
GET | / | Manager | One page of purchase orders by status, supplier and outlet |
POST | / | Manager | Starts a draft purchase order |
GET | / | Manager | What the reorder points suggest ordering from a supplier for an outlet |
POST | / | Manager | Drafts one order per supplier for everything low at an outlet |
GET | / | Manager | One purchase order with its lines and deliveries |
PATCH | / | Manager | Changes a draft order |
DELETE | / | Manager | Deletes a draft that was never sent |
POST | / | Manager | Emails the order to the supplier with its PDF and marks it sent |
POST | / | Manager | Receives any part of an order at the invoice's cost, updating the average cost |
GET | / | Manager | The purchase order as a PDF |
| Customers, invoices and expenses | |||
GET | / | Member | One page of customers by tab (credit, owes, business), home outlet, tier and search |
POST | / | Member | Adds a customer with the shop's next customer number |
GET | / | Manager | Every customer with their points, store credit and dues as CSV |
POST | / | Manager | Shows what a customers CSV would add and update, and which rows would be skipped |
POST | / | Manager | Adds the new customers with their opening points and updates the ones already in the shop |
GET | / | Member | One customer in full |
PATCH | / | Member | Changes a customer (cashiers change contact details only) |
DELETE | / | Manager | Deletes a customer who has no sales or invoices, owes nothing and holds no store credit |
GET | / | Member | The customer's purchases, refunds, top-ups and payments on dues, newest first |
GET | / | Member | The customer's points or store credit lines, with the balance after each |
POST | / | Owner | Takes store credit off a customer, with a reason |
POST | / | Member | Sends a store-credit top-up to a till with an open shift; the credit lands when the till takes the payment |
DELETE | / | Member | Calls back a top-up the till has not taken yet |
POST | / | Member | Collects a payment on a customer's pay-later dues at a till with an open shift |
GET | / | Manager | A month's invoices and quotes by tab (unpaid, quotes, drafts), customer and search |
POST | / | Manager | Starts a draft invoice or quote with the next number of its kind |
GET | / | Manager | A month's invoices and quotes as CSV |
GET | / | Manager | The products a line can pick, with price, tax rate and stock per outlet |
GET | / | Manager | One invoice or quote in full |
PATCH | / | Manager | Changes a draft, or an accepted quote before it becomes an invoice |
DELETE | / | Manager | Deletes a draft |
POST | / | Manager | Sends an invoice or quote and emails the customer its link (an invoice takes its stock out) |
POST | / | Manager | Sends a reminder now, with a fresh pay link |
POST | / | Manager | Records a payment made by bank transfer, cash or card |
POST | / | Manager | Voids an invoice or quote with a reason (an invoice's stock goes back) |
POST | / | Manager | Turns an accepted quote into a draft invoice with the same lines |
GET | / | Manager | The invoice or quote as a PDF |
GET | / | Manager | A month's expenses by where the money came from, category and outlet |
POST | / | Manager | Adds an expense; till cash comes out of that till's open shift |
GET | / | Manager | A month's expenses as CSV |
PATCH | / | Manager | Changes an expense |
DELETE | / | Manager | Deletes an expense; one paid from till cash only while its shift is open |
POST | / | Manager | Attaches the receipt photo or PDF, up to 10 MB |
| Reports and audit log | |||
GET | / | Manager | The sales report: by day and outlet, refunds, and split by category, product, staff and outlet |
GET | / | Manager | The profit report: net sales and cost before tax, by category and product |
GET | / | Manager | The tax and payments report: tax per rate after refunds, takings by way of payment, invoice payments, credit and points held |
GET | / | Manager | The stock report: value at average cost per outlet and category, what is on the way and what is low |
GET | / | Owner | One page of the shop's audit log, newest first |
GET | / | Owner | The audit log for the filters as CSV (up to 50,000 lines) |
| Billing | |||
GET | / | Manager | The shop's plan, subscription or free trial, this month's usage, invoices and card |
GET | / | Manager | The plans a shop can choose |
POST | / | Owner | Starts a plan change: a Stripe Checkout link, a test checkout or a switch to a free plan |
POST | / | Owner | A link to the Stripe customer portal |
POST | / | Owner | Cancels the paid plan at the end of the paid period |
| Super-admin | |||
GET | / | Super-admin (viewer reads) | Revenue, shops, sales this month, sign-ups and what needs attention |
GET | / | Super-admin (viewer reads) | Shops with search, status and plan filters, sorting and paging |
GET | / | Super-admin (viewer reads) | One shop with its owner, usage, members, subscription and payments |
PATCH | / | Super-admin | Grants a plan, or suspends or reactivates a shop |
DELETE | / | Super-admin | Closes a shop and cancels its paid subscription; payment records stay |
POST | / | Super-admin | "Open as owner": a 30-minute session as the shop's owner, written to the audit log |
GET | / | Super-admin (viewer reads) | Everyone on the platform, by search, platform role and status |
PATCH | / | Super-admin | Changes a person's platform role or suspends them |
GET | / | Super-admin (viewer reads) | Every plan, archived ones too, with its Stripe price IDs and shop count |
POST | / | Super-admin | Creates a plan |
POST | / | Super-admin | Reads a Stripe price ID from Stripe and answers its amount and interval |
PATCH | / | Super-admin | Changes a plan's prices, Stripe IDs, limits or features |
DELETE | / | Super-admin | Takes a plan off sale; its shops keep it |
POST | / | Super-admin | Puts an archived plan back on sale |
GET | / | Super-admin (viewer reads) | Every payment, with filters and this month's totals |
GET | / | Super-admin (viewer reads) | Every subscription with its status, interval and renewal date |
GET | / | Super-admin (viewer reads) | Every settings section (secrets masked), server facts and storage use |
POST | / | Super-admin | Uploads the brand logo (PNG, SVG or WebP up to 1 MB, checked by content) |
PUT | / | Super-admin | Saves one settings section (secrets stored encrypted; an empty secret keeps the saved one) |
GET | / | Super-admin (viewer reads) | The platform emails with their built-in and saved wording |
GET | / | Super-admin (viewer reads) | Every setup check row |
POST | / | Super-admin | Tests one setup check row against the real service |
GET | / | Super-admin (viewer reads) | Background jobs by status and kind, with counts per status |
POST | / | Super-admin | Queues a failed job again |
POST | / | Super-admin | Removes the demo data (demo-marked rows only) |
43Database
PostgreSQL. The schema is in migrations/ and is applied by the server on start. Ids are UUIDs, times are UTC, money is in whole cents and quantities in thousandths (…_milli). Every shop table carries shop_id; deleting a shop row removes everything it holds once its payments and subscriptions are gone (chapter 38). These 56 tables are generated from the migrations when the release is built.
| Table | What it holds | Keys | Points to |
|---|---|---|---|
| Accounts and sign-in | |||
users | Every person who can sign in: shop staff and your platform staff, with their super-admin role (none, admin or viewer) | primary key id; unique email (any case) | – |
sessions | Signed-in browsers (only a hash of the cookie is stored), including PIN-switch sessions on a till and super-admin "open as owner" sessions | primary key id; unique token_hash | users, shops, till_devices |
password_resets | Password reset links (hashed, valid for one hour, used once) | primary key id; unique token_hash | users |
invites | Open invitations to a shop, with the role to join as (manager or cashier) | primary key id; unique token_hash; unique email (any case) per shop, when accepted_at is null | shops, users |
rate_limits | Fixed-window counters for sign-in, sign-up, reset and till PIN limits (keyed by a hash, never a plain address) | primary key key | – |
| Shops, outlets and team | |||
shops | The tenants: your customers' businesses, with their plan, free trial end, Stripe customer, time zone, currency and selling settings | primary key id; unique slug; unique stripe_customer_id | plans, users |
shop_members | Who belongs to a shop: their role (owner, manager or cashier), till PIN hash, discount limit and whether they work at every outlet | primary key shop_id + user_id; unique pin_hash per shop, when pin_hash is not null | shops, users |
member_outlets | The outlets a member works at, when not all of them | primary key shop_id + user_id + outlet_id | shops, shop_members, outlets |
outlets | A shop's outlets (shop fronts or warehouses), with their receipt code, address, hours and receipt header | primary key id; unique code per shop | shops |
registers | The tills of an outlet, with their number, opening float, printer and cash drawer | primary key id; unique outlet_id + number | shops, outlets |
taxes | A shop's tax rates in basis points, with their receipt letter; one is the default | primary key id; unique per shop, when is_default and archived_at is null | shops |
till_devices | Browsers set up by an owner or manager to run one register, so staff can switch on them with their PIN | primary key id; unique token_hash | shops, users, registers |
shop_counters | The next number per shop and kind (receipts per register, invoices, quotes, orders, transfers, counts, shifts), taken inside the transaction that uses it | primary key shop_id + kind | shops |
audit_log | Money changes, approvals and setting changes made in a shop, and the super-admin's actions on it | primary key id | shops, users |
notifications | The bell's notices for a shop (payments, low stock, deliveries, transfers, shifts, limits, access requests) and who sees them | primary key id | shops |
notification_reads | Which member has read which notice | primary key notification_id + user_id | notifications, users |
media | Files a shop uploaded; their sizes count toward the plan's file storage | primary key id | shops |
| Products and stock | |||
categories | Product categories: the till's tabs, in order, with a default tax rate | primary key id; unique name (any case) per shop | shops, taxes |
products | The catalog: name, category, supplier, unit, tax, whether stock is tracked, and the till's options | primary key id | shops, categories, taxes, suppliers |
variants | Each sellable version of a product, with its SKU, barcode, price, cost and average cost | primary key id; unique sku (any case) per shop; unique barcode per shop, when barcode is not null | shops, products |
product_images | A product's photos in order; a photo may belong to one variant (the file is a media row) | primary key id | shops, products, variants, media |
product_imports | Product CSV imports, with the products each one made and the old values it changed, so an import can be undone within a day | primary key id | shops, users |
stock_levels | Stock on hand per variant and outlet, with its reorder point and order-up-to level | primary key variant_id + outlet_id | shops, variants, outlets |
stock_moves | Every change to stock, with its kind, quantity, who and why, written in the transaction that changes the level | primary key id | shops, users, variants, outlets |
suppliers | Who a shop buys from, with contact details, terms, lead time and free-delivery amount | primary key id; unique name (any case) per shop | shops |
purchase_orders | Orders to suppliers for an outlet, from draft to received | primary key id; unique number per shop | shops, users, suppliers, outlets |
po_lines | The lines of a purchase order, with what was ordered and what was received so far | primary key id | purchase_orders, variants |
po_receipts | Each delivery against a purchase order: what arrived, at what cost, and the supplier's invoice | primary key id | shops, users, purchase_orders |
transfers | Stock moving between two outlets, from draft to received | primary key id; unique number per shop | shops, users, outlets |
transfer_lines | The lines of a transfer, with what was sent and what was received | primary key id | transfers, variants |
stock_counts | Stock counts of an outlet (everything, a category, a supplier or one product), blind or not | primary key id; unique number per shop | shops, users, outlets |
count_lines | The lines of a count: what was expected when it started and what was counted | primary key id; unique count_id + variant_id | stock_counts, variants, users |
| Till, shifts and sales | |||
shifts | Till shifts: one open per register at most, with the float, expected and counted cash, the denominations and the close note | primary key id; unique number per shop; unique register_id, when status = 'open' | shops, users, outlets, registers |
cash_moves | Cash put into or taken out of a drawer during a shift, with its reason and who approved it | primary key id | shops, users, shifts, expenses |
sales | Sales, refunds, store-credit top-ups and payments on dues, each with its receipt number and the till's own id (one sale per id) | primary key id; unique receipt_token_hash; unique number per shop; unique client_ref per shop | shops, users, outlets, registers, shifts, customers |
sale_lines | The lines of a sale, with their tax, cost at the time of sale and how much was refunded | primary key id | sales, variants |
sale_payments | How a sale was paid: cash, card, store credit, points or pay later | primary key id | sales |
parked_sales | Carts parked on a register, to be recalled later | primary key id | shops, users, outlets, registers, customers |
till_approvals | A manager's or owner's PIN approval for one action on one till, valid for 2 minutes and used once | primary key id; unique token_hash | shops, users |
| Customers, invoices and expenses | |||
customers | A shop's customers, with their contact details, points, store credit, pay-later limit and what they owe | primary key id; unique number per shop, when number is not null | shops, users, outlets |
loyalty_ledger | Every change to a customer's points, with the balance after it | primary key id | shops, users, customers, sales |
credit_ledger | Every change to a customer's store credit (refunds, top-ups, spends, removals, expiry), with the balance after it | primary key id | shops, users, customers, sales |
dues_ledger | Every pay-later charge and payment on a customer's account, with the balance after it | primary key id | shops, users, customers, sales |
topup_requests | Store-credit top-ups sent to a till; the credit is added only when the till takes the payment | primary key id | shops, sales, users, customers, registers |
invoices | Invoices and quotes for business customers, with their status, dates, totals and a hash of the pay link | primary key id; unique pay_token_hash; unique kind + number per shop | shops, users, customers, outlets |
invoice_lines | The lines of an invoice or quote, with their tax rate | primary key id | invoices, variants, taxes |
invoice_payments | Payments against an invoice: by card through the shop's own Stripe (each Stripe payment once) or recorded by hand | primary key id; unique stripe_session_id; unique stripe_payment_intent | shops, users, invoices |
shop_stripe_events | Events from shops' own Stripe accounts already applied, so a repeated delivery changes nothing | primary key shop_id + event_id | shops |
expenses | A shop's expenses, with the receipt, category, outlet and where the money came from (till cash is also a cash move) | primary key id | shops, users, outlets, shifts |
| Plans and billing | |||
plans | The plans you sell, with prices, Stripe price IDs, free trial days, limits (outlets, staff, products, sales a month, storage) and features | primary key id | – |
subscriptions | A shop's paid plan from Stripe; a money row, never deleted with its shop | primary key id; unique provider_ref | shops, plans |
payments | Plan invoices paid, failed or refunded; money rows, never deleted with their shop | primary key id; unique number; unique provider_ref | shops, plans |
stripe_events | Events from your Stripe account already applied, so a repeated delivery changes nothing | primary key id | – |
email_notices | Emails already sent for a shop and period (platform notices and the daily low-stock email), so each goes out once | primary key shop_id + kind + period | shops |
| Platform | |||
platform_settings | The super-admin settings by section, which take precedence over .env (secrets stored encrypted) | primary key key | users |
jobs | The background job queue: emails, reminders, housekeeping and the demo's jobs | primary key id; unique dedupe_key, when dedupe_key is not null and status in ('queued', 'running') | shops |
Help
44Updating and backups
Back up
docker compose exec -T postgres sh -c 'pg_dump -U "$POSTGRES_USER" "$POSTGRES_DB"' > backup-$(date +%F).sql
Run it in the Stocklane folder. It reads the database user and name from the postgres container, so it works whatever you set as POSTGRES_USER and POSTGRES_DB; -T keeps a terminal out of the dump. Run it every day (with cron, for example) and keep copies on another computer: a shop's sales are its books.
Also keep a copy of .env (above all APP_SECRET, without which the saved keys cannot be read) and of your files: the minio-data Docker volume, your own bucket, or the app-storage volume. Restore a database backup into an empty database with docker compose exec -T postgres sh -c 'psql -U "$POSTGRES_USER" "$POSTGRES_DB"' < backup.sql.
Update
Upgrade in the same folder (unzip the new version over it as below; your .env stays). Docker names the stack, and with it the database volume, after the folder unless COMPOSE_PROJECT_NAME is set. If you move or rename the folder, set COMPOSE_PROJECT_NAME to the old folder name first, or the app starts with an empty database. Your data isn't lost; it's under the old name. Docker writes that name in lower case without dots or spaces (a folder Stocklane-1.0.0 becomes stocklane-100); docker volume ls shows it before _postgres-data.
- Back up as above.
- From the folder that holds
stocklane/(not inside it), rununzip -o stocklane-x.y.z.zipwith the new version's file name. The zip has a top-levelstocklane/folder, so it unpacks over your install; unzipping inside the install would makestocklane/stocklane.-oreplaces the old files without asking about each one. Your.env,compose.override.yamlandprebuilt/are kept, because the zip doesn't contain them. - Compare your
.envwith the new.env.example: new keys are listed there and inCHANGELOG.md. This lists the keys of.env.examplethat your.envdoesn't have yet:
Copy the ones you need, with their comments, intocd stocklane for k in $(grep -oE '^#? ?[A-Z][A-Z0-9_]*=' .env.example | tr -d '# ='); do grep -q "^$k=" .env || echo "$k"; done.env; a key you leave out keeps its default. - In the
stocklanefolder, rundocker compose up -d --build(with--profile httpson your server). The new version applies any new migrations when it starts; your data stays. - If disk is tight, run
docker builder pruneafterwards to free the build cache.
Update outside a shop's busiest hours: tills that are open keep their carts and retry a sale that was being saved, but the app is away for the seconds it takes to start. If you changed the code, compare your changes with the new version first. CHANGELOG.md lists what changed and marks security fixes.
45Troubleshooting
The install wizard asks for a token I don't have
The app prints it in its log at every start until the install is finished, and each restart makes a new one, so use the last line of docker compose logs app | grep -i "install token" (it reads Install token: sl-install-… (open /install and paste it)). Or set INSTALL_TOKEN in .env and run docker compose up -d.
After an upgrade everything is empty
The install wizard appears again, or the shops are gone, because the folder was moved or renamed: Docker names the stack and its database volume after the folder unless COMPOSE_PROJECT_NAME is set, so it started a new, empty one. Your data isn't lost; it's under the old name. docker volume ls shows it as <old name>_postgres-data, the old folder name in lower case without dots or spaces (for example stocklane-100_postgres-data). Stop the app with docker compose down, set COMPOSE_PROJECT_NAME in .env to the part before _postgres-data and run docker compose up -d again (chapter 44).
The app does not start
docker compose logs app names the problem, for example "APP_SECRET must be at least 32 characters" or "DATABASE_URL is not set". docker compose ps shows whether PostgreSQL and MinIO are healthy. Docker itself refuses to start without POSTGRES_PASSWORD and S3_SECRET_ACCESS_KEY and says which one is missing.
The build stops with "killed" or "signal: 9"
The server ran out of memory while compiling. Add swap or build on another computer (chapter 5).
Paid plans don't switch on
Setup check → Stripe webhook must be green. In Stripe → Developers → Webhooks, the endpoint must point to /api/v1/webhooks/stripe and list the events in chapter 8; Stripe shows every delivery and its answer there.
A shop's invoice was paid but still shows unpaid
The shop's own Stripe webhook is missing or has another signing secret. In the shop's Stripe Dashboard → Developers → Webhooks, the endpoint must be the address shown in the shop's Settings → Payments, for checkout.session.completed, and its signing secret must be the one saved in Stocklane. Stripe shows each delivery and retries failed ones; reconnect with the right secret and the next retry marks the invoice paid.
The barcode scanner doesn't add items
Set the scanner to keyboard mode with Enter after each code (see its manual), then scan into any text editor to check it types the code. The till takes scans while it is selling with a shift open. The camera scanner needs https (or localhost) and the browser's permission for the camera.
Receipts print too small, too wide or with margins
In the print window choose the receipt printer, the paper size that matches its roll (80 mm or 58 mm), margins "None" and scale 100%. Match Settings → Receipts → paper width to the printer. Most browsers remember these per printer.
The till says the shop has reached its monthly sales
The plan's sales a month are used up (chapter 8). The owner moves to a larger plan in Billing, or waits for the next month; refunds still work. You can grant a plan by hand in Super-admin → Shops.
A shop can't change anything
It is suspended: its free trial ended without a plan and there is no free plan, Stripe's last retry of its card failed, or you suspended it. The red banner says which. Choosing a plan in Billing lifts the first two; you lift your own in Super-admin → Shops.
Emails don't arrive
Without SMTP, emails are written to docker compose logs app. With SMTP, press Test on the email row of the setup check; check the sender domain is verified with your provider. Emailed receipts and purchase orders are background jobs: a failed one shows in Setup check with its reason and a Retry button.
The overview or the bell doesn't update live
A proxy is buffering the event stream. With the bundled Caddy it works as is; with Nginx add proxy_buffering off; for /api/v1/events.
Too many sign-in attempts from everyone at once
TRUSTED_PROXY_HOPS is 0 behind a proxy, so every visitor shares one address. Set it to the number of proxies in front of the app (chapter 5).
46FAQ
Does it work without the internet?
The till needs a connection to save a sale. A short drop doesn't lose anything: the cart stays on the till, the sale is retried with its own id so it is never saved twice, and the cashier can park it and carry on when the connection is back (chapter 13). Stocklane is not a full offline till that sells for hours without a connection.
Does it take card payments at the till?
It records them. The cashier charges the card on the shop's own terminal and marks it approved; Stocklane does not connect to card terminals. Business customers can pay invoices by card online through the shop's own Stripe (chapter 9).
Which printers, scanners and scales work?
Any receipt printer the computer can print to (80 or 58 mm), any barcode scanner in keyboard mode, and any scale whose weight the cashier types in (chapter 2).
Can a shop have several outlets and a warehouse?
Yes: each outlet has its own stock, tills and team, and stock moves between them with transfers. The plan sets how many outlets a shop may have.
Do I need to know Rust?
No, not to install, rebrand or run it: Docker builds everything. Changing the screens needs React; changing server rules needs Rust (chapter 41).
Can I use another database or host it without Docker?
PostgreSQL 15 or newer is required. Without Docker, run the one stocklane program behind your own HTTPS proxy (chapter 5). Managed PostgreSQL services work through DATABASE_URL.
Can a shop use it for free?
If you add a free plan, yes. Otherwise each shop gets the trial of its plan and then chooses a plan (chapter 8).
Which licence do I need?
To charge the shops (sell plans), the Envato Extended Licence. See chapter 49.
47Credits and licences
Stocklane is built with these open-source projects, each under its own licence:
- Server: Rust, Axum, Tokio, SQLx, reqwest, rustls, Lettre, chrono, RustCrypto (Argon2, AES-GCM, HMAC, SHA-2) and mimalloc, all MIT or Apache 2.0.
- Web app: React, React Router, Vite, Tailwind CSS, shadcn/ui, Base UI, Radix UI, TanStack Query and Table, ZXing (camera barcode scanning), Sonner and React DayPicker, all MIT.
- Icons: Lucide (ISC licence).
- Fonts: Geist and Geist Mono, under the SIL Open Font License 1.1, bundled through Fontsource and served by your own app.
- Docker images: PostgreSQL (PostgreSQL Licence), MinIO (GNU AGPL 3.0, run unmodified as a separate service), Caddy (Apache 2.0), and the official Rust, Node.js and Debian images used to build and run the app.
Every dependency
The Rust crates (from Cargo.lock) and the web app's npm packages, counted by licence when the release is built. docs/third-party-licenses.txt lists every package by name, version and licence.
| Licence | Rust crates | npm packages |
|---|---|---|
| MIT | 53 | 273 |
| Apache-2.0 OR MIT | 213 | 2 |
| Unicode-3.0 | 18 | – |
| ISC | 2 | 10 |
| Apache-2.0 | 1 | 10 |
| (MIT OR Apache-2.0) AND Unicode-3.0 | 3 | – |
| Apache-2.0 OR MIT OR Zlib | 3 | – |
| Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT | 3 | – |
| BSD-3-Clause | 1 | 2 |
| MIT OR Unlicense | 3 | – |
| 0BSD | 1 | 1 |
| Apache-2.0 OR BSD-2-Clause OR MIT | 2 | – |
| Apache-2.0 OR BSL-1.0 OR MIT | 2 | – |
| Apache-2.0 OR ISC OR MIT | 2 | – |
| Apache-2.0 OR LGPL-2.1-or-later OR MIT | 2 | – |
| BSD-2-Clause | – | 2 |
| CDLA-Permissive-2.0 | 2 | – |
| MPL-2.0 | – | 2 |
| OFL-1.1 | – | 2 |
| Zlib | 2 | – |
| (Apache-2.0 OR MIT) AND BSD-3-Clause | 1 | – |
| (Unlicense OR Apache-2.0) | – | 1 |
| 0BSD OR Apache-2.0 OR MIT | 1 | – |
| Apache-2.0 AND ISC | 1 | – |
| Apache-2.0 OR BSL-1.0 | 1 | – |
| BlueOak-1.0.0 | – | 1 |
| CC-BY-4.0 | – | 1 |
| MIT AND BSD-3-Clause | 1 | – |
| MIT-0 | – | 1 |
| Unlicense | – | 1 |
| Total | 318 | 309 |
Every licence above allows use in a commercial product. cargo deny check licenses checks the Rust crates against this list.
Images
Stocklane ships no stock photos. The logo is an original SVG, sample products show line icons or colour samples, and every image in this guide is a screenshot of the running app.
48Changelog
1.0.0 (2026-11-25)
First release.
- The till: a full-screen till for touch, keyboard and barcode scanners (hand scanner or camera), with variants,
weighed items, line and sale discounts with a manager's PIN over the cashier's limit, parked sales, split payments
(cash, card on the shop's terminal, store credit, points, pay later), receipts on 80 mm or 58 mm paper, as a PDF,
by email or as a WhatsApp link, refunds from the receipt, and sales that are saved once even when the connection
drops.
- Shifts and cash: shifts opened with a counted float, cash in and out, a blind count at close with the
difference and its note, and the Z report; a PIN switch between staff on a shared till, with PINs set by the owner
or by each person in their profile.
- Products and stock: variants, units by weight, volume, length or pack, barcodes, barcode labels, CSV import
(with undo) and export, categories, photos; stock per outlet with movements, low-stock notices, a morning low-stock
email and reorder points; transfers between outlets; suppliers and purchase orders received in parts at the
invoice's cost; stock counts.
- Customers and money: loyalty points, store credit (only from refunds and paid top-ups, with an optional expiry
after 12 or 24 months), pay later with limits and dues; invoices and quotes for business customers with pay links
through the shop's own Stripe and reminders; expenses, with till cash taken out of the shift; reports for sales,
profit, tax and payments, and stock value.
- The shop: an overview of the day, a first-day checklist with sample data that is removed in one step, outlets
and tills, owner, manager and cashier roles with per-outlet access, invitations, till PINs, settings for taxes,
receipts and payments, amounts in the shop's own currency, an audit log, and the shop's plan and billing.
- Billing: plans with limits (outlets, staff logins, products, sales a month and file storage), a free trial
without a card, Stripe Checkout and the customer portal, failed payments, refunds and disputes, and a test checkout
while Stripe is not set.
- Super-admin: revenue, shops, people, plans, payments and subscriptions, platform settings that take precedence
over .env, branding, legal pages, maintenance mode, email wording, and a setup check that tests every outside
service live.
- Security: argon2id passwords, PINs and links stored only as hashes, saved secrets encrypted at rest, CSRF
protection, a page policy that runs scripts only from your own site, rate limits kept in the database, signed
Stripe webhooks applied once, atomic spends of points and store credit, and every shop row tied to its shop so it
can never point at another.
- Install and hosting: an install wizard (sign-up stays closed until it is finished), sample plans, a public demo
mode with a nightly reset, and one Docker Compose stack (the app as one compiled Rust program, PostgreSQL, MinIO
and optional HTTPS with Caddy).
- Settings (
.env.example): every key is new in this release. Each later release lists its new keys here.
49Support and licence
Questions, bug reports and help with installation: use the Support tab on the item's page on the marketplace. Please include your Stocklane version (shown in the account menu), how you host it, and what you see (a screenshot, or the lines from docker compose logs app). Never send us your .env, API keys or passwords.
Support covers questions about the item's features, help with bugs and help with installing it as described here. It does not cover custom changes to the code, or the setup of your accounts at Stripe and other outside services, which are handled by those companies.
The Regular Licence lets you use Stocklane for one product whose end users are not charged. To charge the shops (sell plans or subscriptions), you need the Envato Extended Licence. One licence covers one platform (one brand on one installation). The licences page at codecanyon.net/licenses/standard explains both licences in full.