Basketrun Docs · 1.0.0 Also included as a PDF
Basketrun · documentation · version 1.0.0

Install it, draw your first zone, take grocery orders

Basketrun is a grocery quick-delivery marketplace that you run as your own business. Local stores join and sell their groceries. Shoppers order from the stores near them in the shopper app, express in 15 to 30 minutes or in a delivery slot. Pickers pack each order in the store app, scan the barcodes and offer swaps for empty shelves. Drivers bring it to the door with the driver app. Store owners run their store from a web panel, and you run the whole marketplace from the super-admin.

This guide is written for first-time installers. Every command is shown in full, every setting says where to find it, and every business rule is explained in plain words. Read Part 01 to get the server running, Part 02 to connect payments, email, maps and push, and Part 03 to build your three apps.

Part 01

Get started

1Welcome

Thank you for choosing Basketrun. This guide takes you from the download to a running grocery marketplace with your first zone, your first store and your three apps on real phones.

What you get

  • The shopper app (Flutter, Android and iOS): delivery address with a zone check on the map, a home page with express, stores near you, aisles and deals, store pages, search, product pages, a cart for one store at a time, a swap choice for every item, express delivery or a scheduled slot, coupons, a tip, checkout by card (Stripe), cash on delivery or wallet credit, live tracking with the driver on the map, swap approvals, a chat with the store and the driver, a 4-digit delivery code, ratings, reorder, a wallet for refunds and top-ups, saved addresses and notifications.
  • The store app for pickers: new orders that ring until someone answers, the pick list by aisle, barcode scanning with the phone camera, missing items, swap offers the shopper approves, packing with the bag count, the hand-over to the driver, today's work and an open/paused switch.
  • The driver app: online and offline, job offers with the pay shown before accepting, pickup and drop-off with a hand-off to Google Maps or Apple Maps, proof of delivery by code or photo, cash orders with change, earnings, trips and the next payout.
  • The store panel (web) for owners and managers: an overview, the live orders board, the catalogue with CSV import, stock, opening hours and slots, the team, reports and store settings.
  • The super-admin (web) for you: the overview, delivery zones drawn on a map with their fees, stores and their applications, commissions, drivers and their approval, orders and refunds, customers, coupons, the weekly payouts report, people, settings, legal pages and a setup check that tests every outside service live.
  • A public website: a home page with an address check and the stores near it, a "Sell with us" application form for stores, and six legal pages you write in the super-admin.
  • An install wizard and a sample city ("Lakeport": three stores, ten aisles, 182 products, drivers and coupons) you can load with one command to try everything.
  • One-command self-hosting with Docker: the server (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

PathWhat it is
apps/backend/The server, written in Rust (Axum): the /api/v1 API for the web app and the three Flutter apps, the Stripe webhook, the background jobs, dispatch and the built web app, compiled into one program called basketrun. apps/backend/seed/ holds the sample city and the starter legal texts.
apps/frontend/The web app: React 19, React Router 7, Vite, Tailwind CSS 4 and shadcn/ui. The super-admin, the store panel, the public site, sign-in and the install wizard.
basketrun_mobile_flutter/The Flutter project. One codebase that builds three apps by flavour: shopper, store and driver.
migrations/The PostgreSQL database schema. The server applies it by itself when it starts.
docker/, compose.yamlThe Dockerfile, the Docker Compose stack and the Caddy HTTPS config.
.env.exampleEvery server setting, explained. Copy it to .env. The apps have their own, basketrun_mobile_flutter/.env.example.
tools/rename.mjsOne command that gives the apps and the web app your name, ids, colour and icons (chapter 16).
docs/This documentation as one HTML file and as a PDF, plus the list of third-party licences.
README.md, CHANGELOG.md, LICENSE.txtA one-page quick start, 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 tests, Flutter widget and flow tests, and tests of the three apps against a running server) and integrated by us.
  • Documentation: Yes. Drafted with Claude by Anthropic and checked against the code and the running apps.
  • Graphics: Yes. The screen designs, the three app icons and the layouts of the preview images were made with Claude by Anthropic working in a design tool and in code. No image was made with an AI image generator: every screenshot in this guide and the item's previews is a capture of the running apps, and the demo's product, store and aisle photos are Pixabay photos shown on the demo only (not in the download).
  • Demo text: Yes. The sample city's stores, product names, people and the starter legal texts were written with Claude by Anthropic and edited by us. The starter legal texts are a starting point, not legal advice.

AI-powered features: No. Basketrun has no AI features and calls no AI service.

Not affiliated

Basketrun works with your own accounts at Stripe, Google (Firebase and, if you choose it, Google Maps), MapTiler, Apple and your email and storage providers. It is not made, endorsed or sponsored by any of them. Map data in the default maps is © OpenStreetMap contributors.

Screenshots

The main screens of the super-admin, the store panel, the public site and the three apps. Every chapter in Part 04 has more.

The super-admin overview: orders, sales and commission today, live orders, late orders and what needs you
The super-admin overview: orders, sales and commission today, live orders, late orders and what needs you
The store panel's live orders board: new, picking, ready and out for delivery
The store panel's live orders board: new, picking, ready and out for delivery
Delivery zones drawn on the map, with their fees, minimum orders and stores
Delivery zones drawn on the map, with their fees, minimum orders and stores
The public home page: the address check first, then the stores and zones further down
The public home page: the address check first, then the stores and zones further down
Shopper app: home with express and stores near you
Shopper app: home with express and stores near you
Shopper app: the driver on the map
Shopper app: the driver on the map
Store app: the pick list by aisle
Store app: the pick list by aisle
Driver app: an offer with its pay
Driver app: an offer with its pay

2Requirements

To run the server (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 include feature). Docker Desktop or Colima on macOS, or Docker Desktop on Windows, works for trying it on your own computer.
  • For the first build (Docker compiles the Rust server and the web app from source): 2 processor cores and 4 GB of memory (or 2 GB plus swap), and about 6 GB of free disk for Docker's build cache. The first build compiles everything and takes the longest; later builds reuse the cache (a rebuild after a small change took about 70 seconds on a cloud server). docker builder prune gives the cache space back once the app runs.
  • To run it the server needs far less: the finished app image is about 110 MB, and the app itself uses only a few megabytes of memory when idle. PostgreSQL and MinIO run beside it, so plan at least 1 GB of memory for a small marketplace. 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. The apps, Stripe and the browsers need a public https:// address with a valid certificate; the bundled Caddy gets one for you for free.
  • A current version of Chrome, Edge, Firefox or Safari for you and the store teams.

To build the mobile apps

Flutter on your own computer, Android Studio for the Android apps and a Mac with Xcode for the iOS apps. What you need in Part 03 lists the versions.

To build or change the server without Docker

  • Rust 1.90 or newer (stable) from rustup.rs.
  • Node.js 24 (22.12 or newer also works) and pnpm 11 (corepack enable installs 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.

Accounts you need

AccountWhat it is forNeeded
StripeCard payments for orders and wallet top-ups, and card refunds. Without it, shoppers pay cash on delivery or with wallet credit.To take card payments
An SMTP email providerPassword resets, invitations for store teams and drivers, application answers and store notices. Without it, each email is written to the app's log with its link.For a public launch
Firebase (Google, free)Push notifications to locked phones: new orders for pickers, offers for drivers, order updates for shoppers. Without it, the apps still update live while they are open.Strongly advised
Apple Developer Program and Google Play ConsolePublishing the three apps under your own name.To publish the apps
MapTiler or Google Maps PlatformMap tiles and address search for a busy marketplace. The default OpenStreetMap needs no account.Optional
S3-compatible storageProduct photos, store pictures, delivery photos and your logo. The bundled MinIO does this on the same server.Optional

3Extra costs you pay

Basketrun has no monthly fee of its own. 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 your fees.

ServicePriceWhat that means for you
Stripe (card payments)2.9% + 30¢Per successful US card payment, on every order, add-on and wallet top-up paid by card. On a $30 order that is about $1.17. Stripe keeps its fee when you refund a payment. Other countries and cards have their own rates.
OpenStreetMap tiles and address search (the default)FreePublic map tiles and the Nominatim address search, under their fair-use policies: light use only, at most one address search a second (the server keeps every answer for 30 days, so repeated searches cost nothing). Fine for trying it and a small city; a busy marketplace should move to MapTiler or Google.
MapTilerFree plan, then from about $25 a monthThe free plan is for testing and small projects with a monthly cap on map loads; a live business needs a paid plan. Tiles and address search use the same key.
Google Maps PlatformMap loads in the apps free; address search 10,000 a month free, then $5 per 1,000The phone apps draw Google Maps with Google's mobile SDKs, which Google does not charge for. The server's address search uses Google's Geocoding API. Google needs a billing account even inside the free allowance.
Firebase Cloud Messaging (push)FreeNo charge per message.
Apple Developer Program$99 a yearOne membership publishes all three apps on the App Store.
Google Play Console$25 onceOne developer account publishes all three apps on Google Play.
Email (for example Amazon SES)$0.10 per 1,000Per email sent. Other SMTP providers sell monthly plans with a free tier.
File storage$0 to $0.015 per GBThe bundled MinIO or the server's own disk costs nothing extra. Cloudflare R2, for example, charges $0.015 per GB a month with the first 10 GB free and no fee for downloads.
Server (VPS)about $10 to $40 a monthOne server with 2 cores and 4 GB of memory runs the whole Docker stack for a city.
Domain nameabout $10 to $20 a yearThe address of your marketplace, for example shop.yourbrand.com.
You set the fees that pay for this

Shoppers pay the zone's delivery fee and the platform's flat service fee on each order, and you keep a commission on each store's item sales (Part 04). Set them so that Stripe's fee on a typical basket, your driver pay per trip and your running costs are covered.

4Install in 10 minutes with Docker

This runs Basketrun on your own computer or on a server. The first build compiles the server from source, so it takes longer than later starts.

  1. Unzip the download and open a terminal in the basketrun/ folder (the one with compose.yaml in it).
  2. Create your settings file:
    cp .env.example .env
  3. Open .env in any text editor and fill in these four values:
    APP_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 characters
    Change both passwords: the example values are public. Keep APP_SECRET safe and never change it after the install, because it encrypts the keys you save in the super-admin. Leave DATABASE_URL empty: Docker builds the database address from the values above, and that key is only for running the server without Docker.
  4. Build and start everything:
    docker compose up -d --build
    Docker compiles the web app and the Rust server, then starts PostgreSQL and MinIO (file storage), creates the storage bucket and starts the app, which applies the database migrations by itself. Later builds reuse Docker's cache and are much quicker (about a minute after a small change).
  5. Find the install token in the app's log (if the app has restarted, use the last one):
    docker compose logs app | grep -i "install token"
    The line reads Install token: br-install-… (open /install and paste it).
  6. Open http://localhost:8080. The install wizard opens: paste the token, check the server, create your super-admin account, name your platform and draw your first delivery zone.
  7. Optional: load the sample city to see everything with data in it (chapter 34):
    docker compose exec app basketrun seed-demo --confirm
Good to know

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.

Trying the apps against this install

A phone cannot reach localhost on your computer. The Android emulator reaches it as http://10.0.2.2:8080; the iOS simulator as http://localhost:8080. A real phone needs the server's https address, so put it online first (next chapter).

Out of memory during the build

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 real orders, Basketrun must be reachable at a public https:// address: the three apps talk to it, Stripe sends its payment webhook to it and shoppers come back to it after paying.

1. Pick a server (VPS)

SizeGood for
2 cores, 4 GB memory, 40 GB diskBuilding on the server and running a city with several stores, dozens of drivers and thousands of orders a day.
1 to 2 cores, 1 to 2 GB memoryRunning a build made on another computer (see "Build on another computer" below), or building with swap added.
4+ cores, 8+ GB memorySeveral busy cities on one install.

Any provider that sells Linux servers with Docker works. Disk use grows mainly with product and delivery photos, 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 shop for shop.yourbrand.com) pointing at your server's IP address. Wait until ping shop.yourbrand.com shows that IP.

3. Settings

In .env:

APP_URL=https://shop.yourbrand.com
APP_DOMAIN=shop.yourbrand.com
TRUSTED_PROXY_HOPS=1

4. Start with HTTPS (Caddy)

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://shop.yourbrand.com; the first visit takes a few seconds while the certificate is issued. Caddy passes the live update stream through unbuffered, so the orders board and the tracking map move at once.

Already running a proxy?

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 Basketrun, 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 a compose.override.yaml file next to compose.yaml. Docker Compose reads it by itself on every docker compose command. docker network ls shows the proxy's network name; the examples call it proxy.

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: Basketrun 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.basketrun.rule=Host(`shop.yourbrand.com`)
      - traefik.http.routers.basketrun.entrypoints=websecure
      - traefik.http.routers.basketrun.tls.certresolver=letsencrypt
      - traefik.http.services.basketrun.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: Basketrun on the network of an Nginx container
services:
  app:
    networks:
      default:
      proxy:
        aliases: [basketrun]

networks:
  proxy:
    external: true
    name: proxy                   # your proxy's network, as docker network ls shows it

Then send the traffic to http://basketrun:8080. In Nginx:

location / {
    proxy_pass http://basketrun: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 21m;         # PDF documents and CSV lists go up to 20 MB
}

In Nginx Proxy Manager, add a Proxy Host with scheme http, forward hostname basketrun and port 8080, request its SSL certificate, and paste the last two lines above into the Advanced tab. 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

Basketrun 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 setupSetting
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. Turn off response buffering (Nginx: proxy_buffering off;) so the live updates work.
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, the per-address limits are off and only the per-account limits apply. The apps and Stripe need HTTPS, so 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 basketrun folder (use --platform linux/arm64 for an ARM server)
docker build -f docker/Dockerfile --target pack -t basketrun-pack --platform linux/amd64 .
docker create --name basketrun-pack-copy basketrun-pack
mkdir -p prebuilt
docker cp basketrun-pack-copy:/basketrun prebuilt/basketrun
docker rm basketrun-pack-copy

# copy prebuilt/basketrun 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 basketrun-server
./target/release/basketrun pack apps/frontend/dist/client ./basketrun
# .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 ./basketrun serve

Keep it running with a service manager such as systemd. The server applies the migrations when it starts; ./basketrun migrate applies them on their own. To load the sample city outside Docker, set DEMO_CATALOG=apps/backend/seed/lakeport.json before running ./basketrun seed-demo --confirm.

Other hosts

  • Platforms that run a Docker image (most cloud container services): build the image with docker build -f docker/Dockerfile -t basketrun ., give it a PostgreSQL 15+ database through DATABASE_URL, an S3 bucket through the S3_* keys (or STORAGE_DRIVER=local with a persistent volume at /app/storage), and set APP_URL, APP_SECRET and TRUSTED_PROXY_HOPS for the platform's own proxy. The app listens on port 8080.
  • Managed PostgreSQL works through DATABASE_URL.
  • Shared web hosting (cPanel, PHP hosting) cannot run Basketrun: it needs a server that runs Docker or a Linux program.

Two copies on one server

To run a staging copy next to the live one, unzip Basketrun into a second folder and give each copy its own .env:

# .env of the live copy
COMPOSE_PROJECT_NAME=basketrun
APP_PORT=8080
APP_URL=https://shop.yourbrand.com

# .env of the staging copy
COMPOSE_PROJECT_NAME=basketrun-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. Left empty, it is the folder's name, so two folders with the same name 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, so put both behind one proxy you run yourself with a different router name or network alias for each. SEARCH_INDEXING=off keeps search engines away from the staging copy.

6Install wizard

The first visit to a new install opens the wizard at /install. It has seven steps and runs once; afterwards the page is locked so nobody else can take the server over.

  1. Server checks. Paste the setup token from the app's log (docker compose logs app | grep -i "install token") and press Check the server. The app prints a new token at every start until the install is finished, so use the last line. Lost it? Set INSTALL_TOKEN in .env to a value of your choice and restart the app with docker compose up -d. The wizard then lists the database, file storage, the app address, email, Stripe, maps, push and the other settings, each marked ready or later. A red line blocks the next step until you fix .env, restart the app and check again.
  2. Your admin account. Your name, email and a password of at least 10 characters. This is the platform's super-admin.
  3. Platform name and currency. The name everyone sees (for example "Basketrun · Lakeport"), the support email shoppers and stores write to, the currency, the time zone (slots, payout weeks and reports follow it) and the default commission you keep on each store's item sales.
  4. First delivery zone. Find your city, then drag the corners of the zone over the streets you deliver to. Name it and set its delivery fee, free delivery over an amount, minimum order, express delivery on or off, and scheduled slots (30 minutes with 6 orders per store, 1 hour with 12, or 2 hours with 24). Shoppers cannot order until one zone exists; you can add more later in Zones.
  5. Payments (Stripe). Your publishable key, secret key and webhook signing secret, with the webhook address to paste into Stripe (chapter 8). Optional now: until it is set, shoppers pay cash on delivery.
  6. Email (SMTP). The mail server, port, user name, password and the sender. Optional now: until it is set, reset and invite emails are written to the app's log.
  7. Finish. You are signed in as the super-admin and the wizard is locked. It lists what is set up and what is left for later, with the place in the super-admin where each one is done.
Step 1: the setup token and the server checks
Step 1: the setup token and the server checks
Step 4: draw the first delivery zone and set its fees
Step 4: draw the first delivery zone and set its fees

7Setup check

Super-admin → Setup check lists everything a running marketplace depends on, with a plain-words status and what to do about it. Run again checks everything again and then tests every service that can be tested for real; the results replace the rows they test.

RowWhat it shows, and what the test does
DatabasePostgreSQL is reachable and how many migrations are applied. The test reads the PostgreSQL version.
File storageThe S3 bucket, or a warning that files are on this server's disk. The test writes, reads and deletes a small test file.
Email (SMTP)The sender and mail server. The test connects and signs in. Settings → Email sends a real test email to any address you type.
StripeWhether the secret key is set (test or live mode) and whether the webhook signing secret is there. The test reads your Stripe balance.
MapsWhich map the apps and pages draw, and a warning when MapTiler or Google is chosen without a key (the maps then fall back to OpenStreetMap).
Push messagesWhether a Firebase service account is saved. Without it, the apps show updates only while they are open.
App addressWhether APP_URL is https. The test calls APP_URL/api/health from the server itself.
Visitor addressesThe TRUSTED_PROXY_HOPS setting (chapter 5).
Background jobsJobs that failed in the last 24 hours or wait too long (emails, payment checks, purges).
InstallWhether the install wizard has finished.
Setup check: each service with its status and where to fix it
Setup check: each service with its status and where to fix it
Part 02

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, secrets are stored encrypted with your APP_SECRET, and a saved secret is never shown again (only its last four characters). Change a secret by typing a new one.

8Card payments (Stripe)

Shoppers pay by card through Stripe Checkout on your own Stripe account: for an order, for items added to an open order and for wallet top-ups. An order paid by card is placed only when Stripe's signed webhook confirms the payment, so set up the webhook as well as the keys.

Stripe's fees

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. Stripe keeps its fee when you refund. Other countries, cards and currencies have their own rates on Stripe's pricing page.

1. Keys

  1. Create a Stripe account at stripe.com and switch the Dashboard to Test mode (a sandbox) first.
  2. Open Developers → API keys and copy the Publishable key (pk_test_…) and the Secret key (sk_test_…).
  3. Paste them into Super-admin → Settings → Payments (Stripe), or into STRIPE_PUBLISHABLE_KEY and STRIPE_SECRET_KEY in .env. Use both test keys or both live keys, never one of each.

2. The webhook

  1. In Stripe, open Developers → Webhooks and add an endpoint (Stripe's newer dashboard calls it Add destination: choose events from Your account, then Webhook endpoint).
  2. Endpoint URL: your APP_URL followed by /api/v1/webhooks/stripe, for example https://shop.yourbrand.com/api/v1/webhooks/stripe. The Payments settings page shows the exact address to copy.
  3. Select these events: checkout.session.completed, checkout.session.async_payment_succeeded and checkout.session.expired.
  4. Copy the endpoint's Signing secret (whsec_…) into Super-admin → Settings → Payments (Stripe), or STRIPE_WEBHOOK_SECRET in .env. Without it, card orders would never be confirmed, and the setup check says so.

3. Payment methods

Stripe Checkout shows the payment methods you turn on in Stripe → Settings → Payment methods. Cards, Apple Pay and Google Pay suit grocery orders. Leave slow bank payments off: an unpaid checkout ends after about 30 minutes and the order is then cancelled, with its slot, coupon, wallet credit and stock released.

4. Test, then go live

  1. Press Test on the Stripe row of the setup check.
  2. In the shopper app, place an order with card payment and pay with Stripe's test card 4242 4242 4242 4242 (any future date, any CVC). The order appears on the store's live orders board within a second or two of the payment.
  3. Repeat steps 1 and 2 in live mode with your live keys and a live webhook endpoint, and save them.

Fees, cash and refunds

The same settings page holds three more choices:

SettingWhat it does
Service fee per orderA flat fee on every order (default $0.99), shown to shoppers as "Service fee" in the cart, at checkout and on the receipt. The platform keeps it. 0 hides the line.
Cash on deliveryOn or off for the whole platform. When it is on, each zone sets the most cash a driver may collect for one order, and each store can turn cash off for itself.
Refunds go toWhere automatic refunds of card orders go (missing items, refused swaps, the difference of a cheaper swap, cancelled orders): the shopper's wallet (at once, the default) or the card they paid with (5 to 10 days). A card refund Stripe refuses goes to the wallet instead, so the shopper never loses money. In the refund dialog of an order you can pick the other each time.
Test checkout without Stripe

DEMO_PAYMENTS="true" in .env turns on a test checkout page that pays with 4242 4242 4242 4242 and declines 4000 0000 0000 0002, without Stripe. It is "false" in the shipped file. Use it only on a private test copy, never on a live site.

How payments stay right

An order paid by card waits as "waiting for payment" until Stripe's signed webhook confirms it; only then do the store and the drivers see it. Each Stripe event is applied once, so Stripe's retries never double anything. Every refund goes to Stripe with its own idempotency key, so a refund is never paid twice, even when a call is retried. When Stripe cannot be reached, the webhook answers so that Stripe tries again later.

Licence

Taking orders and payments from shoppers through Basketrun requires the Envato Extended Licence. The Regular Licence covers a single product whose end users are not charged.

Settings → Payments (Stripe): keys, the webhook address, the service fee, cash on delivery and where refunds go
Settings → Payments (Stripe): keys, the webhook address, the service fee, cash on delivery and where refunds go

9Email (SMTP)

Basketrun sends password reset links, invitations for store teams and drivers, answers to store applications, document requests, store suspension notices and the stores' daily summaries and low-stock emails.

  1. Get SMTP details from any email provider (Amazon SES, Postmark, Brevo, Mailgun, your own mail server…): host, port, user name, password and a sender address on a domain you have verified with that provider.
  2. Enter them in Super-admin → Settings → Email (SMTP), or the SMTP_* keys in .env. Use starttls on port 587, tls on port 465.
  3. Press Send a test email on that page, or Test on the Email row of the setup check.

Without SMTP, each email is written to the app's log with its link (docker compose logs app), which is enough for testing. The same page lets you reword the platform emails (password reset, invitation, store suspended), with placeholders such as {{name}}, {{store}} and {{brand}} filled in for each email.

Email costs

Email providers are third-party services with their own pricing, and you pay them: Amazon SES, for example, charges $0.10 per 1,000 emails, and most other providers sell monthly plans with a small free tier.

10File storage

Product photos, store pictures and logos, profile pictures, delivery photos, store application documents and your platform 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_ID and S3_SECRET_ACCESS_KEY in .env, or enter them in Super-admin → Settings → Storage. Keep the bucket private. For AWS S3 leave S3_ENDPOINT empty; for R2 use your account's S3 address and region auto.
  • A local folder: STORAGE_DRIVER=local keeps files in the app-storage Docker volume. Fine for one server.

The Storage page also sets how much room each store gets (default 2,048 MB) and each shopper or driver (default 50 MB), 0 for no limit, shows what is stored and has a Test storage button. Uploads are checked by their content, not their name: photos are JPG, PNG or WebP of at most 5 MB, documents are PDF and lists are CSV of at most 20 MB.

Storage costs

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.

11Maps

Maps show up in many places: the shopper's address pin and tracking map, the store and driver apps, the zone editor and the live map in the super-admin, and the store settings. Address search ("Find your city", typing an address in the shopper app) goes through your server, which asks the map provider and keeps every answer for 30 days. You pick one provider for all of it in Super-admin → Settings → Maps (or MAP_PROVIDER in .env).

ProviderCostKeyGood for
OpenStreetMap (osm, the default)FreeNoneTrying it, the sample city and a small city. Public tiles and the Nominatim address search under the OpenStreetMap fair-use policies: light use only, one address search a second at most. A busy marketplace should move to MapTiler or Google, or run its own tile server.
MapTiler (maptiler)Free plan for testing; paid plans from about $25 a monthOne MapTiler keyThe same OpenStreetMap-based maps with a provider that allows commercial traffic. Tiles in the apps and the web pages, and address search on the server, all use the key.
Google Maps (google)Map loads in the apps free; address search 10,000 a month free, then $5 per 1,000A server key, an Android key and an iOS keyGoogle's own maps in the phone apps and Google's address search. The web pages keep OpenStreetMap or MapTiler tiles. Google needs a billing account.

MapTiler

  1. Sign up at cloud.maptiler.com, then open Account → Keys and copy your key (or create one per app).
  2. Paste it into Super-admin → Settings → Maps (provider MapTiler) or set MAP_PROVIDER=maptiler and MAPTILER_KEY in .env. The apps read the server's choice and key when they start, so they need no rebuild; you can also set MAP_PROVIDER and MAPTILER_KEY in the app .env to fix them at build time.
  3. The key ships inside the apps and the web pages, so anyone can read it. Watch its use on your MapTiler account page. If you limit the key in MapTiler's settings, check afterwards that the apps and the address search still work: they call MapTiler from the phone and from your server, not from a browser.

Google Maps

  1. In the Google Cloud console, create a project, add a billing account and turn on the Maps SDK for Android, the Maps SDK for iOS and the Geocoding API.
  2. Make three API keys under APIs & Services → Credentials:
    • Server key: API restriction Geocoding API, application restriction the IP address of your server. Paste it into Super-admin → Settings → Maps (provider Google) or GOOGLE_MAPS_KEY in .env.
    • Android key: Maps SDK for Android, restricted to Android apps with your three application ids and their SHA-1 signing fingerprints (Google Play shows the fingerprint of its app signing key under Setup → App signing). Put it in the app .env as GOOGLE_MAPS_ANDROID_KEY.
    • iOS key: Maps SDK for iOS, restricted to iOS apps with your three bundle ids. Put it in the app .env as GOOGLE_MAPS_IOS_KEY.
  3. Set MAP_PROVIDER=google in the app .env too, and rebuild the apps: Google's mobile SDKs read their key when the app is built. An app built without its Google key draws OpenStreetMap instead.
Map costs

MapTiler and Google Maps Platform are third-party services with their own pricing, and you pay them. Check MapTiler's pricing page and Google's Maps Platform price list before you choose; both change their plans from time to time. OpenStreetMap's public servers are free but run by volunteers, so respect their usage policy.

Settings → Maps: OpenStreetMap, MapTiler or Google Maps, with what each costs
Settings → Maps: OpenStreetMap, MapTiler or Google Maps, with what each costs

12Push notifications (your own Firebase project)

Push notifications reach a locked phone: a new order rings in the store app, a job offer rings in the driver app, and shoppers hear when the store accepted, a swap needs an answer, the driver is close and the order is delivered. They go through Firebase Cloud Messaging in your own Firebase project, which is free. Without it, the apps still show every update live while they are open, and the in-app notification list still fills.

There are two halves: the apps need your project's ids (so each phone can get a push token), and the server needs a service account key (so it can send). One Firebase project serves all three apps.

Firebase costs

Firebase is a third-party service run by Google with its own pricing, and you are responsible for any Firebase costs. Cloud Messaging has no charge per message; other Firebase products you turn on yourself may be billed under Google's plans.

1. Create the Firebase project

  1. Open the Firebase console, choose Create a project, name it after your marketplace and finish (Google Analytics is not needed).
  2. For iOS: in Firebase → Project settings → Cloud Messaging → Apple app configuration, upload an APNs authentication key (.p8). Make it in your Apple Developer account under Certificates, Identifiers & Profiles → Keys with "Apple Push Notifications service" ticked, and note its Key ID and your Team ID. One key serves all three apps.

2. Register the three apps with flutterfire configure

Install the tools once: the Firebase CLI (npm install -g firebase-tools, then firebase login) and the FlutterFire CLI (dart pub global activate flutterfire_cli). Then, in basketrun_mobile_flutter/, run it once per app, with your own project id and the ids your apps use (chapter 16):

flutterfire configure --project=your-firebase-project --platforms=android,ios \
  --android-package-name=com.basketrun.shopper --ios-bundle-id=com.basketrun.shopper \
  --android-out=android/app/src/shopper/google-services.json \
  --ios-out=ios/config/shopper/GoogleService-Info.plist \
  --out=lib/firebase_options_shopper.dart --yes

# the same for the store app (com.basketrun.store, folders store/) and the driver app (com.basketrun.driver, driver/)

Each run registers the Android and iOS app in your project, writes the two config files into that flavour's own folder (the placeholders shipped there are replaced) and writes a lib/firebase_options_<app>.dart file with the values for the next step. You can also add the apps by hand in Firebase → Project settings → Add app and download the two files into the same folders.

3. Put the ids in each app's .env

The apps start Firebase from the FIREBASE_* keys of the .env they are built with. Each of the three apps has its own Firebase app ids, so keep one settings file per app, for example .env.shopper, .env.store and .env.driver (copies of .env.example), and copy the values from that app's firebase_options_<app>.dart:

Key in the app .envWhere the value is
FIREBASE_API_KEYapiKey of the android options (current_key in google-services.json). The iOS options' key also works for an iOS-only build.
FIREBASE_PROJECT_IDprojectId
FIREBASE_MESSAGING_SENDER_IDmessagingSenderId
FIREBASE_ANDROID_APP_IDappId of the android options (1:…:android:…)
FIREBASE_IOS_APP_IDappId of the ios options (1:…:ios:…)
FIREBASE_IOS_BUNDLE_IDiosBundleId
FIREBASE_STORAGE_BUCKETstorageBucket (optional)

Then build each app with its own file, for example flutter run --flavor store --dart-define-from-file=.env.store. The generated firebase_options_*.dart files are not used by the app; delete them once the values are copied, or keep them for reference. The app's account page shows "Push: not set up" until the keys are there.

4. The service account for the server

  1. In Firebase → Project settings → Service accounts, choose Generate new private key. A JSON file downloads. Anyone with it can send pushes as your project, so keep it safe.
  2. In Super-admin → Settings → Push (FCM), paste the file's text or press Upload the JSON file, then save. The page shows the project id it read; the key is stored encrypted and never shown again. (In .env instead: FCM_PROJECT_ID and FCM_SERVICE_ACCOUNT_JSON as one line of JSON.)
  3. The Push row of the setup check turns green.

5. Test it

Install the store app on a real phone (the iOS simulator does not get pushes), sign in as a picker, allow notifications and lock the phone. Place an order for that store from the shopper app: the store phone rings within a few seconds. (Settings → Push → Send a test push only checks the service account with Google; it sends no message.) Device tokens that Firebase reports as gone are removed by themselves.

Settings → Push (FCM): the Firebase service account, saved encrypted
Settings → Push (FCM): the Firebase service account, saved encrypted
Part 03

The mobile apps

The folder basketrun_mobile_flutter/ is one Flutter project that builds three separate apps: the shopper app, the store app for pickers and the driver app. Each is published on its own, under its own name and id, in your own Google Play and App Store accounts. They all talk to your Basketrun server.

13What you need

  • Flutter 3.35 or newer on the stable channel (Dart 3.9 or newer), from docs.flutter.dev. The apps are built and tested with Flutter 3.44. flutter doctor tells you what is still missing.
  • For Android: Android Studio with the Android SDK (the apps compile against API 36) and Java 17. The apps run on Android 7.0 (API 24) and newer.
  • For iOS: a Mac with a current Xcode from the Mac App Store and CocoaPods (brew install cocoapods). The apps run on iOS 15 and newer.
  • Your Basketrun server online at an https:// address (chapter 5), or a test copy on your computer for the emulator.
  • A real phone for the things a simulator cannot do: push notifications, the camera barcode scanner in the store app and the delivery photo in the driver app.

14Three apps from one codebase

Which app you get depends on the flavour you build: shopper, store or driver. Each flavour has its own name, id, link scheme and Firebase files, so the three apps can sit side by side on one phone.

AppFlavourName on the phoneAndroid application id and iOS bundle idLink schemeWho signs in
Shopper appshopperBasketruncom.basketrun.shopperbasketrun://Shoppers. They create their own account in the app, and can browse before signing in.
Store appstoreBasketrun Storecom.basketrun.storebasketrun-store://The team of a store: owners, managers and pickers, invited from the store panel.
Driver appdriverBasketrun Drivercom.basketrun.driverbasketrun-driver://Drivers you invite and approve in the super-admin.

Change the names and ids to your own before you publish (chapter 16). An account signs in only to its own app: a shopper who opens the driver app is told "This account is for the shopper app. Sign in there instead."

First run

  1. Open a terminal in basketrun_mobile_flutter/ and create the settings file:
    cp .env.example .env
  2. In .env, set API_BASE_URL to your server, for example https://shop.yourbrand.com (the Android emulator reaches a server on your own computer as http://10.0.2.2:8080).
  3. Fetch the packages and start an emulator, a simulator or a phone on USB:
    flutter pub get
    flutter devices
  4. Run the app you want:
    flutter run --flavor shopper --dart-define-from-file=.env
    flutter run --flavor store --dart-define-from-file=.env
    flutter run --flavor driver --dart-define-from-file=.env
    On iOS, Flutter picks the Xcode scheme of the same name (shopper, store, driver) and its build configurations, such as Debug-shopper. The first iOS run installs the CocoaPods by itself.
Always pass both

Every run and every build needs --flavor and --dart-define-from-file. The settings are built into the app; nothing reads a .env file on the phone. A build without a flavour (tests, the web preview) falls back to APP_ROLE in the .env, then to the shopper app.

Shopper app: sign in or create an account
Shopper app: sign in or create an account
Store app: for the store's team
Store app: for the store's team
Driver app: for invited drivers
Driver app: for invited drivers

15Every key in the app .env

These settings are built into each app with --dart-define-from-file. An empty value means "not set up": the feature turns itself off instead of failing. Never put a server secret here; everything in this file can be read out of the published app.

KeyWhat it does
API_BASE_URLYour Basketrun server, without /api/v1, for example https://shop.yourbrand.com. Required.
MAP_PROVIDERosm (OpenStreetMap, no key), maptiler or google. Empty: the app uses the provider the super-admin chose. A provider without its key falls back to OpenStreetMap, so a map always shows (chapter 11).
MAPTILER_KEYThe MapTiler key. Empty: the server's key from Settings → Maps.
GOOGLE_MAPS_ANDROID_KEY, GOOGLE_MAPS_IOS_KEYGoogle Maps keys for the Android and iOS builds. Google's SDKs read them when the app is built, so the server cannot send them.
FIREBASE_API_KEY, FIREBASE_PROJECT_ID, FIREBASE_MESSAGING_SENDER_ID, FIREBASE_ANDROID_APP_ID, FIREBASE_IOS_APP_ID, FIREBASE_IOS_BUNDLE_ID, FIREBASE_STORAGE_BUCKETYour Firebase project, for push notifications (chapter 12). The app ids differ per app, so keep one .env file per app. Empty: the app runs without push and shows "Push: not set up".
DEMO_LOGINStrue shows the one-click demo sign-ins on the sign-in page, but only when the server is in demo mode too. Keep false for every build you publish.
SUPPORT_EMAILThe email address shown in Help. Empty hides it.
APP_ROLEOnly for builds without --flavor (tests, the web preview): shopper, store or driver.
SAMPLE_DATAtrue turns on sample mode: the app answers every call from its own built-in Lakeport data and needs no server. Keep false for every build you publish.
SAMPLE_SCENESample mode only: the moment of the story the app opens on: cart, store_closed, placed, picking, swap, ready, on_the_way, delivered, cash_job or missed_offer. Empty: each app's own start.

Sample mode

Sample mode is for changing the look of the apps without a server: every screen fills from the built-in sample city, orders move on by themselves, and errors can be shown on purpose. Try it with:

flutter run --flavor shopper --dart-define-from-file=.env --dart-define=SAMPLE_DATA=true --dart-define=SAMPLE_SCENE=swap

Nothing you do in sample mode reaches a server, and the data starts fresh at every launch.

One-click demo sign-ins off for a live store

The demo sign-in cards need two switches: DEMO_MODE=true on the server and DEMO_LOGINS=true in the app. A live marketplace has both off, so its sign-in page shows only email and password. Keep a separate .env for a demo build if you want one; never publish it.

16Make the apps yours

Decide the ids before the first upload

Google Play and the App Store know each app by its application id or bundle id. Once an app is published, its id can never change; a new id is a new app. Pick ids on a domain you own, for example com.yourbrand.shopper, com.yourbrand.store and com.yourbrand.driver.

The quick way: one command

tools/rename.mjs renames and rebrands the three apps and the web app's defaults in one go. Commit or back up your copy first, then run it from the kit folder (the one that holds basketrun_mobile_flutter and apps). It needs Node.js (chapter 2) and, when you give it icons, Flutter.

node tools/rename.mjs --name "FreshCart" --id com.acme.freshcart --dry       # only shows what would change
node tools/rename.mjs --name "FreshCart" --id com.acme.freshcart --color "#2563EB" --icon icon.png --icon-bg "#2563EB"
OptionWhat it does
--nameThe brand people see. Replaces every "Basketrun" in text: the app names ("FreshCart", "FreshCart Store", "FreshCart Driver"), the emails, the starter legal pages and the web app's default name. Letters, digits, spaces, dots and hyphens, up to 30 characters.
--idThe base of the three app ids, in reverse-domain form and lower case: com.acme.freshcart gives com.acme.freshcart.shopper, .store and .driver, on Android, on iOS and in the Firebase placeholder files. Set it before the first store upload.
--schemeOptional. The apps' link schemes: freshcart://, freshcart-store:// and freshcart-driver://, also on the web page that brings shoppers back from Stripe. By default the name in lower case without spaces.
--colorOptional. The brand colour (hex) of the apps' theme and of the web app's default; the lighter and darker tints are worked out for you.
--iconOptional. A square PNG of at least 1024 px with no transparency: the icon of all three apps, or of the shopper app when the next two are given too. The script copies it to basketrun_mobile_flutter/assets/icon/ and runs dart run flutter_launcher_icons for you.
--store-icon, --driver-iconOptional. Their own icons for the store app and the driver app.
--icon-bgOptional. The colour behind the icon on Android 8 and newer, which masks icons to round or other shapes: use your icon's own background colour.
--dryShows what would change and writes nothing.

Folder, package and database names (basketrun_mobile_flutter, basketrun-server, POSTGRES_DB) stay as they are: nobody sees them. The script is safe to run again with new values; it reads the current ones from the project first. After renaming:

  1. Register the three new ids in your Firebase project, replace each app's google-services.json and GoogleService-Info.plist, and copy the new app ids into each app's .env (chapter 12). If you use Google Maps, add the new ids to your key restrictions (chapter 11).
  2. Rebuild the server and web app: docker compose up -d --build. The web app's name, logo and colour can still change at any time in Super-admin → Settings → Branding.
  3. Build the apps again (chapter 17).

By hand: names, ids and link schemes on Android

The script does everything below for you. To change one thing yourself, this is where it lives.

All three are in basketrun_mobile_flutter/android/app/build.gradle.kts:

// The three apps. Each flavour has its own id, name and (optional) src/<flavour>/google-services.json.
val apps = mapOf(
    "shopper" to Pair("com.yourbrand.shopper", "YourBrand"),
    "store" to Pair("com.yourbrand.store", "YourBrand Store"),
    "driver" to Pair("com.yourbrand.driver", "YourBrand Driver"),
)

// Each app's deep-link scheme (yourbrand://order/<id> is the shopper's way back from Stripe Checkout).
val urlSchemes = mapOf("shopper" to "yourbrand", "store" to "yourbrand-store", "driver" to "yourbrand-driver")

Also change applicationId in defaultConfig to the shopper id. The namespace (com.basketrun) is the code's package name, not the app's id; it may stay.

By hand: names, ids and link schemes on iOS

  1. Open basketrun_mobile_flutter/ios/Runner.xcworkspace in Xcode and select the Runner target, then Build Settings.
  2. Search for PRODUCT_BUNDLE_IDENTIFIER, APP_DISPLAY_NAME and APP_URL_SCHEME. Each has one value per build configuration: Debug-shopper, Release-shopper, Profile-shopper, and the same for store and driver. Set the shopper values on the three shopper configurations, and so on.
  3. Under Signing & Capabilities, choose your Apple team. Keep the Push Notifications and Background Modes → Remote notifications capabilities.

By hand: names inside the apps

The name shown inside each app comes from lib/core/constants/app_role.dart ('Basketrun', 'Basketrun Store', 'Basketrun Driver'). A few on-screen texts name the brand too (the receipt, sharing a product, the camera and location prompts, help texts): search the lib/ folder for Basketrun and change them. On iOS, the permission prompts are in ios/Runner/Info.plist (NSCameraUsageDescription, NSLocationWhenInUseUsageDescription, NSPhotoLibraryUsageDescription).

After changing ids, update Firebase (register the new ids and replace the config files, chapter 12) and your Google Maps key restrictions.

Logo and app icons

  • App icons: each app has its own icon: a basket on green for the shopper app, a basket under a shop awning on cream for the store app and a basket with motion lines on charcoal for the driver app. The sources are basketrun_mobile_flutter/assets/icon/shopper.png, store.png and driver.png (1024 px, no transparency). To change one by hand, replace its picture, set adaptive_icon_background (the colour behind it on Android 8 and newer) in that app's flutter_launcher_icons-<app>.yaml, and run dart run flutter_launcher_icons in basketrun_mobile_flutter. It writes Android's icons to android/app/src/<app>/res/ and the iOS icon sets AppIcon-shopper, AppIcon-store and AppIcon-driver, which each app's build configurations already select. Keep the artwork inside the middle 60% so Android's round and shaped masks don't cut it.
  • The mark inside the apps (splash, sign-in) is drawn in code in lib/features/common/auth/widgets/basket_mark.dart. The launch screens are android/app/src/main/res/drawable/launch_background.xml and ios/Runner/Base.lproj/LaunchScreen.storyboard.

By hand: colours and fonts

The whole look is one file: lib/core/theme/app_theme.dart. Every screen reads its colours from there, never a fixed value.

  • Brand colour: change brand, brandSoft, brandInk and brandHalo in AppColors.light and AppColors.dark, and FixedColors.brand (splash and notification tint). Basketrun ships green #0F8A4F.
  • Express colour: zest and its family (yellow #FFC93C) mark Express and arrival times only.
  • Font: the apps use Figtree, bundled in assets/fonts/ (SIL Open Font License). To use another font, add its files there, list them under fonts: in pubspec.yaml and set AppText.family in the theme file.

The web app has its own colours; most of it follows Super-admin → Settings → Branding without a rebuild (chapter 27).

  • Back from Stripe: after paying (or cancelling), Stripe sends the shopper to APP_URL/pay/return?order=…. That page says how the payment went and has an Open the app button for basketrun://order/<id> (basketrun://wallet after a top-up), with a plain line for when the app does not open. The app also reloads the order when it comes back to the front. The rename script changes the scheme there too; by hand, change it in apps/frontend/src/pages/public/states/PayReturn.tsx, then rebuild the server.
  • Notifications: tapping a push opens the right screen (the order, the offer, the new order).
  • Links out: the apps open phone calls, email, Google Maps and Apple Maps (driver navigation) and web pages.

17Build release files

Use one settings file per app (for example .env.shopper) with API_BASE_URL on your live server, DEMO_LOGINS=false and SAMPLE_DATA=false. The version shown in the stores is version: 1.0.0+1 in pubspec.yaml: the part after + is the build number, which must go up with every upload (or pass --build-number=2).

Android: sign, then build

  1. Make an upload key once (keep the file and its passwords safe and backed up; one key can sign all three apps):
    keytool -genkey -v -keystore ~/upload-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias upload
  2. Create basketrun_mobile_flutter/android/key.properties (it is ignored by Git and never shipped):
    storePassword=the-store-password
    keyPassword=the-key-password
    keyAlias=upload
    storeFile=/full/path/to/upload-keystore.jks
    Without this file, release builds are signed with the debug key, which the stores refuse.
  3. Build an App Bundle for Google Play, or an APK to install by hand:
    flutter build appbundle --flavor shopper --dart-define-from-file=.env.shopper
    flutter build apk --flavor shopper --dart-define-from-file=.env.shopper
    The files land in build/app/outputs/bundle/shopperRelease/app-shopper-release.aab and build/app/outputs/flutter-apk/app-shopper-release.apk. Repeat with store and driver.

iOS: archive and upload

  1. In your Apple Developer account, under Certificates, Identifiers & Profiles → Identifiers, register the three bundle ids with the Push Notifications capability. Xcode can do this for you with automatic signing.
  2. In App Store Connect, create the three apps (My Apps → + → New App) with those bundle ids.
  3. Build the archive and the IPA:
    flutter build ipa --flavor shopper --dart-define-from-file=.env.shopper
    The IPA lands in build/ios/ipa/. Upload it with Apple's Transporter app, or open build/ios/archive/Runner.xcarchive in Xcode and choose Distribute App. Repeat with store and driver.

18Publish the three apps

Each app is published separately, under your own developer accounts and your own brand. Basketrun's demo names, ids and screenshots are not yours to publish.

Google Play

  1. In the Play Console, choose Create app three times (one per app).
  2. Fill in the store listing (name, descriptions, icon, screenshots), the content rating questionnaire, the target audience and the Data safety form. The apps use the location while open (address and driver position), the camera (barcode scan and delivery photo), photos the person picks, and name, email and phone for the account.
  3. Upload the .aab to Internal testing first, then a closed test. New personal developer accounts must run a closed test with at least 12 testers for 14 days before Google lets them publish to production.
  4. Let Google Play sign the release (Play App Signing, the default) and add its SHA-1 fingerprint to your Google Maps Android key if you use Google Maps.

App Store

  1. In App Store Connect, fill in each app's description, keywords, screenshots, support URL, privacy policy URL (your legal page https://shop.yourbrand.com/legal/privacy) and the App Privacy answers.
  2. The store and driver apps have no sign-up: Apple's review needs a working account. Make a test store with a picker and an approved test driver, and give both sign-ins under App Review Information. Explain in the review notes that the three apps serve three different people (shoppers, store staff, drivers) of one marketplace.
  3. The shopper app lets people delete their account (Account → Delete account), as Apple requires for apps with sign-up.
  4. Submit each build for review.

Links to your apps

Once an app is live, paste its store addresses in Super-admin → Settings → App links: the App Store address (https://apps.apple.com/app/id…) and the Google Play address (https://play.google.com/store/apps/details?id=…) of each app. The public home page then shows the shopper app's App Store and Google Play badges, the store app on its "For stores" card and the driver app on "Apply to drive" (the shopper app's page while the driver app has none). An app with no address shows no badge, so leave the fields empty until the apps are published.

Part 04

Run the marketplace

Who uses what: you and your staff use the super-admin on the web (/platform); store owners and managers use the store panel on the web (/app) and can also use the store app; pickers use the store app; drivers use the driver app; shoppers use the shopper app. Everyone signs in at /signin on the web, or in their app.

19How an order works

The rules below are checked by the server, so the apps and the web pages can never get around them. Each later chapter shows where they appear.

  1. Address and zone. The shopper sets a delivery address on the map. It is served when its point lies inside one of your zones. Outside every zone, the app offers "Tell me when you deliver here" and adds the shopper's email to your waitlist.
  2. One store per cart. The shopper picks a store that delivers to the zone and adds items. Adding an item from another store asks to start a new cart. For every item the shopper chooses what the picker does if it is out of stock: best match (the closest item on the shelf), a specific product they pick ahead, or refund me.
  3. Express or a slot. Express is offered when the zone and the store allow it and the store is open now. Its time range is the store's picking time plus the ride (counted at 18 km/h), kept within the zone's fastest and slowest promise. Otherwise the shopper picks a scheduled slot: today and the next six days, inside the store's opening hours, with a set number of orders per store in each slot. Booking a slot closes a set number of minutes before it starts, and a full slot is refused.
  4. Checkout. The zone's minimum order applies; delivery is free over the zone's threshold. A coupon, a tip and the platform's service fee are added. The shopper pays by card (Stripe Checkout), cash on delivery (if the platform, the zone and the store allow it, up to the zone's cash limit) or with wallet credit, which can cover part or all of it.
  5. Paid, then placed. A card order waits until Stripe confirms the payment; unpaid after about 30 minutes, it is cancelled and its slot, coupon, wallet credit and stock are released. Cash and wallet orders are placed at once.
  6. The store answers. The new order rings in the store app and on the store panel's board. The store accepts or declines; declining cancels the order and gives back any money paid. An express order nobody answers within 2 minutes is declined by itself, and the shopper is told where the money went. The shopper can cancel for free until the store accepts.
  7. A driver is found. For express orders as soon as the store accepts, for scheduled orders 30 minutes before the slot. The job is offered to the nearest online, approved, free driver of the zone for 30 seconds; declined or missed, it goes to the next driver.
  8. Picking and swaps. The picker scans each item. When an item is missing, the picker proposes a swap or marks it to refund. The shopper has 5 minutes to approve or refuse a swap; with no answer, their choice decides (best match or specific: approved; refund me: refused). Until the order is packed, the shopper can still add items.
  9. Packed and handed over. The picker marks the order ready with the number of bags and the shelf. The driver arrives, checks the bags and the store hands them over: the order is on its way, with the driver on the shopper's map.
  10. Delivered. The driver proves the delivery with the shopper's 4-digit delivery code or a photo, and on a cash order confirms the cash taken. The shopper can then rate the store and the driver, once per order.
A swap never costs the shopper more

The shopper pays the lower of the two prices. A cheaper swap gives the difference back at once; a refused swap or a missing item gives the whole line back.

Refunds go to the wallet

Missing items, refused swaps, the difference of cheaper swaps and cancelled paid orders are refunded to the shopper's wallet at once (or to the card, if you choose that in Settings, chapter 8). The wallet only ever gets money from refunds and from top-ups the shopper paid by card ($5 to $200). It can never go below zero, and its credit is spent only on orders: it cannot be paid out.

Who earns what on a delivered order

PartyWhat they get
Shopper paysItems at their deal prices − coupon + delivery fee (free over the zone's threshold) + service fee + tip.
Store earnsIts item sales − the commission (default 15%, set per store) − refunds of its items. Delivery fees and tips never count as store sales.
Driver earnsThe zone's driver pay per trip + 100% of the tip.
Platform keepsCommission + delivery fee + service fee − driver pay − coupon discount. Coupons are paid for by the platform.

On a cash order the driver holds the cash; the weekly payouts report takes it off what the driver is owed (chapter 26).

Order statuses

StatusMeaning
Waiting for paymentA card order whose Stripe payment is not confirmed yet. Only the shopper sees it.
NewPlaced and paid (or cash); waiting for the store to accept.
AcceptedThe store took it; picking has not started.
PickingA picker is filling the bags.
ReadyPacked, waiting for the driver.
On the wayThe driver has the bags.
DeliveredProved by code or photo.
CancelledBy the shopper (before the store accepted), the store (declined), you, or because the card was never paid. Money paid comes back.

Every change is pushed live to the shopper, the store and the driver, and sends a push notification where it matters.

20Super-admin

The super-admin is your side of the marketplace, under /platform. The install wizard makes you its first admin.

Overview

Orders, sales (GMV) and commission today, drivers online, the live orders, the late orders (running past their promised time), new store applications, today's figures per store and a needs attention list: applications to review, drivers waiting for approval, documents missing, failed background jobs and setup rows that need a look. The sidebar shows the count of applications, drivers waiting and late orders.

People

Everyone who can sign in: shoppers, drivers and store staff, with their stores and roles. From a person's menu you can:

  • Make super-admin (can change every setting and store, and add other admins) or Make platform viewer (read-only: sees every store, shopper and driver, but changes nothing). Remove platform access takes it away again.
  • Make a driver or make a shopper: the person then signs in to the other app. Useful when someone who signed up in the shopper app wants to drive.
  • Suspend: they are signed out everywhere and cannot sign in until you restore them; their stores keep running.
People: shoppers, drivers and store staff, with platform roles
People: shoppers, drivers and store staff, with platform roles

21Zones and fees

A zone is an area on the map where you deliver, with its own fees and rules. Super-admin → Zones shows every zone on the map with its delivery fee, minimum order, stores and today's orders. Shoppers outside every zone can join the waitlist, which the same page shows under Outside every zone (with Export list), so you can see where to open next.

Draw a zone

  1. Choose New zone, name it and drag the corners over the streets you deliver to. A zone needs at least three corners; the page tells you whether it touches other zones. You can also paste GeoJSON (a Polygon, a Feature or a FeatureCollection; the first polygon is used).
  2. Set the fees and limits, express and slots below, and save. Changes apply to new orders; open orders keep the fee they were quoted.
SettingWhat it does
Delivery feeWhat the shopper pays for delivery in this zone.
Free delivery overOrders with items at or above this amount deliver free. Empty: never free. It cannot be lower than the minimum order.
Minimum orderThe smallest basket the zone accepts ($0 for none). The cart tells the shopper how much more to add.
Driver pay per tripWhat a driver earns for each delivery here, plus 100% of the tip.
Cash on deliveryNot allowed (card and wallet only), or allowed up to $50, $100 or $200 per order.
Express deliveryOn or off, with the fastest and slowest promise in minutes (for example 15 to 30).
Scheduled slotsThe slot length (30 minutes, 1 hour or 2 hours) and the orders per slot, per store. A store may lower its own number on short-staffed days.
Stores delivering hereThe stores that serve the zone, with Add a store.

Aisles

Aisles (Fruit and vegetables, Dairy and plant milk, Bakery…) are shared by every store: each product is filed under one, and they give the shopper app its aisle tiles and the pick list its order. A fresh install comes with ten standard aisles, the same ones the sample city uses. Super-admin → Aisles lists them in the order shoppers and pickers see them: add one, edit its name, its shorter pick-list name and its icon, move it up or down, or hide it. Deleting an aisle keeps its products, without an aisle, so move them to another aisle first.

Edit a zone: drag the corners, then set its fees, cash limit, express and slots
Edit a zone: drag the corners, then set its fees, cash limit, express and slots

22Stores and applications

Super-admin → Stores lists every store with its owner, zone, type, rating and this week's sales, commission and what is owed to it, with tabs for applications and suspended stores.

How a store joins

  • It applies. The public page /sell ("Sell with us") takes the store's name, type, address, phone, website, the contact person, how they sell today, roughly how many products, their opening hours and their documents (licence and permit). The application shows under Applications. Open it to see the details and documents, then:
    • Approve: choose the commission (the platform default is filled in) and the zone. This creates the store and its owner's account and emails the owner a sign-in link to the store panel that works for 7 days.
    • Ask for documents: the applicant gets an email asking for what is missing and can reply for 30 days.
    • Decline: with a reason of at least a sentence, which is emailed to the applicant.
  • You add it. Add a store takes the store's name, type, street address, zone, the owner's name, email and phone, and the commission, and emails the owner a sign-in link.
  • It signs up on the web. Only while Settings → Sign-ups is open: each sign-up at /signup creates a store straight away. For a marketplace where you check every store, set Sign-ups to closed and let stores apply on /sell instead.

Shoppers see a store once it is approved and has at least one product shown in the app. Before that, its owner should add the opening hours and invite a picker, or orders arrive with nobody to pick them.

A store's sheet

  • Commission on item sales: this store's own rate, replacing the platform default. It applies to orders placed after you save.
  • Payout schedule (weekly, every two weeks or monthly, on Fridays) and the bank account the store entered.
  • The owner, address, zones, catalogue size, rating, team, documents and its last four weeks of payouts.
  • Open as owner: a 30-minute session as the store's owner, to see exactly what they see when they ask for help. A banner with an Exit button stays on screen.
  • Suspend with a reason the owner sees (for example "food permit expired"). Shoppers stop seeing the store at once; open orders still finish and are paid out as normal. Restore brings it back.
Stores with this week's sales, commission and what is owed
Stores with this week's sales, commission and what is owed
A store application with its documents: approve, ask for documents or decline
A store application with its documents: approve, ask for documents or decline

23Drivers

Super-admin → Drivers shows who delivers and what each driver is doing now: online and waiting for an offer, heading to a store, delivering, or late. Tabs: online now, approved, waiting for approval and suspended, with filters for zone and vehicle, and the cash each driver holds.

Add a driver

  1. Invite a driver with their email (and their zone). They get an email with a link to choose a password (it works for 7 days) and an account that waits for your approval. Someone who already has a shopper account can instead be switched in People → Make a driver.
  2. Open the driver's sheet when their documents are in. Ask for documents marks each missing one on their sheet and sends them an email and a notification.
  3. Approve them, and set their zone, vehicle and plate. Only approved drivers get offers. You can also reject an application.

Rules for drivers

  • A driver gets offers only while online in the driver app and seen in the last 15 minutes, in their own zone, with no other offer or job.
  • Each offer lasts 30 seconds. A driver who declines or lets it run out is not asked about that order again for 3 minutes; it goes to the next nearest driver.
  • A driver can hand a job back before picking up the bags; it goes back to dispatch and counts against their acceptance, which the sheet shows over 30 days with their recent trips.
  • Suspend: the driver goes offline at once and gets no more offers. A job not picked up yet goes back to dispatch; an order already in their car stays with them until it is delivered.
Drivers: online, delivering, waiting for approval, and the cash each one holds
Drivers: online, delivering, waiting for approval, and the cash each one holds

24Orders, refunds and customers

Orders

Super-admin → Orders holds every order across the stores, with tabs for today, open, late, delivered and cancelled, filters for store, zone, payment and date, search by order number, shopper or phone, and CSV export. Late orders are tinted red. The order sheet shows the lines and swaps, the money, the shopper, the driver, the card, the zone and each step with its time.

  • Cancel any order that is not delivered yet, with a reason. Money paid goes back.
  • Refund: tick the lines to refund (with a reason) and, if you like, the delivery fee, then choose to the wallet (at once; they can spend it on their next order) or to the card (Stripe sends it back in 5 to 10 working days).
How a card refund stays safe

The refund is marked first, then Stripe is asked. If Stripe refuses, nothing changes and you can try again or refund to the wallet instead. If Stripe cannot be reached, the refund stays marked and is sent again by itself with the same key, so it is never paid twice.

Customers

Super-admin → Customers lists every shopper with their orders, spend, last order, zone and wallet credit, with tabs for this month, this week and blocked. Block a shopper with a reason kept on their record (for example "2 chargebacks"): they are signed out everywhere and cannot place new orders; orders already placed still finish.

Every order across the stores, with late orders tinted red
Every order across the stores, with late orders tinted red
Refund lines and the delivery fee to the wallet or the card
Refund lines and the delivery fee to the wallet or the card

25Coupons

A coupon gives shoppers money off at checkout. The platform pays for it: the store still earns its full item sales. Super-admin → Coupons lists them with tabs for active, paused and ended, and this month's uses, discount given and the codes turned away at checkout with the top reason.

FieldWhat it does
CodeLetters and numbers, 4 to 16 long. Shoppers type it at checkout; capitals don't matter.
DiscountPercent off the items (with an optional "up to" cap), amount off the items (never more than the items), or free delivery.
Minimum orderItems only, before delivery and tip. Below it, the shopper is told how much more to add ("Add $4.20 more to use SAVE5").
Starts and EndsEmpty start: usable at once. Empty end: no end date. The end is 23:59 in the platform's time zone.
Total uses and Uses per shopperEmpty total: no limit.
First order onlyOnly for shoppers with no paid or delivered order yet.
Works atEvery store, or only the stores you pick.

The server checks every rule again when the order is placed, so two shoppers using the last use at once cannot both get it. A cancelled order gives its coupon use back. Deleting a coupon nobody used removes it; a coupon that was used is ended instead, so its history stays.

Coupons with this month's uses and what shoppers see when a code doesn't apply
Coupons with this month's uses and what shoppers see when a code doesn't apply

26Payouts

Super-admin → Payouts shows what the platform owes each store and each driver for a week (Monday to Sunday in the platform's time zone), paid on the Friday after it.

WhoHow the amount is worked out
Each storeIts delivered orders' item sales − the commission on them − item refunds = owed.
Each driverThe zone fees of their deliveries + all their tips − the cash they collected on cash orders = owed. Below zero, the driver holds more cash than they earned and owes the platform the difference.
  1. Pick the week. The cards show what is owed to stores and drivers, the commission kept and the cash drivers hold.
  2. Pay each store and driver yourself, for example by bank transfer to the account they entered.
  3. Tick the rows you paid and choose Mark as paid. Each row is recorded once per week; marking it again changes nothing. A driver's cash from a paid week no longer counts as held. For a driver who owes you, Mark as collected once they hand over the cash.
Basketrun does not move the money

Card payments land in your own Stripe account. The payouts report tells you who to pay and how much; the transfers to stores and drivers are yours to make.

The week's payouts: stores and drivers, with cash held and what is owed
The week's payouts: stores and drivers, with cash held and what is owed

27Settings and legal pages

Super-admin → Settings applies to every store, shopper and driver on the platform.

SectionWhat it sets
GeneralThe platform name, support email, currency, time zone and default commission, with a summary of payments and email.
Payments (Stripe)Stripe keys, the webhook, the service fee, cash on delivery and where refunds go (chapter 8).
MapsOpenStreetMap, MapTiler or Google Maps, and their keys (chapter 11).
Push (FCM)The Firebase service account (chapter 12).
Email (SMTP)The mail server, a test email and the wording of each platform email (chapter 9).
Legal pagesThe six legal pages (below).
Demo modeShows whether this server runs as a public demo. It is switched in .env only (chapter 35).
BrandingProduct name, logo (square PNG, SVG or WebP, at least 256 × 256, up to 1 MB; also the favicon), brand colour (buttons, links, focus borders; the app works out the lighter and darker shades), support email, Documentation URL and Support URL. They show in the web app, the emails, the public site and the browser tab without a rebuild. The phone apps keep the colours built into them (chapter 16).
StorageWhere files are kept, the room per store and per person, and a test (chapter 10).
Sign-upsWho can create a store on the web: open (anyone, each sign-up makes a store), invite (the sign-up page is hidden; people join only through a store's team invite) or closed. Shoppers always sign up in the shopper app; stores can always apply on /sell.
App linksThe App Store and Google Play addresses of your three apps, for the badges on the public home page (chapter 18).
MaintenanceShows the maintenance page with your message to everyone except super-admins; the background job counts and the last migration; and Remove demo data.

Legal pages

Six pages in Markdown, each with a live preview, shown at /legal/terms, /legal/privacy, /legal/cookies, /legal/refunds, /legal/store-terms and /legal/driver-terms, and linked from the public site, the sign-up pages and the apps. Starter texts for all six are in apps/backend/seed/legal/; loading the sample city puts them in for you, or paste each file into its tab. They are written for the sample city: replace "Basketrun" and "Lakeport" with your own names, and have them checked by a lawyer for your country. They are your agreement with your shoppers, stores and drivers.

Settings: general, payments, maps, push, email, legal, branding and more
Settings: general, payments, maps, push, email, legal, branding and more
Legal pages: Markdown with a live preview
Legal pages: Markdown with a live preview

28Store panel: overview and live orders

The store panel at /app is where a store's owner and managers run their store. Pickers use the store app instead. What each role may do:

CanPickerManagerOwner
Pick, scan, offer swapsYesYesYes
Accept orders, pause the storeIn the store appYesYes
Products, stock, CSV importNoYesYes
Hours, slots and expressNoYesYes
Reports and salesNoYesYes
Staff, store settings, payoutsNoNoYes

Overview

Today's orders and sales, the on-time rate, swaps approved, orders by hour, what is selling fast, the pickers on shift and a Needs you list (new orders, low stock).

Live orders

The board has four columns: New (each with its answer countdown), Picking, Ready (packed, waiting for the driver) and Out for delivery, with a filter for express or scheduled orders and a search. New orders play a chime and show a browser notice (each browser can mute it). Opening an order shows:

  • the delivery (express with its promised time, or the slot), the payment (card, wallet or cash to collect) and the timeline;
  • Accept or Decline (with a reason; the shopper is told and refunded);
  • the picker (change who picks it), the lines by aisle with swaps, a printable pick list;
  • Mark ready with the number of bags and the shelf, once every line is picked and no swap waits;
  • the driver, or "finding a driver" with how many were offered the job, and Find another driver before pickup.

A new express order must be answered within 2 minutes, which the countdown shows. With no answer it is declined by itself ("…didn't answer in time"), and the shopper's money goes back the usual way (wallet or card, as Settings → Payments says). Scheduled orders wait for an answer. Express orders are offered to drivers when the store accepts; scheduled orders 30 minutes before their slot.

The store overview: today's orders, sales, on-time rate and pickers on shift
The store overview: today's orders, sales, on-time rate and pickers on shift
An order on the board: lines by aisle, swaps, picker and driver
An order on the board: lines by aisle, swaps, picker and driver

29Store panel: catalogue, CSV import and stock

Products

Products holds everything shoppers can order, with tabs (all, low stock, out of stock, hidden), an aisle filter and a search by name or barcode. Add products one by one, import a spreadsheet, or export from a till (Square, Clover or Lightspeed) and import that. Each product has:

FieldWhat it does
Name, unit label, aisle, descriptionWhat the shopper sees. The unit label shows under the name ("12 large eggs", "1 lb").
Price and Was priceFill the was price (higher than the price) to show the item as on sale.
Sold by weightA price per pound; the picker types the weight at the shelf.
BarcodeEAN-13, UPC-A or a PLU. Pickers scan it to confirm the item.
Track stock, In stock, Warn me atThe count on the shelf and the level that puts it under Needs you. Off: always shown in stock; pickers mark it missing if the shelf is empty.
Allow swapsWhen it runs out, pickers may offer a similar item. The shopper approves, and never pays more.
Show in the appOff hides it from search and the aisle; open orders keep it.
Product photoJPG, PNG or WebP, up to 5 MB.

Import a spreadsheet (CSV)

Catalogue → Import updates prices and stock, or adds new products, from a CSV file (from Excel: Save as → CSV; files with ; between cells are read too). Up to 5,000 rows and 5 MB a file. Nothing changes until you press Import.

  1. Upload the file. The columns are matched by their header: name, unit, aisle, price, was_price, qty, upc and photo_url, and their usual names in tills and spreadsheets (product, category, retail_price, stock, barcode, ean, plu, image…). Change any match by hand.
  2. Check the file. Every row is checked: a name, a price, an aisle that is one of the aisles, a stock count that is a whole number of 0 or more, a was price above the price, and no barcode used twice. Rows that need a fix are listed with the reason; Download the rows gives them back as a CSV with a what_is_wrong column to fix and upload again.
  3. How rows match: a row is the same product when it has the same barcode, else the same name in the same aisle. Matches are updated (the page counts the price changes); the rest are added.
  4. Two options: Hide products that aren't in the file (shoppers stop seeing them until you show them again) and Set stock to 0 for rows with qty 0 (off: a qty of 0 leaves the stock as it is).

A starting file looks like this:

name,unit,aisle,price,was_price,qty,upc,photo_url
"Large brown eggs, 12 pcs",12 large eggs,Dairy and plant milk,4.29,4.99,24,072745060124,
Bananas,"bunch, about 1.1 kg",Fruit and vegetables,1.69,,64,PLU 4011,

Stock

Stock lists every product with its count, what sold in 7 days and whether it needs restocking. Type the new count and save; shoppers see it at once. The stock rules: Lower stock when an order is picked, Hide items at 0 (off: they stay in the app marked Out, and shoppers can pick a swap ahead) and a low-stock email at 7:00 to the owner and managers with the restock list. The page also lists today's swaps from empty shelves.

The catalogue with aisles, prices, stock and what is shown in the app
The catalogue with aisles, prices, stock and what is shown in the app
Import: every row checked before anything changes
Import: every row checked before anything changes
Stock: counts, what sold this week and what needs a restock
Stock: counts, what sold this week and what needs a restock

30Store panel: hours, team, reports and settings

Hours and slots

Shoppers can order while the store is open. Express needs the store open now; scheduled slots are made from these hours.

  • Opening hours for each day of the week, or closed all day.
  • Holidays and special hours: a name and a date, closed all day or other hours, with express on or off that day.
  • Taking orders: Accepting orders (off: the app shows the store as closed until it is turned back on) and Cash on delivery (off: card or wallet only).
  • Express delivery: on or off, the time to pick an average order (added to the drive time for the time the app shows) and pause express when this many wait (shoppers then see slots only; 0 never pauses).
  • Slots: stop booking before a slot (pickers need time to pick before the driver comes) and the orders per slot for each zone, up to the zone's own limit, with how full the coming slots are.

Staff

Staff lists who works in the store, who is on shift now, orders picked today, the average pick time and swaps offered today. Invite someone by email as a manager or a picker (only the owner invites managers). Pickers get an email with a link to the store app; managers a link to this panel and the store app. Open invites show until they join, with resend and cancel. A store keeps at least one owner.

Reports

For this week so far, the last full week or the last 30 days: sales, orders, what the store keeps after commission and refunds, the on-time rate, sales by day, best sellers, the zones orders went to, refunds by reason, ratings and when the range is paid out.

Store settings

  • Store profile: name, type (shoppers filter by it), about text (up to 400 characters) and the cover photo shown on the store page in the app (wide, at least 1200 × 600).
  • Location and pickup: the address and its pin on the map (drag it if drivers end up at the wrong door; a change asks the platform to check the zone), the store's time zone (opening hours, slots and reports follow it), the phone for drivers and support, and pickup notes for drivers.
  • Orders and payments: accept cash on delivery (up to the zone's limit), pickers may offer swaps (off: a missing item is refunded, never swapped) and ask before accepting big orders (orders over an amount ring for a manager to accept).
  • Notifications: ring for new orders, a daily summary email after closing, the low-stock email.
  • Bank and payouts: the bank account, the commission, the next payout and what was paid.
  • Pause or close: pause new orders, or close the store for good (type its name to confirm). Shoppers can no longer order; open orders still finish; the team loses access; sales history is kept for 7 years and photos and files are removed after 30 days.
  • Your profile: name, picture and password (changing it signs you out everywhere else).
Hours and slots: opening hours, express, slot cut-off and orders per slot
Hours and slots: opening hours, express, slot cut-off and orders per slot
Staff: who is on shift, pick times and invites
Staff: who is on shift, pick times and invites
Reports: sales, what the store keeps, best sellers and ratings
Reports: sales, what the store keeps, best sellers and ratings
Store settings: profile, pickup, payments, notifications and payouts
Store settings: profile, pickup, payments, notifications and payouts

31Shopper app

  • Start: a welcome, then the delivery address: use the phone's location or search an address and set the pin. Outside every zone, the app offers the waitlist. Shoppers can browse without an account; adding to the cart asks them to sign in or sign up, then adds the item.
  • Home: the express banner, aisles, the stores that deliver to the address, deals, "buy again" and the order on its way.
  • Stores, aisles and search: a list and a map of stores with their rating, delivery time and fee; a store page with its aisles, deals, popular items and next slot; search across stores with recent and popular searches.
  • Product page: photos, price and deal, origin and storage, similar items, a heart to save it, and the swap to pick ahead.
  • Cart: one store at a time, each line with its swap choice, the minimum order, how far to free delivery, the coupons that work for the basket and the totals.
  • Checkout: the address, the delivery time (express or a slot), a coupon, a tip for the driver, a note for the picker and the payment: card (Stripe Checkout opens, then the app comes back), cash on delivery or wallet credit.
  • After ordering: live progress (accepted, items picked so far, packed), swap requests to approve, refuse or change with the 5-minute countdown, "add items" while the order is being picked, the driver on the map with the arrival time, the 4-digit delivery code to show the driver, a chat with the store and the driver (open until 2 hours after delivery), the receipt and the rating.
  • Account: orders with reorder, the wallet (balance, refunds and top-ups; top up $5 to $200 by card), saved addresses, notifications, the default swap choice, which updates send a push, and deleting the account (the password is asked; the account goes for good after 30 days).
Delivery address and zone check
Delivery address and zone check
A store with its aisles and deals
A store with its aisles and deals
A product with its swap picked ahead
A product with its swap picked ahead
The cart with swap choices
The cart with swap choices
Express or a scheduled slot
Express or a scheduled slot
A swap to approve: never more than ordered
A swap to approve: never more than ordered
The delivery code for the driver
The delivery code for the driver
The wallet: refunds and top-ups
The wallet: refunds and top-ups

32Store app (pickers)

  • Orders board: new orders that ring until someone answers (an express order within 2 minutes, or it is declined by itself), orders being picked, packed orders waiting for the driver and swaps waiting for the shopper. Pause new orders shows the store as busy to shoppers; orders already taken stay on the board.
  • New order: the items, the delivery (express or the slot) and the pick-by time, with Accept order or decline (with a short note for the platform; the shopper is told and refunded).
  • Pick list: the lines by aisle with the shopper's note. Scan opens the camera, which reads each barcode by itself: a match ticks one unit, a wrong item says what was scanned and changes nothing. A code that will not scan can be typed, or the line ticked by hand after a check.
  • Missing item: offer a swap from the store's own in-stock items (the shopper pays the lower price) or refund the line. While a swap waits, the picker can message the shopper; a refused swap is left out and refunded.
  • Ready: the bag count and the shelf, then wait for the driver. When the driver comes, check them and hand over the bags; if the driver is late, ask for another.
  • Today: orders done, items picked and the average pick time. Store: the accepting-orders switch; hours, stock, prices and the team are managed in the store panel.
A new order to accept
A new order to accept
Scanning a barcode
Scanning a barcode
A missing item: offer a swap or refund
A missing item: offer a swap or refund
Packed, waiting for the driver
Packed, waiting for the driver

33Driver app

  • Home: offline, it shows the driver's zone, vehicle and how busy the zone is; online, it shows the zone, the nearest open store and the next offer when it rings. While online, the app sends the driver's position every few seconds, so offers come from stores nearby. "Ring loud for offers" plays even when the phone is on silent. The zone and the vehicle are changed by the platform (Drivers in the super-admin).
  • Offer: 30 seconds to accept, with the pay (the delivery fee plus the whole tip), the store, the drop-off area (the full address shows after accepting), the distance and, on a cash order, the cash to collect at the door.
  • Job, in three steps: pick up (navigate to the store, tap arrived, say the order number at the counter), check the bags (the count the store packed), and deliver (navigate to the door, chat with or call the shopper through a masked number, follow their note). The job can be handed back before the pickup.
  • Proof: the shopper's 4-digit delivery code (three tries; after that, a photo) or a photo of the bags at the door. On a cash order, the driver types the cash taken, and the app shows the change to give back.
  • Earnings: today and this week, fees, tips, cash collected, cash held (taken off the next payout), the next payout and every trip, with a CSV download.
Online and waiting for an offer
Online and waiting for an offer
A job: pick up, check the bags, deliver
A job: pick up, check the bags, deliver
Proof of delivery: code or photo
Proof of delivery: code or photo
Earnings, cash held and the next payout
Earnings, cash held and the next payout
Part 05

The sample city

34Lakeport, the sample city

Lakeport is a small lakeside town with everything a marketplace needs, so you can try every screen before you add your own stores. Its zones, store pins and addresses sit on the real street grid of Lakeport, California (map data © OpenStreetMap contributors).

  • Three zones: Harbor and Old Town ($1.99 delivery, free over $35, express and scheduled slots) and North Hills ($4.99, free over $50, scheduled slots only).
  • Three stores with their hours, teams and pictures: Harbor Fresh Market (full grocery), Green Basket Organics (organic grocery) and Corner Pantry 24/7 (convenience).
  • Ten aisles and 182 products with prices, deals, barcodes and stock, with a few items out of stock, one of them there to show a swap.
  • Seven coupons (for example SAVE5, FIRST5, FREEDEL and HARBOR10), store applications and a waitlist.
  • People: Ava the shopper, Nora who owns Harbor Fresh Market, Maya who picks there, Leo the driver, Owen the read-only platform admin, eight more store staff, seven more drivers and about 55 more shoppers.
  • Orders: eight weeks of delivered history (with a few cancellations, refunds and swaps, ratings and driver earnings) and today's live orders at every step, so the reports, payouts and boards have something to show.
  • The six starter legal texts, when you have saved none yet.

Load it

docker compose exec app basketrun seed-demo --confirm

It answers seeded: {…} with what it added. Every row it adds is marked as sample data. --confirm is needed once your install has a real account (the super-admin the wizard made); without real accounts the command runs without it. Running it a second time changes nothing. As the super-admin you see the sample stores, drivers, orders and payouts at once; Open as owner on a store's sheet shows its store panel.

On a live marketplace

The sample people have no passwords, so nobody can sign in as them outside demo mode, and the sample orders do not move on their own outside demo mode. Load the sample city on a test copy to explore, or remove it before you open to the public. To try the three apps with it, use a test copy in demo mode (next chapter).

Remove it

Super-admin → Settings → Maintenance → Remove demo data. Only rows marked as sample data are deleted: the sample stores, people, zones, coupons, applications, waitlist, orders and their files. It stops if a sample store has a real payment. It cannot be undone. Two things stay: the aisles (they suit any store) and the legal pages (they are your settings; edit them in Settings → Legal pages).

Photos

The download comes without the sample photos: the sample products, stores and aisles show a plain placeholder in the apps and on the web. To show pictures, put your own in apps/backend/seed/photos/ with products/, stores/ and aisles/ inside, named as in apps/backend/seed/lakeport.json (for example products/hass-avocados.webp). Then rebuild with docker compose up -d --build, remove the sample data and load it again. A missing picture is simply skipped. To change the sample city itself, edit lakeport.json (or point DEMO_CATALOG at your own file of the same shape, and DEMO_PHOTOS at its pictures).

35Demo mode and the seed commands

Demo mode

DEMO_MODE="true" in .env turns an install into a public demo, like the item's live preview. Never turn it on for a real marketplace; the shipped file has it "false". With it on:

  • The sample city is loaded at start and removed and loaded again every night at 03:00 UTC.
  • The sign-in pages show one-click sign-ins: on the web the store owner, the picker and the read-only platform admin; in each app (built with DEMO_LOGINS=true) that app's people: the shopper, the store team or the driver. One address can use them 60 times an hour.
  • Simulated drivers stay online in Lakeport, take offers after a few seconds, ride along real streets to the store and the door and deliver with the shopper's code, so the maps always move. A driver someone is using in the driver app is left alone.
  • Payments go through the test checkout page instead of Stripe, no push notifications are sent, the install wizard is off, secrets show only as set or not set, and the platform admin can look but not change anything.

Settings → Demo mode shows whether it is on. To turn it off, set DEMO_MODE="false" and restart the app (docker compose up -d); the sample data stays until you remove it.

Seed commands

CommandWhat it does
docker compose exec app basketrun seed-demoAdds the sample city, every row marked as sample data. It only adds rows and never deletes anything. It refuses a database with any real account or store; --confirm adds the sample city next to real data anyway.
docker compose exec app basketrun reset-demoRemoves the sample data and adds it again. It refuses to run when the database holds any real account or store, with no way round it.
Super-admin → Settings → Maintenance → Remove demo dataDeletes only rows marked as sample data (see above).
docker compose exec app basketrun migrateApplies the database migrations and stops (the server also does this on every start).

Real accounts, stores, orders and payments are never marked as sample data, so no seed or reset command can touch them.

The demo's sign-in page with its one-click sign-ins
The demo's sign-in page with its one-click sign-ins
The public "Sell with us" application form
The public "Sell with us" application form
Part 06

Security

36Security notes

What the server checks and limits, so you can answer your stores' and shoppers' questions and know what to keep safe.

Stores and people are kept apart

  • The current store always comes from the signed-in session, never from the request. Every query is filtered by it, and another store's order or product answers "not found".
  • Roles (owner, manager, picker; super-admin, viewer; shopper, driver) are checked by the server on every request; the screens only hide what a role cannot use. Each app accepts only its own kind of account.
  • Drivers see only the store and the drop-off area (the street without its number) before they accept, and the full address after. Drivers and shoppers see each other's phone number only as its last four digits, and talk in the order chat. In orders, drivers and stores, the read-only viewer sees shoppers' and drivers' names, emails, phones and street numbers masked.

Accounts and sessions

  • Passwords (at least 10 characters) are hashed with Argon2id. A password change or reset signs the person out on every other device.
  • On the web, the br_session cookie 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 cookie must carry the header x-basketrun: 1, which other sites cannot add, so they cannot act for a signed-in person.
  • The apps sign in with a token sent as Authorization: Bearer. It lasts 90 days, is renewed while the app is used, and is kept in the phone's secure storage (the iOS Keychain, the Android Keystore).
  • Session tokens, reset links and invitations are stored only as SHA-256 hashes.
  • The secrets you save in the super-admin (Stripe, SMTP, storage, the Firebase service account) are encrypted with AES-256-GCM, with a key derived from APP_SECRET. Keep APP_SECRET and your backups safe, and never change it after the install.
  • "Open as owner" sessions last 30 minutes and show a banner with an Exit button.
  • Deleted accounts and closed stores are removed for good after 30 days. Orders stay for the books, with the personal details of a deleted account blanked.

Money

  • Card orders, add-ons and top-ups are confirmed only by Stripe events with a valid signature and timestamp, each applied once. Refunds go to Stripe with an idempotency key, so a retry never pays twice.
  • The wallet changes only in one guarded database update with a unique key per movement: a refund or a spend tried twice counts once, and the balance can never go below zero.
  • Slots, coupons and stock are checked again inside the transaction that places the order, with locks, so two shoppers can never take the last slot place, the last coupon use or the last item together. Accepting and declining one order at once, approving one swap twice or two drivers accepting one job: exactly one goes through.

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:

LimitAllowedWhat it protects
Sign-in, per address20 per 15 minutesSign-in attempts from one address
Sign-in, per account5 per 15 minutesWrong passwords for one account; after five the account waits, even for the right password
Sign-up, per address5 per hourNew accounts from one address
Password reset, per address5 per hourPassword reset emails asked for from one address
Password reset, per account3 per hourPassword reset emails sent to one account
Reset and invite links, per address20 per hourTries at a reset or invite link from one address
Demo sign-in, per address60 per hourPublic demo sign-ins from one address
Invites, per store50 per hourInvites sent by one store

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. The Stripe webhook is never limited. A refused call answers 429 with a Retry-After header.

Uploads and files

  • Uploads are checked by their content, not their name (chapter 10), and count against the room of their store or person. The logo may be PNG, WebP or SVG; an SVG with scripts is refused.
  • Product, store and aisle pictures are public (shoppers see them before signing in). Delivery photos, profile pictures and application documents are served only to whoever they belong to and to the platform staff.

What loads from other servers

The web app's fonts and icons are part of the build. Map tiles load from the map provider you chose (OpenStreetMap, MapTiler or Google in the apps), which sees the visitor's address like any map. Address searches go through your server, so the provider sees your server, not the shopper. Stripe Checkout opens on Stripe's own pages. Push notifications go through Firebase.

Keep it safe

  • Use https (chapter 5), long unique passwords and two-factor sign-in on your Stripe, Firebase, Apple, Google, email and server accounts.
  • Keep .env, the apps' .env files, android/key.properties, the upload keystore, the Firebase service account file and your backups private.
  • Install Basketrun updates; security fixes are marked as such in the changelog.
Part 07

For developers

37Every server key, explained

Every setting in the server's .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. The apps' keys are in chapter 15.

KeyRequiredWhat it does
Required
APP_URLYesThe public address of the app, without a trailing slash, for example https://shop.example.com. Links in emails, the Stripe webhook address and secure cookies come from it. Use https on a public server.
APP_SECRETYesA long random string of at least 32 characters (openssl rand -hex 32). It encrypts saved keys and keys the hashed visitor addresses of the rate limits. Never change it after the install: saved keys could no longer be read.
POSTGRES_DBNoThe name of the database the stack creates. Default basketrun.
POSTGRES_USERNoThe database user the stack creates. Default basketrun.
POSTGRES_PASSWORDYesThe database password. Letters and digits only, because it goes into a connection address.
DATABASE_URLOutside DockerThe 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_TOKENNoThe token the install wizard asks for. Empty: a new one is printed in the app's log on first start.
File storage (product photos, store pictures, profile photos, logo)
STORAGE_DRIVERNos3 (the bundled MinIO, AWS S3 or Cloudflare R2) or local (files in a Docker volume). Default in Docker s3.
S3_ENDPOINTWith s3The storage address. The bundled MinIO is http://minio:9000; for R2 use your account's S3 address; for AWS S3 leave it empty.
S3_REGIONNoThe bucket's region. Default us-east-1; R2 uses auto.
S3_BUCKETNoThe bucket name. Default basketrun; the stack creates it in MinIO.
S3_ACCESS_KEY_IDWith s3The storage access key. With the bundled MinIO this is also its admin user.
S3_SECRET_ACCESS_KEYYesThe storage secret, at least 8 characters. With the bundled MinIO this is also its admin password, so Docker refuses to start without it.
LOCAL_STORAGE_DIRSet by DockerThe folder for files with STORAGE_DRIVER=local (/app/storage in Docker, a volume).
Payments (Stripe; empty = card payments off)
STRIPE_SECRET_KEYFor card paymentsYour platform's Stripe secret key (sk_live_…, or sk_test_… while testing). Empty: card payments are off.
STRIPE_WEBHOOK_SECRETFor card paymentsThe signing secret (whsec_…) of the webhook endpoint you add in Stripe for APP_URL/api/v1/webhooks/stripe.
STRIPE_PUBLISHABLE_KEYFor card paymentsYour Stripe publishable key (pk_live_… or pk_test_…), for Stripe's card form at checkout.
Maps (default: OpenStreetMap, no key)
MAP_PROVIDERNoWhich map the apps and the web pages draw: osm (free, no key, light use only), maptiler or google. MapTiler and Google charge after a free monthly allowance (see the docs, "Maps"). These keys are public: they ship in the web pages, and the server uses them for address search. If you restrict a key in the provider's console, allow your domain AND your server's IP address, or address search stops working.
MAPTILER_KEYNoYour MapTiler key (cloud.maptiler.com → Account → Keys), used when the provider is maptiler: map tiles in the apps and web pages, and address search on the server. It is public: it ships in the apps and the web pages. Super-admin → Settings → Maps takes precedence.
GOOGLE_MAPS_KEYNoYour Google Maps server key, used when the provider is google: address search (Geocoding API) on the server. Restrict it to the Geocoding API and your server's IP address. The apps take their own Android and iOS keys in their .env. Super-admin → Settings → Maps takes precedence.
Push messages (Firebase Cloud Messaging; empty = push off)
FCM_PROJECT_IDNoYour Firebase project id and its service account key (Firebase console → Project settings → Service accounts → Generate new private key), pasted as one line of JSON. You can paste the file in Super-admin → Settings instead.
FCM_SERVICE_ACCOUNT_JSONNoYour Firebase service account key (Firebase console → Project settings → Service accounts → Generate new private key) as one line of JSON, with FCM_PROJECT_ID. Empty: no push messages. Easier: paste the file in Super-admin → Settings → Push, which takes precedence and stores it encrypted.
Email (SMTP; empty = emails are written to the app's log)
SMTP_HOSTFor emailYour email provider's SMTP server. Empty: emails are written to the app's log instead of being sent.
SMTP_PORTNoThe SMTP port. Default 587.
SMTP_USERNAMEFor emailThe SMTP user name.
SMTP_PASSWORDFor emailThe SMTP password or API key.
SMTP_SECURENostarttls (port 587, the default), tls (port 465) or none.
SMTP_FROMFor emailThe sender, for example Basketrun <hello@example.com>. Use an address on a domain your provider has verified.
Network
APP_PORTNoThe port on this server where the app answers. Default 8080.
APP_BINDNoWhich 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_DOMAINWith CaddyThe domain Caddy gets an HTTPS certificate for: the host of APP_URL, for example shop.example.com.
TRUSTED_PROXY_HOPSNoHow 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. Never set it higher than the proxies really in front of the app.
Advanced
COMPOSE_PROJECT_NAMENoOnly 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 Basketrun folder.
SEARCH_INDEXINGNoon (the default): search engines may index the public pages (home, 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_WORKERSNoBackground job workers in this server, 1 to 32. Default 4.
DRAIN_SECSNoFor zero-downtime deploys: seconds a stopping server reports itself unhealthy, so a proxy moves visitors to the new copy, before it exits. Default 0.
DEMO_MODENoOnly for a public demo: "true" adds the sample store and one-click sign-ins for every role, makes sign-ups demo accounts and resets the data every night. Keep "false" on a live site.
DEMO_PAYMENTSNo"true" lets checkout and wallet top-ups finish without Stripe (paid at once, labelled DEMO). Only for a private test copy; never on a live site. DEMO_MODE turns it on as well.
DEMO_CATALOGNoThe sample city file that basketrun seed-demo loads. The Docker image already points at its own copy of apps/backend/seed/lakeport.json; set it only to load your own file of the same shape. Remove the sample data in Super-admin → Settings → Maintenance.
DEMO_PHOTOSNoThe folder of sample photos (products/, stores/ and aisles/ inside, named as in the sample city file). Default: photos/ next to the sample city file. The download has no sample photos, so the sample city shows placeholders; a missing picture is skipped.
RUST_LOGNoHow much the server logs: info (the default), warn, error or debug.
Set by Docker, or for development
ASSET_ARCHIVENoFor your own zero-downtime deploys: a folder that keeps older builds' files, so pages still open in a browser keep working.
BINDNoThe address the server listens on. Default 0.0.0.0: plus PORT.
BUILD_TARGETNoHow Docker gets the program: built (the default, built on this server) or prebuilt (uses prebuilt/basketrun, built elsewhere).
PORTSet by DockerThe port the server listens on inside its container (8080).
READY_FILENoFor your own zero-downtime deploys: the health check passes only once this file exists.
STRIPE_API_URLNoFor tests only: another address for Stripe's API. Default https://api.stripe.com.
WEB_DISTSet by DockerWhere the built web app is, when it is not packed into the program.

38File structure

Server and web app

basketrun/
├── apps/
│   ├── backend/                 the Rust server (Axum): crate basketrun-server, program "basketrun"
│   │   ├── 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 file per area: public, auth, me, catalog (shopping), shopper (cart,
│   │   │                        checkout, orders, wallet), store, store_catalog, store_orders, driver,
│   │   │                        delivery (tracking, chat, ratings), media, events, webhooks, admin*
│   │   ├── src/catalog.rs       zones, opening hours, express rules, store cards, products, stock
│   │   ├── src/cart.rs          the cart, slots, coupons and the price quote
│   │   ├── src/orders.rs        placing orders, the status flow, cancelling, adding items
│   │   ├── src/picking.rs       accept, pick, barcode checks, missing items, swaps, ready
│   │   ├── src/dispatch.rs      job offers, job steps, proof of delivery, cash, driver earnings
│   │   ├── src/payments.rs      Stripe Checkout, the webhook rules, refunds, the test checkout
│   │   ├── src/wallet.rs        wallet credit and spending
│   │   ├── src/payouts.rs       the weekly payouts report
│   │   ├── src/tracking.rs      driver positions, live tracking, chat and ratings
│   │   ├── src/push.rs          push notifications (Firebase Cloud Messaging) and the in-app list
│   │   ├── src/geo.rs           address search through OpenStreetMap, MapTiler or Google
│   │   ├── src/settings.rs      super-admin settings over .env
│   │   ├── src/setup_check.rs   the setup check rows and live tests
│   │   ├── src/demo.rs          the sample city, demo sign-ins, the nightly reset (sim.rs: drivers)
│   │   ├── seed/                lakeport.json (the sample city) and legal/ (starter legal texts)
│   │   ├── tests/               server tests (need a PostgreSQL, see chapter 39)
│   │   └── 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 (lists in src/routes/)
│       ├── src/pages/           platform/ (super-admin), store/ (store panel), public/, auth/, install/
│       ├── src/ui/, src/components/ui/   shared parts and shadcn/ui components
│       ├── src/layout/          the app shell, sidebar and sign-in guards
│       ├── src/api/             the API client and types
│       ├── 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
├── tools/rename.mjs             renames and rebrands the apps and the web defaults (chapter 16)
├── Cargo.toml, Cargo.lock       the Rust workspace
├── .env.example                 every server setting
└── docs/                        this guide (HTML and PDF) and the third-party licences

The Flutter apps

basketrun_mobile_flutter/
├── lib/
│   ├── main.dart, app.dart          start-up and the app root
│   ├── core/
│   │   ├── constants/               app_env.dart (every .env key), app_role.dart (the three apps)
│   │   ├── theme/app_theme.dart     colours, sizes and type, light and dark
│   │   ├── router/                  the routes of each app, deep links, the tab bars
│   │   ├── providers/               app state (Riverpod): session, shopper, store, driver, push, theme
│   │   ├── services/api/            the API client (token, errors, offline cache); sample/ = sample mode
│   │   ├── services/data/           the data each app reads and writes
│   │   ├── services/firebase/       Firebase start-up and push
│   │   └── services/general/        the secure token store and app preferences
│   ├── domain/models/               the JSON the API answers, as Dart classes
│   ├── components/                  shared widgets: bars, controls, commerce, feedback, map, tracking
│   └── features/                    common/ (sign-in), shopper/, store/, driver/: the screens
├── android/                         app/build.gradle.kts (flavours, ids, names, signing),
│                                    app/src/<flavour>/google-services.json
├── ios/                             Runner (schemes shopper, store, driver), config/<flavour>/GoogleService-Info.plist
├── assets/fonts/                    Figtree
├── assets/icon/                     shopper.png, store.png, driver.png: the app icon sources
├── flutter_launcher_icons-*.yaml    the icon settings of each app (dart run flutter_launcher_icons)
├── test/                            unit, widget, flow and screenshot tests; test/live/ against a server
├── pubspec.yaml                     packages, fonts and the app version
└── .env.example                     every app setting

39Customise, test and rebuild

Run it for development

  1. Start a PostgreSQL (your own, or docker compose up -d postgres with ports: ["127.0.0.1:5432:5432"] added to the postgres service in a compose.override.yaml) and set DATABASE_URL in .env. For development set STORAGE_DRIVER=local.
  2. Start the server from apps/backend: cargo run -- serve (it reads .env from the folder or the ones above it and listens on port 8080).
  3. Start the web app from apps/frontend: pnpm install, then pnpm dev, and open http://localhost:5173. Calls to /api go to the server on port 8080 (API_ORIGIN changes that). Screens reload as you save.
  4. Run an app against it: API_BASE_URL=http://10.0.2.2:8080 in the app .env for the Android emulator, then flutter run --flavor shopper --dart-define-from-file=.env. Flutter's hot reload works as usual.

Tests

PartCommandWhat it covers
Servercargo test --workspaceUnit tests, and the API tests against a real PostgreSQL: the whole order flow to the cent, payments with a stand-in Stripe, refunds, wallet, coupons, slots, dispatch and the races that must let exactly one through. The API tests need a PostgreSQL login that may create databases: TEST_DATABASE_URL=postgres://user:password@127.0.0.1:5432/postgres cargo test -p basketrun-server (each test gets a fresh database). Without it they say so and pass.
Server lintscargo clippy --workspace --all-targets -- -D warningsKept clean; cargo deny check checks advisories and licences.
Web apppnpm testUnit tests (Vitest), run in apps/frontend. Also pnpm typecheck, pnpm lint (Biome) and pnpm e2e (Playwright).
Flutter appsflutter testUnit, widget and flow tests of the three apps on the sample data, run in basketrun_mobile_flutter. flutter analyze checks the code. flutter test test/live --dart-define=LIVE_API=http://127.0.0.1:8080 runs the apps' calls against a server in demo mode; --dart-define=SCREEN_SHOTS=/full/path/to/folder also writes screenshots of every screen.

Change the server

  • Each area of the API is one file in apps/backend/src/api/; its routes() function lists the addresses. The business rules (zones, slots, coupons, swaps, refunds, dispatch) are in the modules named after them; apps/backend/README.md lists every module.
  • A database change is a new file in migrations/ named YYYYMMDDHHMMSS_what.sql. Never edit a migration that has already run: the server checks them.

Change the web app

  • apps/frontend/README.md explains its stack, scripts, folders and the production build.
  • Colours, fonts and sizes are CSS variables in apps/frontend/src/styles.css; the brand colour from Settings → Branding overrides --brand at run time.
  • Pages are in apps/frontend/src/pages/; src/routes.ts maps each URL to its file. The public home is src/pages/public/home/ and the store application src/pages/public/sell/.

Change the apps

  • Screens are in lib/features/<app>/, each app's routes in its *_routes.dart file, and the shared widgets in lib/components/.
  • Every API call goes through lib/core/services/api/; sample mode answers the same calls from lib/core/services/api/sample/, so a new call needs both.
  • A new setting goes into .env.example and is read in lib/core/constants/app_env.dart, never written into the code.

Rebuild and deploy your changes

docker compose up -d --build                    # or with --profile https on your server

Docker rebuilds only what changed; a change to the web app alone reuses the compiled server and is quicker still. Rebuild the apps with the commands in chapter 17. Keep your changes in a Git repository, so you can compare them with each new Basketrun version.

40API reference

The web app, the three apps and your own integrations use the same /api/v1 API. These 193 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 of the platform currency (…Cents); ids are UUIDs, and orders also have a number such as BR-10482.
  • Errors: {"error": {"code": "…", "message": "…"}} with the HTTP status, for example other_store, slot_full, out_of_stock, not_enough_stock, cannot_cancel, swap_decided (409), swap_expired, offer_expired (410), wrong_code, proof_required, cash_required (422), wrong_app, demo_locked (403) and rate_limited (429). The message is written to be shown to people as it is.
  • The web app signs in with the br_session cookie and sends x-basketrun: 1 on every change. The apps send "client": "app" and their "role" (shopper, store or driver) to /auth/login and get a token back, then send Authorization: Bearer <token>.
  • Live updates: GET /api/v1/events is a Server-Sent Events stream for the signed-in person and their store; GET /api/v1/orders/{id}/events streams one order's tracking.
MethodAddressWho may call itWhat it does
System
GET/api/healthAnyone200 while the server runs, 503 while it hands over to a new copy during a deploy
GET/api/app-versionAnyoneThe running build's version; open pages compare it with their own to offer a reload after a deploy
GET/robots.txtAnyoneTells search engines which pages they may index: the public pages, or none with SEARCH_INDEXING=off
Public pages, install and inbound webhooks
GET/api/v1/public/configAnyoneThe brand, store sign-up mode, demo sign-ins and what the web app and the apps need before sign-in (installed: false sends every page of the web app to the install wizard)
GET/api/v1/public/legal/{slug}AnyoneOne legal page, with when the legal pages were last saved
GET/api/v1/install/statusAnyone, until the install is done (install token)Whether the install wizard has run
POST/api/v1/install/checkAnyone, until the install is done (install token)Checks the install token and the setup before the wizard's last step
POST/api/v1/install/completeAnyone, until the install is done (install token)Finishes the install: the super-admin and the brand (runs once)
GET/api/v1/public/store-picture/{store}/{file}AnyoneA store picture, without sign-in (the file name holds its hash, so it is cached for a year)
GET/api/v1/public/logo/{file}AnyoneThe uploaded brand logo (no sign-in; long cache, the name changes with the file)
POST/api/v1/public/store-applicationsAnyoneThe "Sell on Basketrun" form (multipart from the web, JSON from the apps): storeName, kind, address, phone, website, contactName, email, role, mobile, productsEstimate, hours, productList, agreedToTerms, message, lat, lng and the licence and permit documents
GET/api/v1/public/photos/{id}AnyoneA catalogue picture (a product's, a store's cover or an aisle's), with no sign-in
GET/api/v1/public/siteAnyoneWhat the public web pages show: the city, the zones on the map, the live stores with their hours and ETA, the platform's figures, the partner terms and the app links
POST/api/v1/webhooks/stripeStripe (signed webhook)Stripe's signed events for the platform account; each is applied once (checkout paid or expired for orders, add-ons and top-ups)
Sign-in and account
POST/api/v1/auth/registerAnyoneCreates an account: from the web, a store owner with their first store (while store sign-ups are open; the store waits for a super-admin's approval before shoppers see it); from an app ("client": "app"), a shopper or a driver (drivers wait for approval) with a session token
POST/api/v1/auth/loginAnyoneSigns in with email and password; "client": "app" (with role: shopper, store or driver) answers a session token for the apps instead of a cookie
POST/api/v1/auth/logoutSigned inSigns out of this browser or app (the session and its push token go)
GET/api/v1/auth/meSigned inThe signed-in user, their stores, role and capabilities
GET/api/v1/auth/sessionAnyoneThe signed-in person like /auth/me, or { me: null } when signed out (always 200)
POST/api/v1/auth/switch-storeSigned inMakes another of the user's stores the current one
POST/api/v1/auth/storesSigned inCreates another store owned by the user (it waits for the platform's approval, as a sign-up does, unless the user is a super-admin)
POST/api/v1/auth/forgotAnyoneEmails a password reset link when the email belongs to an account
POST/api/v1/auth/resetAnyoneSets a new password with a reset link and signs in (each link works once)
GET/api/v1/auth/reset/{token}AnyoneWhose link this is (404 when it expired or was used)
POST/api/v1/auth/impersonation/exitSigned inEnds an "open as owner" session and goes back to the super-admin's own
GET/api/v1/auth/invites/{token}AnyoneWhat an invitation link is for (store, role, email)
POST/api/v1/auth/invites/acceptAnyoneAccepts an invitation, signing in or creating the account
PATCH/api/v1/auth/profileSigned inChanges the person's name, phone or picture
POST/api/v1/auth/passwordSigned inChanges the password (the current one is asked for); other sessions end
POST/api/v1/auth/demoAnyone, public demo onlyOne-click demo sign-in as owner, manager, picker, shopper, driver or the read-only super-admin; "client": "app" answers a session token
POST/api/v1/me/push-tokenSigned inSaves this device's push token (token, platform: android, ios or web, app: shopper, store or driver), one per session
DELETE/api/v1/me/push-tokenSigned inStops push messages to this device (the person turned them off)
GET/api/v1/meSigned inThe signed-in person's profile: name, email, phone, photo, push choices (notifications: {orderUpdates, swaps, chat, offers}) and defaultSubstitutionPref
PATCH/api/v1/meSigned inChanges any of name, phone, avatarUrl, notifications (booleans per kind) and defaultSubstitutionPref (best_match, specific or refund); answers the profile
DELETE/api/v1/meSigned inDeletes the person's own account (password asked); it signs out everywhere and is purged after 30 days
GET/api/v1/me/savedSigned inThe shopper's saved products, newest first (hidden ones left out)
PUT/api/v1/me/saved/{product}Signed inSaves a product (the heart; saving twice is fine)
DELETE/api/v1/me/saved/{product}Signed inRemoves a saved product
Shopping (shopper app)
GET/api/v1/zones/checkAnyoneThe zone that delivers to a point, or the nearest zone (name, polygon and distance) when none does
POST/api/v1/zones/waitlistAnyone{ email, lat?, lng? }, asks to hear when delivery reaches a point outside every zone, or anywhere new with the email alone (no point: the area stays empty)
GET/api/v1/homeAnyoneThe shopper home: the zone and address, promo banners, aisles, the stores that deliver here, deals, and for a signed-in shopper "buy again" and the order on its way
GET/api/v1/storesAnyoneThe stores that deliver to a point (every store without a point), open ones first, then the nearest
GET/api/v1/stores/{key}AnyoneA store's page by slug or id: its card, address and map point, about text, aisles with their counts, deals and popular items, and the first scheduled slot
GET/api/v1/stores/{key}/productsAnyoneOne page of a store's products (20), filtered by aisle (id or slug), text or tag; sort = price_asc, price_desc, deals or name
GET/api/v1/products/{id}AnyoneThe product page: the product with its photos, origin, storage and deal end, its store and aisle, similar items and the swaps a shopper may pick in advance (saved for a signed-in shopper)
GET/api/v1/categoriesAnyoneEvery active aisle with how many products shoppers can see in it
GET/api/v1/searchAnyoneProducts matching a text, grouped by store (the store scope first, even with no match), with suggestions when little matches
GET/api/v1/geo/searchAnyonePlaces matching an address or city (through the server's geocoding provider)
GET/api/v1/geo/reverseAnyoneThe address at a map point (result null when the provider knows none)
GET/api/v1/orders/{id}/trackThe order's shopper, store team or driverThe order's map (status, ETA, the driver's position, store, drop-off, route) for its shopper, store, driver or platform staff
GET/api/v1/orders/{id}/eventsThe order's shopper, store team or driverThe order's live stream (SSE): order.updated with a fresh map on every change and driver ping, order.message for chat, a ping every 25 seconds
GET/api/v1/orders/{id}/messagesThe order's shopper, store team or driverThe order's chat (oldest first) and who takes part, for its shopper, store, driver or platform staff
POST/api/v1/orders/{id}/messagesThe order's shopper, store team or driverSends {body} to the order's chat as its shopper, store or driver
POST/api/v1/orders/{id}/ratingThe order's shopper, store team or driverThe shopper rates a delivered order once ({storeStars, driverStars, comment}; 409 already_rated); answers the order
GET/api/v1/notificationsSigned inThe signed-in person's notifications, newest first, with the unread count
POST/api/v1/notifications/readSigned inMarks {ids} read (all without ids); answers the unread count
GET/api/v1/cartShopperThe cart with its prices, deal savings, fees, coupon and coupon offers
DELETE/api/v1/cartShopperEmpties the cart ("Start a new cart")
PUT/api/v1/cart/itemsShopper{ productId, qty, substitutionPref?, substituteProductId? } sets a line (qty 0 removes it); another store's item is 409 other_store
DELETE/api/v1/cart/items/{product}ShopperRemoves a line
GET/api/v1/cart/slotsShopperExpress now (or why not) and the scheduled slots for the next 7 days with the places left
POST/api/v1/cart/couponShopper{ code } checks a coupon against the cart and keeps it (refusals say why, e.g. "Add $4.20 more to use SAVE5")
DELETE/api/v1/cart/couponShopperTakes the coupon off the cart
POST/api/v1/checkout/quoteShopperThe price summary for the cart with these checkout choices, with warnings
GET/api/v1/ordersShopperThe shopper's orders, newest first
POST/api/v1/ordersShopperPlaces the cart (idempotencyKey makes a retry answer the same order)
GET/api/v1/orders/{id}ShopperOne order with its lines, swaps, totals, driver and timeline
POST/api/v1/orders/{id}/cancelShopper{ reason? } cancels until the store accepts (then 409 cannot_cancel); paid money comes back at once
POST/api/v1/orders/{id}/reorderShopperPuts the order's lines back in the cart
POST/api/v1/orders/{id}/add-itemsShopper{ lines } adds lines to an open order until it is packed
POST/api/v1/orders/{id}/substitutions/{sid}Shopper{ decision: "approve" | "reject", productId? } answers a swap
GET/api/v1/walletShopperThe balance and the latest entries (cursor pages older ones)
POST/api/v1/wallet/topupsShopper{ amountCents } ($5–$200) opens a Checkout page; the wallet is credited once the payment is confirmed
GET/api/v1/addressesShopperThe shopper's saved addresses, the default first
POST/api/v1/addressesShopper{ label, line1, line2, city, notes, lat, lng, isDefault } saves an address (its delivery zone comes from the point)
PATCH/api/v1/addresses/{id}ShopperChanges an address (fields left out stay)
DELETE/api/v1/addresses/{id}ShopperRemoves an address (the next one becomes the default)
GET/api/v1/pay/demo/{session}AnyoneThe demo checkout page (public demo or DEMO_PAYMENTS only): a test card form that pays with 4242 4242 4242 4242 and declines 4000 0000 0000 0002
POST/api/v1/pay/demo/{session}Anyone{ card } pays a demo checkout with a test card (402 card_declined for the declined card)
Driver app
GET/api/v1/driver/statusDriver (approved)The driver's shift (online, approval, zone, vehicle, today's pay, cash held, how busy the zone is, the nearest store, the open offer and job)
PATCH/api/v1/driver/statusDriver (approved)Changes the driver's zone (zoneId), vehicle (vehicle, plate), position (lat, lng, heading) and online switch (online); answers the status
POST/api/v1/driver/onlineDriver (approved)Goes online or offline ({online}; offline with a job is 409 job_open); answers the status
POST/api/v1/driver/locationDriver (approved)The driver's position ping (lat, lng, heading), which moves them on every open map of their order
GET/api/v1/driver/offers/currentDriver (approved)The job offered to the driver now (30 seconds to answer), or null
POST/api/v1/driver/offers/{id}/acceptDriver (approved)Takes the job (410 offer_expired after 30 seconds, 410 offer_gone when another driver has it); answers the job
POST/api/v1/driver/offers/{id}/declineDriver (approved)Passes on the offer; it goes to the next driver
POST/api/v1/driver/offers/{id}/skipDriver (approved)The same as decline
GET/api/v1/driver/jobs/currentDriver (approved)The accepted job (stage, store, shopper, bags, pay, cash, route), or null
POST/api/v1/driver/jobs/{order}/arrived-storeDriver (approved)The driver is at the store; answers the job
POST/api/v1/driver/jobs/{order}/picked-upDriver (approved)The driver has the bags ({bags?}; 409 not_ready while the store is still packing) and the order is on the way; answers the job
POST/api/v1/driver/jobs/{order}/arrived-customerDriver (approved)The driver is at the door (the shopper hears it); answers the job
POST/api/v1/driver/jobs/{order}/deliverDriver (approved)Delivers with the shopper's code or a proof photo ({code | proofMediaId, cashCollectedCents}; 422 wrong_code with triesLeft, 422 cash_required); answers the trip
POST/api/v1/driver/jobs/{order}/releaseDriver (approved)Hands the job back before pickup (409 picked_up after); it goes to the next driver
GET/api/v1/driver/earningsDriver (approved)Fees, tips, trips and online time for today or this week (?range=week), the cash held and the next payout
GET/api/v1/driver/tripsDriver (approved)The driver's deliveries, newest first (?cursor pages on)
Store, team and files
GET/api/v1/eventsSigned inLive updates (Server-Sent Events) for the person's store and account: ready, a ping every 25 seconds and refetch when a screen fell behind
GET/api/v1/storeStore memberThe current store
PATCH/api/v1/storeStore owner or managerChanges the store name, time zone, opening hours or its grocery profile
DELETE/api/v1/storeStore ownerCloses the store (the owner types its name to confirm); its team loses access and it is purged after 30 days
POST/api/v1/store/pictureStore owner or managerUploads the store picture (PNG, JPEG or WebP up to 1 MB), shown in the store panel and the shopper app
DELETE/api/v1/store/pictureStore owner or managerRemoves the store picture (and its file)
GET/api/v1/teamStore memberThe members, each with what they are doing now and their day (see [SHIFT_SQL] for "on shift"), the open invitations (for managers) and stats, the store's day at a glance
POST/api/v1/team/invitesStore owner or managerInvites someone by email as a manager or picker (only the owner invites managers)
POST/api/v1/team/invites/{id}/resendStore owner or managerSends an invitation again with a new link
DELETE/api/v1/team/invites/{id}Store owner or managerWithdraws an invitation
PATCH/api/v1/team/members/{id}Store owner or managerChanges a member's role (managers move pickers; a store keeps at least one owner)
DELETE/api/v1/team/members/{id}Store owner or managerRemoves a member (managers remove pickers; never the last owner)
POST/api/v1/mediaSigned inUploads a file (multipart file; typed by content, size limits per kind)
GET/api/v1/media/{id}Signed inA file, to the person it belongs to, to members of the store it belongs to, or to platform staff
GET/api/v1/store/productsStore memberOne page of the catalogue with the tab counts and the aisles (tab = all, low, out or hidden; q matches the name or barcode)
POST/api/v1/store/productsStore owner or managerAdds a product (name, unit, aisle, price and was-price, stock and its warning level, barcode, description, photo, swaps and weight options)
GET/api/v1/store/products/indexStore memberThe whole catalogue in short (id, name, aisle with its id and pick name, barcode, price, shown) for the CSV check and the swap picker to match against (pages of up to 5000)
POST/api/v1/store/products/bulkStore owner or manager{ ids, action: "in_stock" | "hide" | "show" | "delete" } on several products at once ("in stock" fills each to its warning level + 10)
POST/api/v1/store/products/importStore owner or manager{ rows | csv, keepIds, hideMissing, zeroStock }
GET/api/v1/store/products/{id}Store memberOne product with every field
PATCH/api/v1/store/products/{id}Store owner or managerChanges any field of a product
DELETE/api/v1/store/products/{id}Store owner or managerRemoves a product (past orders keep their lines)
PATCH/api/v1/store/products/{id}/stockStore member{ stock } sets a count, { delta } adds or takes some (one update that never goes below zero: 409 stock_short when there is not enough); note keeps a line for the team
GET/api/v1/store/stockStore memberEvery tracked product with its count, warning level, week's sales, when it ran out and when it will at the recent pace; today's restocks, swap figures and the stock rules
PATCH/api/v1/store/stock/rulesStore owner or manager{ hideAtZero, lowStockEmail, lowerOnPick } (hide products at 0 from shoppers, the 7:00 low-stock email, lower stock as items are picked)
GET/api/v1/store/hoursStore memberOpening hours, special days, express and slot rules, and the next week's slots
PUT/api/v1/store/hoursStore owner or manager{ week, holidays, express: { on, prepMinutes, pauseWhenWaiting }, cutoffMinutes, accepting, acceptsCash, capacity: { zoneId: n } }, saves the hours page (each part optional; week and holidays replace what was saved)
GET/api/v1/store/statusStore memberWhether the store takes orders now (open, paused and until when, closing time, express, zone, pickers on shift)
PATCH/api/v1/store/statusStore memberPauses or resumes new orders
GET/api/v1/store/ordersStore memberThe live board (open orders by default) with the store's status, today's delivered and cancelled counts
GET/api/v1/store/orders/{id}Store memberThe pick list: the order with its lines by aisle (barcode, picked qty) and swaps
PATCH/api/v1/store/orders/{id}Store member{ pickerId } hands the order to another picker of the store
POST/api/v1/store/orders/{id}/acceptStore memberTakes a new order (409 not_new once anyone answered it)
POST/api/v1/store/orders/{id}/declineStore member{ reason } turns a new order down; the shopper gets their money back
POST/api/v1/store/orders/{id}/start-pickingStore memberStarts picking an accepted order
POST/api/v1/store/orders/{id}/items/{item}/pickStore member{ qty, byHand } counts units picked
POST/api/v1/store/orders/{id}/items/{item}/missingStore member{ refund? } marks a line missing (refunded at once with the refund preference)
POST/api/v1/store/orders/{id}/items/{item}/scanStore member{ barcode } checks the scanned item is the line's product and picks one unit when it is
POST/api/v1/store/orders/{id}/items/{item}/substituteStore member{ productId } proposes a swap (the shopper pays the lower price)
POST/api/v1/store/orders/{id}/readyStore member{ bags, shelf } packed and waiting for the driver
POST/api/v1/store/orders/{id}/handed-overStore memberThe driver took the bags; the order is on the way
POST/api/v1/store/orders/{id}/reassign-driverStore memberAsks for another driver before pickup
GET/api/v1/store/todayStore memberThe store app's day: orders done, average pick time, items picked, swaps, the finished orders, pickers on shift and the same day last week
GET/api/v1/store/countsStore memberThe shell badges: new orders, orders being picked, products low or out
GET/api/v1/store/overviewStore memberToday at a glance: orders and sales against last week, on-time rate, swaps, orders by hour, what needs the team, pickers at work and what sells fast
GET/api/v1/store/reportsStore memberSales, orders, what the store keeps after commission and refunds (the orders delivered in the range, as its payouts count them), on-time rate, a bar per day, best sellers, zones, refunds by reason, ratings and when the range is paid out (payoutDue)
Super-admin
GET/api/v1/admin/overviewSuper-admin (viewer reads)The platform dashboard: today's orders, sales and drivers, late orders and new applications, plus stores, people, sign-ups per month and what needs attention
GET/api/v1/admin/countsSuper-admin (viewer reads)The badges in the super-admin's menu: new store applications, stores from the sign-up waiting for approval, drivers waiting for approval and late open orders
DELETE/api/v1/admin/stores/{id}Super-adminCloses a store (purged after 30 days, like a store its owner closes)
POST/api/v1/admin/stores/{id}/impersonateSuper-admin"Open as owner": a 30-minute session as the store's owner
GET/api/v1/admin/usersSuper-admin (viewer reads)Everyone who signs in (search, kind: shopper / driver / staff, platform staff, store role, status)
PATCH/api/v1/admin/users/{id}Super-adminChanges a person's kind (shopper, driver, staff), platform role, status or name
GET/api/v1/admin/settingsSuper-admin (viewer reads)The platform settings (secrets masked), server facts and storage stats
POST/api/v1/admin/settings/branding/logoSuper-adminThe brand logo (PNG, SVG or WebP up to 1 MB, checked by content), served publicly as the logo and favicon
PUT/api/v1/admin/settings/{section}Super-adminSaves one settings section (secrets are sealed; an empty secret keeps .env)
GET/api/v1/admin/emailsSuper-admin (viewer reads)The platform emails with their built-in and saved wording, for the email editor
GET/api/v1/admin/setup-checkSuper-admin (viewer reads)The setup check rows
POST/api/v1/admin/setup-check/{id}/testSuper-adminTests one setup check row against the real service
GET/api/v1/admin/jobsSuper-admin (viewer reads)Background jobs (status and kind filters) with counts per status
POST/api/v1/admin/jobs/{id}/retrySuper-adminQueues a failed job again
POST/api/v1/admin/demo-data/removeSuper-adminRemoves the demo data (demo-marked rows only)
GET/api/v1/admin/zonesSuper-admin (viewer reads)Every zone with its figures, the city, and where the waitlist asks for delivery
POST/api/v1/admin/zonesSuper-adminAdds a zone (polygon = at least 3 points [lat, lng], with its fees and slots)
GET/api/v1/admin/zones/waitlistSuper-admin (viewer reads)Everyone waiting for delivery to reach them (Export list)
GET/api/v1/admin/zones/{id}Super-admin (viewer reads)One zone with its figures
PATCH/api/v1/admin/zones/{id}Super-adminChanges a zone (any field; open orders keep the fees they were quoted)
DELETE/api/v1/admin/zones/{id}Super-adminRemoves a zone with no open orders (switching it off keeps its history)
GET/api/v1/admin/storesSuper-admin (viewer reads)The store list: status = live (or active: approved and not suspended), suspended or pending (waiting for approval), a zone or kind filter, the tab counts and this week's figures
POST/api/v1/admin/storesSuper-admin{ name, kind, address, zoneId, owner: { name, email, phone }, commissionBps }, adds a store and emails its owner a sign-in link
GET/api/v1/admin/stores/{id}Super-admin (viewer reads)The store sheet: its row, team, files and the weeks not paid out yet
PATCH/api/v1/admin/stores/{id}Super-adminApproves or rejects a new store, suspends a store with a reason (its owner and managers are told) or restores it; also sets its commission, payout schedule, kind and zones
GET/api/v1/admin/store-applicationsSuper-admin (viewer reads)Partner applications (new ones by default), newest first
POST/api/v1/admin/store-applications/{id}/approveSuper-admin{ commissionBps?, zoneId? }, makes the store and its owner's account from the application and emails the owner a sign-in link (once: a second approve is a 409)
POST/api/v1/admin/store-applications/{id}/declineSuper-admin{ reason } (10 characters at least), declines an application and emails the applicant the reason
POST/api/v1/admin/store-applications/{id}/requestSuper-admin{ documents: ["Licence", …] }, emails the applicant for the missing documents (they show as asked for)
GET/api/v1/admin/store-applications/{id}/files/{kind}Super-admin (viewer reads)A document sent with an application (licence or permit)
GET/api/v1/admin/categoriesSuper-admin (viewer reads)Every aisle, in the shoppers' order
POST/api/v1/admin/categoriesSuper-admin{ name, icon, sort, pickName, active }, adds an aisle every store can use
PATCH/api/v1/admin/categories/{id}Super-adminChanges an aisle's name, icon, order, pick-list name or shown state
DELETE/api/v1/admin/categories/{id}Super-adminRemoves an aisle (its products stay, without an aisle)
GET/api/v1/admin/driversSuper-admin (viewer reads)One page of drivers for a tab (online, approved, pending, suspended) with zone, vehicle and search filters, the tab counts and the live figures
POST/api/v1/admin/drivers/inviteSuper-adminInvites a driver by email ({email, zoneId?, name?}): an account waiting for approval and an email with a link to choose a password (valid 7 days)
GET/api/v1/admin/drivers/{id}Super-admin (viewer reads)One driver with today's figures, documents, acceptance over 30 days and recent trips
PATCH/api/v1/admin/drivers/{id}Super-adminApproves, rejects, suspends (status: suspended; 409 on_delivery while they carry an order) or reinstates a driver, or changes their zone, vehicle and plate; the driver hears of a decision
POST/api/v1/admin/drivers/{id}/requestSuper-adminAsks the driver for documents ({documents: [labels]}): each is marked missing on their sheet and they get an email and a notification
GET/api/v1/admin/liveSuper-admin (viewer reads)The live map: zones with their open orders, stores, every online driver as a pin (delivering, heading to a store, waiting, or late with the minutes) and the counts (delivering and to_store count as the overview does: [dispatch::DELIVERING_SQL])
GET/api/v1/admin/payoutsSuper-admin (viewer reads)The week's payouts report (?period= any day of the week, default last week): stores (sales, commission, refunds, owed) and drivers (fees, tips, cash held, owed), with what was paid
POST/api/v1/admin/payouts/mark-paidSuper-adminRecords the payouts of the ticked rows ({period, ids: [{party, id}]}) once each; answers how many were recorded
GET/api/v1/admin/ordersSuper-admin (viewer reads)One page of orders, the tab counts and today's GMV
GET/api/v1/admin/orders/{id}Super-admin (viewer reads)The order sheet: lines, swaps, money, customer, driver, card, zone, steps, the event log (timeline) and the store's commission (store.commissionBps)
POST/api/v1/admin/orders/{id}/cancelSuper-admin{ reason } cancels any order not delivered; paid money goes back
POST/api/v1/admin/orders/{id}/refundSuper-admin{ items: [{ itemId, reason }], deliveryFee, to: "card" | "wallet" }
GET/api/v1/admin/customersSuper-admin (viewer reads)Shoppers with their orders, spend and wallet, the tab counts and the stat cards
PATCH/api/v1/admin/customers/{id}Super-admin{ status: "blocked" | "active", blockedReason } blocks a shopper (signed out everywhere, can't sign in) or lets them back
GET/api/v1/admin/couponsSuper-admin (viewer reads)Coupons, tab counts and this month's figures (uses, first-order share, discount given, codes turned away and the top reason)
POST/api/v1/admin/couponsSuper-adminCreates a coupon (code, kind, value, limits, storeIds, dates)
PATCH/api/v1/admin/coupons/{id}Super-adminChanges a coupon (fields left out stay), e.g
DELETE/api/v1/admin/coupons/{id}Super-adminRemoves a coupon never redeemed; one with redemptions is ended instead (its history stays)

41Database

PostgreSQL. The schema is in migrations/ and is applied by the server on start. Ids are UUIDs, times are UTC and money is in whole cents. Every store table carries store_id; orders, payments and refunds are kept when a shopper or a store is deleted. These 52 tables are generated from the migrations when the release is built.

TableWhat it holdsKeysPoints to
Accounts and sign-in
usersEvery person: shoppers, drivers and staff (store teams and the platform's own), with their super-admin role (none, admin or viewer)primary key id; unique email (any case), when deleted_at is null–
sessionsSigned-in browsers and apps (only a hash of the cookie or Bearer token is stored), including super-admin impersonationprimary key id; unique token_hashusers, stores
push_tokensThe push token of the device each app session runs on, removed with the sessionprimary key id; unique session_id; unique tokensessions, users
password_resetsPassword reset links (hashed, valid for one hour, used once)primary key id; unique token_hashusers
invitesOpen invites to a store, with the role to join as (manager or picker)primary key id; unique token_hash; unique email (any case) per store, when accepted_at is nullstores, users
rate_limitsFixed-window counters for sign-in, sign-up and password reset limits (keyed by a hash)primary key key–
notificationsWhat each person sees under Notifications in the apps (every push is also kept here)primary key idusers, orders
Stores and teams
storesThe grocery stores on the marketplace (the tenants), with their status, time zone, opening hours and settingsprimary key id; unique slugusers, zones, media
store_membersWho works in a store and their role (owner, manager or picker)primary key store_id + user_idstores, users
store_hoursWeekly opening hours; a weekday with no row is closedprimary key store_id + weekdaystores
store_closuresDays a store is closed (holidays)primary key store_id + daystores
store_zonesThe zones a store delivers toprimary key store_id + zone_idstores, zones
store_applicationsPublic partner applications from the web site's "Sell on Basketrun" formprimary key idstores, zones, users
store_application_filesDocuments sent with an application (business licence, food permit)primary key application_id + kind; unique storage_keystore_applications
audit_logActions taken by store owners, managers and the super-adminprimary key idstores, users
Zones and places
zonesDelivery zones: an address is served when its point is inside an active zone's polygonprimary key id; unique slug–
zone_waitlistPeople who asked to hear when delivery reaches their addressprimary key id; unique emailusers
addressesSaved delivery addressesprimary key id; unique user_id, when is_defaultusers, zones
geo_cacheGeocoding answers kept for 30 days (provider rate limits and cost)primary key key–
Catalogue
categoriesPlatform-wide aisles (Fruit and vegetables, Dairy, …)primary key id; unique slugmedia
productsA store's productsprimary key id; unique barcode per store, when barcode is not nullstores, categories, media, users
stock_movesEvery stock change made in the store panel (restock counts and "last restock")primary key idstores, products, users
saved_productsA shopper's saved products (the heart on the product page)primary key user_id + product_idusers, products
Cart, coupons and slots
cartsOne open cart per shopper, from one storeprimary key user_idusers, stores
cart_itemsOne line of a cart: the product, how many, and the shopper's swap choice for itprimary key user_id + product_idcarts, products
couponsCoupons, checked by the server at checkoutprimary key id; unique codestores
coupon_storesThe stores a coupon works at (no rows, and no coupons.store_id: every store)primary key coupon_id + store_idcoupons, stores
coupon_redemptionsRedemptions, one per orderprimary key order_idorders, coupons, users
coupon_refusalsCodes the server turned away at checkout, and why (the admin's "turned away" figure)primary key idusers
slot_bookingsReserved delivery slots (capacity check under an advisory lock)primary key order_idorders, stores
Orders
ordersOrdersprimary key id; unique number; unique stripe_session_id; unique user_id + idempotency_keyusers, stores, zones, coupons, media
order_itemsOne line of an order: the product's name, unit and price when it was ordered, how many were picked, and its swap choiceprimary key idorders, products
order_addonsLines the shopper adds to an open card order: they join the order when their own Checkout Session is paidprimary key id; unique stripe_session_idorders, users
substitutionsA picker's proposed swap for a line the store could not findprimary key id; unique order_item_id, when status = 'proposed'orders, order_items, products
order_eventsThe order's timelineprimary key idorders, users
order_refundsEvery refund of an orderprimary key id; unique idem_keyorders, users, order_items
order_messagesChat between the shopper, the driver and the store about one orderprimary key idorders, users
order_ratingsOne rating per delivered orderprimary key order_idorders, users
Drivers and delivery
driver_profilesDrivers (users of kind 'driver')primary key user_idusers, zones
driver_shiftsEach time a driver was online (the earnings screen's online minutes)primary key id; unique driver_id, when ended_at is nullusers
dispatch_offersJob offers to driversprimary key id; unique order_id, when status = 'accepted'; unique driver_id, when status = 'offered'orders, users
order_trackThe driver's trail while an order is on the way (for the shopper's map)primary key idorders
driver_earningsWhat a driver earned per delivered orderprimary key order_idorders, users
Wallet and payouts
wallet_accountsThe shopper's wallet: credit only from refunds and paid top-upsprimary key user_idusers
wallet_entriesEvery change to a wallet: refunds and paid top-ups in, spending at checkout out, each with its order and a key so it is written onceprimary key id; unique idem_keyusers, orders
wallet_topupsA wallet top-up paid through Stripe Checkout; the wallet is credited only when Stripe confirms the paymentprimary key id; unique stripe_session_idusers
payoutsPayouts the platform marked as paid to a store or a driverprimary key id; unique party + period_start per storestores, users
Files
mediaEvery uploaded file: a store's (product photos, the store picture) or a person's own (profile photo)primary key id; unique storage_keystores, users
Payments
stripe_eventsEvery Stripe event already applied, so a repeated delivery changes nothingprimary key id–
Platform
platform_settingsThe super-admin settings by section, which take precedence over .env (secrets stored encrypted)primary key keyusers
email_noticesPlatform emails already sent for a store and period, so each is sent onceprimary key store_id + kind + periodstores
jobsThe durable background job queue: the nightly housekeeping and purge, and the demo resetprimary key id; unique dedupe_key, when dedupe_key is not null and status in ('queued', 'running')stores
Part 08

Help

42Updating 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 Basketrun 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.

Also keep a copy of .env (above all APP_SECRET, without which the saved keys cannot be read), of your files (the minio-data Docker volume, your own bucket or the app-storage volume), and of the apps' signing keys and .env files. 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 the server

Upgrade in the same folder

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, which docker volume ls shows before _postgres-data.

  1. Back up as above.
  2. From the folder that holds basketrun/ (not inside it), run unzip -o basketrun-x.y.z.zip with the new version's file name. The zip has a top-level basketrun/ folder, so it unpacks over your install and replaces every shipped file, also ones you changed in the web app or the mobile apps: keep your changes in Git (chapter 39) so you can see and re-apply them. Your .env, compose.override.yaml, prebuilt/ and the apps' .env files and key.properties are kept, because the zip doesn't contain them.
  3. Compare your .env with the new .env.example; new keys are listed there and in CHANGELOG.md. This lists the keys of .env.example that your .env doesn't have yet:
    cd basketrun
    for k in $(grep -oE '^#? ?[A-Z][A-Z0-9_]*=' .env.example | tr -d '# ='); do grep -q "^$k=" .env || echo "$k"; done
  4. Run docker compose up -d --build (with --profile https on your server). The new version applies any new migrations when it starts; your data stays.
  5. If disk is tight, run docker builder prune afterwards to free the build cache.

Update the apps

Copy your changes (names, ids, icons, theme) onto the new basketrun_mobile_flutter/, or compare with Git, then raise the build number in pubspec.yaml, build and upload as in chapter 17. Update the server first: new apps may need the new server, while the old apps keep working with it.

43Troubleshooting

The app says it cannot reach the server

  1. Open API_BASE_URL/api/health in the phone's browser: it must answer. On the Android emulator a server on your computer is http://10.0.2.2:8080, not localhost.
  2. API_BASE_URL is the server's root without /api/v1. The value is built into the app: after changing .env, run or build the app again.
  3. A real phone needs an https address with a valid certificate.

"This account is for the … app"

Each account signs in only to its own app: shoppers to the shopper app, store teams to the store app, drivers to the driver app, platform staff to the web. Use the app it names, or change the account's kind in People.

Card orders stay "waiting for payment"

Stripe's webhook does not reach the server. Setup check → Stripe must show the webhook signing secret. In Stripe → Developers → Webhooks, the endpoint must be APP_URL/api/v1/webhooks/stripe with the three events of chapter 8; Stripe shows every delivery and the server's answer there. A signing secret from another endpoint (or from test mode on a live endpoint) is refused.

No push notifications

  1. Setup check → Push messages must be green (the service account is saved).
  2. The app was built with that app's own FIREBASE_* keys, all of them filled in (chapter 12). With any of them missing, the app quietly leaves push off.
  3. The phone is a real device, notifications are allowed for the app, and the person is signed in.
  4. For iOS, the APNs key is uploaded in Firebase (chapter 12).

No driver gets the offer

A job is offered only to drivers who are approved, online in the driver app, seen in the last 15 minutes, in the order's zone and without another job. Express orders go out when the store accepts; scheduled orders 30 minutes before their slot. Super-admin → Drivers → Online now shows who can take it.

Shoppers are told you don't deliver to them

Their address point is outside every zone, or the zone has no store delivering to it. Check the zone's corners and its "Stores delivering here" in Zones, and look at the waitlist for where people ask.

A store does not show in the shopper app

It must be approved, not suspended, have at least one product shown in the app and deliver to the shopper's zone. A store that is closed now, or has "Accepting orders" off, shows as closed.

Express is not offered

Express needs the zone's express on, the store's express on, the store open now, and fewer waiting orders than the store's "pause express" number.

The maps are blank or grey

MapTiler or Google is chosen without its key: the setup check's Maps row warns, and the maps fall back to OpenStreetMap. A key that is set but wrong, unpaid or limited to other apps gives empty or grey maps: check it in the provider's dashboard. Google Maps in the apps also needs the app's own key at build time (chapter 15).

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". Or set INSTALL_TOKEN in .env and run docker compose up -d.

After an upgrade everything is empty

The folder was moved or renamed, so Docker started a new, empty stack (chapter 42). Stop it with docker compose down, set COMPOSE_PROJECT_NAME in .env to the name before _postgres-data in docker volume ls, and run docker compose up -d again.

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.

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).

A Flutter build fails

Always pass --flavor and --dart-define-from-file. After changing packages or ids, run flutter clean and flutter pub get; on iOS also cd ios && pod install --repo-update. flutter doctor shows missing tools.

Emails don't arrive

Without SMTP, emails are written to docker compose logs app. With SMTP, send a test email from Settings → Email and check that the sender's domain is verified with your provider.

The orders board or the tracking map does not move

A proxy is buffering the live updates. With the bundled Caddy it works as is; with Nginx add proxy_buffering off;.

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).

44FAQ

Do I publish three apps?

Yes: the shopper app, the store app and the driver app are three listings on Google Play and three on the App Store, under your own developer accounts. They are built from one codebase.

Where does the money go?

Card payments land in your own Stripe account. The payouts report tells you each week what you owe each store and driver, and you pay them yourself. Stores and drivers need no Stripe account.

Can a shopper order from two stores at once?

No. A cart holds one store's items, so one picker packs it and one driver brings it.

Does it work without card payments?

Yes: cash on delivery and wallet credit from refunds work without Stripe. Wallet top-ups and card orders need Stripe.

Do I need Google Maps?

No. OpenStreetMap works with no key. Move to MapTiler or Google once the marketplace is busy (chapter 11).

Can I use another currency or country?

Set the currency and time zone in Settings → General; Stripe takes payments in it where your Stripe account allows. Product sizes are free text, so you write them in your own units. The apps and the web app are in English.

Is there a web shop for shoppers?

No. Shoppers order in the shopper app; the public site checks their address, shows the stores near them and links to the apps.

Do I need to know Rust or Flutter?

Not to install it, set it up or run it: Docker builds the server. Building the apps needs Flutter installed, and the commands in Part 03. Changing the screens needs Dart (apps) or React (web); changing the rules needs Rust.

Can I host it without Docker, or on shared hosting?

Without Docker yes: run the one basketrun program behind your own HTTPS proxy with PostgreSQL 15 or newer (chapter 5). Shared PHP hosting cannot run it.

Which licence do I need?

To take orders and payments from shoppers, the Envato Extended Licence. See chapter 47.

45Credits and licences

Basketrun is built with these open-source projects, each under its own licence:

Every server and web 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; the Flutter packages and their versions are in basketrun_mobile_flutter/pubspec.lock.

LicenceRust cratesnpm packages
MIT53272
Apache-2.0 OR MIT2132
Unicode-3.018–
ISC210
Apache-2.0110
MIT OR Unlicense5–
(MIT OR Apache-2.0) AND Unicode-3.03–
Apache-2.0 OR MIT OR Zlib3–
Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT3–
BSD-2-Clause–3
BSD-3-Clause12
0BSD11
Apache-2.0 OR BSD-2-Clause OR MIT2–
Apache-2.0 OR BSL-1.0 OR MIT2–
Apache-2.0 OR ISC OR MIT2–
Apache-2.0 OR LGPL-2.1-or-later OR MIT2–
CDLA-Permissive-2.02–
MPL-2.0–2
OFL-1.1–2
Zlib2–
(Apache-2.0 OR MIT) AND BSD-3-Clause1–
0BSD OR Apache-2.0 OR MIT1–
Apache-2.0 AND ISC1–
Apache-2.0 OR BSL-1.01–
BlueOak-1.0.0–1
CC-BY-4.0–1
LicenseRef-Envato-Regular-or-Extended1–
MIT AND BSD-3-Clause1–
MIT-0–1
Unlicense–1
Total321308

Every licence above allows use in a commercial product. cargo deny check licenses checks the Rust crates against the allowed list.

Images

The public site comes with six photos in apps/frontend/public/images/site (the home page's main picture, the store cards and the "sell" and "drive" sections): replace them with pictures of your own city and stores. The sample city comes with placeholder pictures (chapter 34). The logo is an original SVG, and every image in this guide is a screenshot of the running apps.

46Changelog

1.0.0 (November 2026)

First release.

  • Three Flutter apps from one codebase: the shopper app, the store app for pickers and the driver app, as three flavours with their own name, app id, icon and deep links; light and dark themes; a sample mode that runs every screen without a server.
  • Shopping: delivery zones drawn on the map, stores near the shopper's address, aisles, search, deals, one store per cart, express delivery with a live time estimate or a scheduled slot for today and the next six days, coupons, a service fee, tips, and a swap choice for every item (best match, a chosen product or a refund).
  • Paying: cards through Stripe Checkout with a signed webhook, cash on delivery with a cash limit per zone, and a wallet for refunds and top-ups that can never go below zero.
  • Picking: new orders with an answer window, a pick list by aisle, barcode checks with the camera, missing items with swaps the shopper approves within five minutes (at the lower price), items added after ordering, bags and ready for pickup.
  • Delivery: job offers to the nearest free driver in the zone, one at a time with a 30-second answer window, live tracking on the map for the shopper, chat, proof of delivery with a 4-digit code or a photo, cash handling, tips and ratings.
  • Store panel (web): the live orders board, the catalogue with CSV import, stock, opening hours and special days, express settings, the team (owner, managers, pickers) with invitations, and reports.
  • Super-admin (web): zones and fees, store applications and approval, commissions, drivers and their documents, orders and refunds to the card or the wallet, coupons, the weekly payouts report for stores and drivers, people, settings, branding, legal pages, a setup check that tests every outside service, and "open as owner" for support.
  • Maps: OpenStreetMap with no key by default, or MapTiler or Google Maps; address search through the server.
  • Push notifications through your own Firebase project, and an in-app list of notices.
  • Install and hosting: an install wizard, one Docker Compose stack (PostgreSQL, MinIO, the app, optional Caddy HTTPS), any S3-compatible storage or a local folder, the Lakeport sample city with eight weeks of order history, and a public demo mode with one-click sign-ins, simulated drivers and a nightly reset.
  • Security: Argon2id passwords, secure web sessions and app tokens, secrets encrypted at rest, rate limits kept in the database, uploads checked by their content, and every store's data kept apart on the server.

47Support and licence

Questions, bug reports and help with installation: use the Support tab on the item's page on the marketplace. Please include your Basketrun version, how you host it, which app and phone it is about, and what you see (a screenshot, or the lines from docker compose logs app). Never send your .env, keys, tokens, the Firebase service account 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, publishing the apps in your developer accounts, or the setup and review of your accounts at Stripe, Google, Apple and other outside services, which are handled by those companies.

Licence

The Regular Licence lets you use Basketrun for one product whose end users are not charged. To take orders and payments from shoppers, you need the Envato Extended Licence. One licence covers one marketplace (one brand on one installation, with its three apps). The licences page at codecanyon.net/licenses/standard explains both licences in full.

Basketrun is not affiliated with, endorsed by or sponsored by Stripe, Google, Apple, Firebase or OpenStreetMap. Their names are trademarks of their owners.