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

Install it, open your first city, take your first ride

Farelane is a taxi and parcel delivery service that you run as your own business. Riders book a ride or send a parcel in the rider app. Drivers get each request as a ringing offer in the driver app, even on a locked phone, and drive it with live tracking, a start PIN and a fare worked out from the real route. You run the whole service from a web admin with a live map and a dispatcher for phone bookings, and riders find you through a public website.

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, text messages, email, maps and push, and Part 03 to build your two apps.

Part 01

Get started

1Welcome

Thank you for choosing Farelane. This guide takes you from the download to a running ride service with your first city, your first drivers and your two apps on real phones.

What you get

  • The rider app (Flutter, Android and iOS): the pickup on a map with the cars nearby, a destination with extra stops or no set destination, five vehicle types (Moto, Tuk-tuk, Car, Comfort, XL, chosen per city), a price before booking, book now or schedule up to 7 days ahead, fixed upfront fares or offer your own fare (chosen per city), parcels with a photo at pickup and a code for the receiver, live tracking, a 4-digit start PIN, a trip link to share, an SOS button that alerts your staff and texts emergency contacts, chat with the driver, cash, card (Stripe) or wallet payments, promo codes, tips, ratings, saved places and receipts.
  • The driver app: apply with the vehicle and documents, a ride alerts set-up that tests the ringing alert, online and offline, ride offers that ring full-screen for 15 seconds even on a locked phone, accept, decline or counter a rider's offer, navigation in the driver's favourite map app, the PIN check, paid waiting, the no-show rule, the end of the trip with cash or card, parcel photos and the receiver's code, scheduled rides, earnings by day and week, payouts and paying back cash the driver owes.
  • The web admin for you and your staff: the overview, a live map of every car, a dispatcher for phone bookings, rides and parcels (refund, cancel, reassign), safety alerts, drivers and their documents, riders and their wallets, cities with their service zones, vehicle types and fares, promo codes, weekly payouts, reports, staff with three roles, settings, legal pages and a setup check that tests every outside service live.
  • A public website: home with a "check a price" box, pages for rides, parcels, drivers ("drive with us"), cities and safety, your legal pages, and the shared trip page a rider sends to family.
  • An install wizard and two sample cities (Lisbon with fixed fares, Porto with rider offers) that you can load with one command to try everything with drivers on the map.
  • One-command self-hosting with Docker: the server (one compiled Rust program that also serves the web pages), 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 pages and the two apps, the apps' live connection, the Stripe webhook, dispatch, the fare engine, the background jobs and the built web pages, compiled into one program called farelane. apps/backend/seed/ holds the sample cities (demo.json) and the starter legal texts.
apps/frontend/The web pages: React 19, React Router 7, Vite, Tailwind CSS 4 and shadcn/ui. The admin, the public website, the trip page, sign-in and the install wizard.
farelane_mobile_flutter/The Flutter project. One codebase that builds two apps by flavour: rider 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, farelane_mobile_flutter/.env.example.
tools/rename.mjsOne command that gives the apps and the web pages your name, ids, colour and icons (chapter 17).
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.

Not in the download, on purpose: any .env file, Firebase config files with real ids (the apps ship placeholders: android/app/src/rider/google-services.json, android/app/src/driver/google-services.json, ios/config/rider/GoogleService-Info.plist and ios/config/driver/GoogleService-Info.plist say REPLACE_WITH_… until you add yours), signing keys and photos. You bring your own keys for every outside service.

How it fits together

Everything runs on your server except the outside services you choose to connect. The two apps and every browser talk only to your Farelane server, through HTTPS.

Several copies of the server can run side by side against one database (chapter 5): live events travel through PostgreSQL, so every copy reaches every open screen.

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, including races, money and a load test with 300 drivers; web tests; Flutter widget and flow tests) 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 logo, the two 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 maps, also the website's map pictures, are drawn from OpenStreetMap.
  • Demo text: Yes. The sample cities' people, places, promo codes 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. Farelane has no AI features and calls no AI service.

Not affiliated

Farelane works with your own accounts at Stripe, Twilio, Google (Firebase and, if you choose it, Google Maps), 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 admin, the public site and the two apps. Every chapter in Part 04 has more.

The admin overview: rides, money and drivers online today, live rides, an open SOS and what needs you
The admin overview: rides, money and drivers online today, live rides, an open SOS and what needs you
The dispatcher: book a ride for a caller, with the fare and the nearest free drivers
The dispatcher: book a ride for a caller, with the fare and the nearest free drivers
The live map: every car in the city, free or on a trip
The live map: every car in the city, free or on a trip
The public home page with its "check a price" box
The public home page with its "check a price" box
Rider app: pickup and the cars nearby
Rider app: pickup and the cars nearby
Rider app: the driver on the map, PIN and SOS
Rider app: the driver on the map, PIN and SOS
Driver app: an offer with what the driver earns
Driver app: an offer with what the driver earns
Driver app: the offer rings on a locked phone
Driver app: the offer rings on a locked phone

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 pages 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. docker builder prune gives the cache space back once the app runs. You can also build on another computer and run the result on a smaller server (chapter 5).
  • To run it the server needs far less: one small program next to PostgreSQL and MinIO. Plan at least 2 GB of memory for a city with a few hundred drivers online; the server answered a request in about 40 ms at the 95th percentile with 300 drivers sending positions every 2 seconds in our load test.
  • 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 your staff.

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 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 rides, saved cards, wallet top-ups, card refunds and drivers paying back cash they owe. Without it, riders pay cash (where the city allows it) or with wallet credit from refunds.To take card payments
Twilio (SMS)Phone sign-in codes, SOS texts to a rider's emergency contacts and parcel receiver codes. Without it, the apps offer email and password sign-in only.Strongly advised
An SMTP email providerPassword resets, staff invitations, SOS alert emails and ride receipts. Without it, each email is written to the app's log with its link.For a public launch
Firebase (Google)Push notifications to locked phones: ride offers that ring in the driver app, and ride updates for riders. Without it, the apps still update live while they are open.Needed for drivers
Apple Developer Program and Google Play ConsolePublishing the two apps under your own name.To publish the apps
A routing server (OSRM) or Google Maps PlatformMeasuring every trip on real streets for the quote. The shipped settings use OSRM's public demo server, which is for trying only (chapter 12).For a live service
S3-compatible storageDriver documents, parcel photos, profile pictures and your logo. The bundled MinIO does this on the same server.Optional

3Extra costs you pay

Farelane 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. Prices change, so check each provider's pricing page (linked below) before you set your fares.

ServicePriceWhat that means for you
Stripe (pricing)per paymentA fee on every successful card payment: for example 2.9% + 30¢ for US cards, or 1.5% + €0.25 for standard European cards. Each ride paid by card is one payment (two when the final fare goes over the card hold), and so is each tip, top-up and driver settlement. Stripe keeps its fee when you refund.
Twilio SMS (pricing)per textEach sign-in code, SOS text and parcel receiver code is one text. The price depends on the country of the phone; a phone number costs a small monthly fee too.
Firebase Cloud Messaging (pricing)FreeNo charge per push message.
OpenStreetMap tiles, Nominatim search, OSRM demo routing (the default)FreePublic servers run by volunteers for light use only (chapter 12). A busy service runs its own routing server or pays a provider.
Your own routing server (OSRM)a serverOSRM is free software; it needs its own server with enough memory for your region's map.
Google Maps Platform (pricing)free allowance, then per 1,000Routes (Directions), address search (Geocoding) and the web pages' map tiles are billed per request after a free monthly allowance per service. The maps in the two phone apps use Google's mobile SDKs. Google needs a billing account even inside the free allowance.
Apple Developer Program$99 a yearOne membership publishes both apps on the App Store.
Google Play Console$25 onceOne developer account publishes both apps on Google Play.
Email (for example Amazon SES)per emailAmazon SES charges about $0.10 per 1,000 emails; other SMTP providers sell monthly plans with a free tier.
File storage$0 and upThe bundled MinIO or the server's own disk costs nothing extra. Outside providers charge per GB stored (Cloudflare R2, for example, has no download fees).
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 service, for example rides.yourbrand.com.
You set the fares that pay for this

The platform keeps the booking fee of every fixed-fare ride and a commission on each fare, set per city (Part 04). Set them so that Stripe's fee, the texts and your running costs are covered.

4Install in 10 minutes with Docker

This runs Farelane 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 farelane/ 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. APP_SECRET must be at least 32 characters; keep it safe and never change it after the install, because it encrypts the keys you save in the 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 pages 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.
  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: fl-install-… (open /install and paste it).
  6. Open http://localhost:8080. The install wizard opens: paste the token, name your company, open your first city and create your owner account.
  7. Optional: load the two sample cities to see everything with data in it (chapter 38):
    docker compose exec app farelane 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, changing APP_URL to the same port (http://localhost:8090; links in emails and the setup check use it) 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 rides, Farelane must be reachable at a public https:// address: the two apps talk to it, Stripe sends its webhook to it and riders come back to it after a card page.

1. Pick a server (VPS)

SizeGood for
2 cores, 4 GB memory, 40 GB diskBuilding on the server and running a city with a few hundred drivers online.
1 to 2 cores, 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, or your own routing server on the same machine.

Any provider that sells Linux servers with Docker works. Disk use grows mainly with driver documents and parcel photos, so move files to outside storage once it grows (chapter 11).

2. DNS

At your domain registrar, add an A record for the address you want (for example rides for rides.yourbrand.com) pointing at your server's IP address. Wait until ping rides.yourbrand.com shows that IP.

3. Settings

In .env:

APP_URL=https://rides.yourbrand.com
APP_DOMAIN=rides.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://rides.yourbrand.com; the first visit takes a few seconds while the certificate is issued. Caddy passes the apps' live connection (WebSocket) and the admin's live stream through as they are, so offers and the live 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 Farelane, as the next part shows.

Behind a proxy you already run

Your proxy must pass on three kinds of traffic: normal requests, the apps' WebSocket live connection at /api/v1/ws (ride offers, tracking) and the admin's live stream at /api/v1/events (it must not be buffered). 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 passes WebSockets and streams on its own. The labels tell it 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: Farelane 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.farelane.rule=Host(`rides.yourbrand.com`)
      - traefik.http.routers.farelane.entrypoints=websecure
      - traefik.http.routers.farelane.tls.certresolver=letsencrypt
      - traefik.http.services.farelane.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: Farelane on the network of an Nginx container
services:
  app:
    networks:
      default:
      proxy:
        aliases: [farelane]

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

Then send the traffic to http://farelane:8080 (or http://127.0.0.1:8080 for an Nginx on the server itself). In Nginx:

# in the http { } block, once: what to send as "Connection" for WebSockets
map $http_upgrade $connection_upgrade { default upgrade; '' close; }

# in your server { } block for rides.yourbrand.com
location / {
    proxy_pass http://farelane:8080;
    proxy_http_version 1.1;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header Upgrade $http_upgrade;           # the apps' live connection
    proxy_set_header Connection $connection_upgrade;
    proxy_buffering off;                              # the admin's live stream
    proxy_read_timeout 1h;                            # keep live connections open
    client_max_body_size 21m;                         # PDF documents go up to 20 MB
}

In Nginx Proxy Manager, add a Proxy Host with scheme http, forward hostname farelane and port 8080, turn on Websockets Support, request its SSL certificate, and paste the last three 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

Farelane limits sign-ins, texted codes, sign-ups, password resets and website price checks per visitor address, so nobody can guess passwords or run up your SMS bill 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.
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. A CDN must pass WebSockets through.
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 and per-phone limits apply. The apps and Stripe need HTTPS, so this suits only testing.

Admin → Setup shows the current setting in its "Visitor addresses" row. The full list of limits is in chapter 40.

Several copies of the server

One copy handles a large city (see the load test in chapter 2). For more room or a deploy without downtime you can run several copies of the same program behind a load balancer, all on one PostgreSQL database:

  • Live updates go through PostgreSQL (LISTEN/NOTIFY), so a driver connected to one copy gets an offer made by another, and every admin screen sees every car. No sticky sessions are needed.
  • The dispatch clock runs every 2 seconds in every copy, and background jobs are claimed from the database with row locks (FOR UPDATE SKIP LOCKED), so no offer, expiry or email is handled twice. The hourly, daily and nightly jobs are queued once per period however many copies run.
  • Files must be in shared storage (MinIO or S3), not on one server's disk; the setup check warns while files are on the disk.
  • Database connections: each copy opens up to 20 connections plus one for live events. Connect directly to PostgreSQL, or through a pooler in session mode: a pooler in transaction mode breaks the live events.
  • Rate limits for sign-ins and texts are kept in the database, so they hold across copies; the short per-second allowances are per copy.
  • Deploys: DRAIN_SECS makes a stopping copy report itself unhealthy for that many seconds before it exits, so your load balancer moves visitors to the new copy; the apps reconnect by themselves.
  • Every copy needs the same .env (above all the same APP_SECRET) and the load balancer must pass WebSockets.

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

# on the bigger computer, in the farelane folder (use --platform linux/arm64 for an ARM server)
docker build -f docker/Dockerfile --target pack -t farelane-pack --platform linux/amd64 .
docker create --name farelane-pack-copy farelane-pack
mkdir -p prebuilt
docker cp farelane-pack-copy:/farelane prebuilt/farelane
docker rm farelane-pack-copy

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

Keep it running with a service manager such as systemd. The server applies the migrations when it starts; ./farelane migrate applies them on their own. To load the sample cities outside Docker, run ./farelane seed-demo --confirm from the kit folder (it reads apps/backend/seed/demo.json) or set DEMO_SEED to the file.

Other hosts

  • Platforms that run a Docker image (most cloud container services): build the image with docker build -f docker/Dockerfile -t farelane ., 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. The platform must allow WebSockets and long-lived requests.
  • Managed PostgreSQL works through DATABASE_URL (see the pooler note above).
  • Shared web hosting (cPanel, PHP hosting) cannot run Farelane: it needs a server that runs Docker or a Linux program.

A staging install on the same server

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

# .env of the live install
COMPOSE_PROJECT_NAME=farelane
APP_PORT=8080
APP_URL=https://rides.yourbrand.com

# .env of the staging install
COMPOSE_PROJECT_NAME=farelane-staging
APP_PORT=8081
APP_URL=https://staging.yourbrand.com
SEARCH_INDEXING=off

COMPOSE_PROJECT_NAME keeps each install'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 installs. Give each its own passwords and its own APP_SECRET. Only one 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 install.

6Install wizard

The first visit to a new install opens the wizard at /install. Every page sends you there until the owner account exists; afterwards the wizard is locked, so nobody else can take the server over. It has five steps and keeps your answers in the browser tab as you go (never the password).

  1. Database. The wizard shows whether the database answers. Paste the install token from the app's log (docker compose logs app | grep -i "install token") and check it. 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 setup check (next chapter): what is ready and what you can set later.
  2. Your company. The name riders and drivers see on the apps, the website, receipts and emails, your support email, the currency (a 3-letter code such as EUR; set it now, because rides and payouts are kept in it) and the time zone (payout weeks and reports follow it).
  3. First city. Its name and country, the commission you keep (a percentage of the fare without the booking fee), the pricing mode (fixed upfront fares, or riders offer a fare that drivers accept or counter, chapter 21), which vehicle types it offers, whether cash rides are allowed, and the city centre: click the map to move it. The first service zone is a square 40 km across around that centre; redraw it later in Cities and zones. Each vehicle type starts with sample fares you change in Vehicle types and fares (chapter 29).
  4. Admin account. Your name, email and a password of at least 10 characters. This is the owner account, the only role that can change settings and staff.
  5. Done. The wizard creates the owner, saves the currency and time zone, adds the city, draws its zone, sets its fares, turns the city live and signs you in to the admin. Card payments, text messages, email, push and maps are set up afterwards in Admin → Settings; the setup check shows what is left.
Step 1: the database and the install token
Step 1: the database and the install token
Step 3: the first city, its pricing mode, vehicle types and centre
Step 3: the first city, its pricing mode, vehicle types and centre

7Setup check

Admin → Setup lists everything a running service depends on, with a plain-words status (ok, warning, off or error) and where to fix it. Rows that can be tested for real have a Test button that calls the service and replaces the row with the answer.

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, or "not set up" (emails go to the app's log). The test connects and signs in; type an address to get a real test email.
StripeWhether the secret key is set (test or live mode) and whether the webhook signing secret is there, or that demo payments are on. The test reads your Stripe balance.
MapsWhich map the apps and pages draw, with a warning when Google is chosen without a key (everything then falls back to OpenStreetMap).
Routes and pricesWhich service measures every trip: Google Directions, your OSRM server, or a warning that trips are measured as a straight line × 1.3. The test routes a trip across your first city.
Address searchWhich service finds addresses (Google, your Nominatim or Photon server, or Nominatim's public server). The test searches for a place.
Text messages (SMS)Whether Twilio is set up. Off: phone sign-in is hidden, SOS texts are listed as not sent and parcel receivers get no code by text. The test reads your Twilio account; no text is sent.
Push messagesWhether a Firebase service account is saved. The test asks Google for an access token with it, which proves the key works; no message is sent.
DispatchThe dispatch timings in force (chapter 35).
SafetyThe local emergency number the apps call, where SOS alerts are emailed, and how long trip links work after a ride.
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 jobs waiting over 10 minutes (are the workers running?).
InstallWhether the owner account exists.
Setup: each service with its status, a Test button and where to fix it
Setup: each service with its status, a Test button and where to fix it

Background jobs and the dispatch clock

Farelane needs no separate worker or scheduler: both run inside the server program, and the job queue lives in PostgreSQL.

WhatHow oftenWhat it does
Dispatch clockevery 2 secondsOffers that ran out go to the next driver (three missed in a row take a driver offline), rider-offer proposals and requests that ran out, scheduled rides whose search starts, searching rides that lost their offer, drivers whose app went quiet, and card pages nobody finished. On the public demo it also moves the simulated drivers.
sos.notifyat once, per alertEmails the safety address and texts the rider's emergency contacts with the trip link.
trip.shareat once, when a trip startsTexts the live trip link to the rider's emergency contacts who get every trip.
ride.receiptat once, per paid rideEmails the rider's receipt (again after a refund).
housekeepinghourlyClears expired sessions, rate-limit windows, reset links, old invites, old quotes and sign-in codes, and old job rows.
purgedailyRemoves accounts deleted more than 30 days ago (chapter 40).
demo.resetnightly, 03:00 UTCThe public demo only: back to the fresh sample cities.

A job that fails is tried again after 10 seconds, then after twice as long each time, at most an hour apart; a job whose worker died is given back after 10 minutes. The Background jobs list on the Setup page shows recent jobs with why each failed, and a Retry button. JOB_WORKERS (default 4) sets how many jobs one copy of the server runs at once.

Part 02

Connect services

Every outside service can be set in .env or in Admin → Settings. Values saved in the admin take precedence over .env, field by field. 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)

Riders pay rides by card through your own Stripe account. They save a card once on a Stripe page; each card ride then places a hold on it when it is booked (a scheduled ride: when its driver search starts) and takes the final fare when it ends. The same account takes wallet top-ups, tips and the cash a driver owes, and sends card refunds.

Stripe's fees

Stripe is a third-party payment service with its own pricing, and you pay its fees: for example 2.9% + 30¢ per successful US card payment, or 1.5% + €0.25 for standard European cards. 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 Admin → Settings → Payments, or into STRIPE_PUBLISHABLE_KEY and STRIPE_SECRET_KEY in .env. Use both test keys or both live keys, never one of each. Set your currency in Settings → General before the first ride.

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://rides.yourbrand.com/api/v1/webhooks/stripe. Settings → Payments shows the exact address to copy.
  3. Select these events:
    • checkout.session.completed: a rider saved a card, paid a wallet top-up, or a driver paid back cash. Required: cards and top-ups are saved only when this event arrives.
    • payment_intent.payment_failed: a final charge failed later, so the ride is marked unpaid.
    • charge.dispute.created: a rider disputed a payment; it is written to the audit log.
    Stripe may send more events; the server notes them and changes nothing.
  4. Copy the endpoint's Signing secret (whsec_…) into Settings → Payments, or STRIPE_WEBHOOK_SECRET in .env. Without it, saved cards and top-ups would never be confirmed, and the setup check says so.

3. How a card ride is paid

A card ride never waits on the webhook: the server talks to Stripe itself at each step, with an idempotency key on every call that moves money, so a retried call never charges twice.

  1. Book. The rider books with a saved card (the default card unless they pick another).
  2. Hold. The server places a manual-capture hold on the card for the quote plus 20%, at least 3.00 more (a €8.26 quote holds €11.26). Nothing is charged yet.
  3. Declined? The booking answers 402 card_declined before any driver is asked, and the ride is not created. The rider picks another card, the wallet or cash.
  4. Offer and trip. The ride is offered to drivers (chapter 20). If nobody takes it, the hold is let go and nothing is charged.
  5. End. The driver ends the trip; the final fare comes from the fare engine.
  6. Final fare. Usually the upfront quote; more when the route grew by over 25%, waiting was paid or stops were added.
  7. Capture. The server captures the final total from the hold, up to the hold.
  8. The rest. When the total is above the hold, the rest is a second charge on the same card, made without the rider on the screen ("off-session").
  9. Paid. The ride shows paid, the rider gets the receipt (by email when SMTP is set) and can rate and tip. A card tip is its own small charge.
  10. Unpaid. If the capture fails (for example the hold ran out), the whole total is charged off-session instead. If that charge or the second charge fails (the bank refused), the ride is marked unpaid. The rider sees it at once and settles it in the app with the wallet, another card or cash to the driver; a new ride waits until it is paid. The driver's earning is booked when the ride is paid.
Cancelled rides

A cancellation with a fee (chapter 20) captures only the fee from the hold; a free cancellation lets the hold go. A hold the bank keeps after it was let go lapses at the bank by itself.

4. Saved cards, top-ups and cash a driver owes

  • Saving a card: the rider app opens a Stripe Checkout page in setup mode. When Stripe confirms it (the checkout.session.completed event), the card's brand and last 4 digits are saved; the first card is the default. Card numbers never reach your server.
  • Wallet top-ups: from 5.00 to 200.00 a time on a Stripe Checkout page; the wallet is credited only when Stripe confirms the payment.
  • Cash a driver owes: a driver who kept more cash in a week than they earned can pay the difference by card from the driver app (chapter 31).
  • After a Checkout page, Stripe sends the person to APP_URL/api/v1/pay/return, which opens the app again (farelane://pay/return, farelane-driver:// for drivers) with a "Back to the app" button.

5. Test, then go live

  1. Press Test on the Stripe row of the setup check.
  2. In the rider app, add a card with Stripe's test card 4242 4242 4242 4242 (any future date, any CVC), then book a card ride. The ride shows "held" while it runs and "paid" when the driver ends it; Stripe's dashboard shows the hold and the capture.
  3. Repeat steps 1 and 2 in live mode with your live keys and a live webhook endpoint, and save them.

If Stripe could not reach your server

Stripe retries a failed webhook for up to three days, and each event is applied once however often it arrives. If your server was down longer, open the event in Stripe → Developers → Events (or the endpoint's event list) and press Resend: the card or top-up is saved then. Rides themselves are never held up by the webhook. Resending costs nothing; Stripe has its own pricing, and you pay its fees only on the payments themselves.

Payment methods in the admin

Settings → Payments also turns card payments and the wallet on or off for everyone. Cash is set per city (chapter 29).

Test payments without Stripe

DEMO_PAYMENTS="true" in .env makes card holds, saved cards and top-ups complete without Stripe, on the server's own test page (a card ending in 0002 is declined). It is "false" in the shipped file. Use it only on a private test copy, never on a live site.

How payments stay right

Each Stripe event is checked against its signature and applied once, so Stripe's retries never double anything. Every capture, charge and refund carries its own idempotency key, and a refund is claimed in the database before it goes to Stripe (and undone if Stripe refuses), so the books always match Stripe and nothing is ever refunded twice.

Licence

Taking rides and payments from riders through Farelane requires the Envato Extended Licence. The Regular Licence covers a single product whose end users are not charged.

Settings → Payments: the Stripe keys, the webhook address, card payments and the wallet
Settings → Payments: the Stripe keys, the webhook address, card payments and the wallet

9SMS sign-in codes (Twilio)

Riders and drivers sign in with their phone number and a 6-digit code sent by text. The same texts carry SOS alerts to a rider's emergency contacts and the receiver's code for a parcel. They go through your own Twilio account.

Twilio's costs

Twilio is a third-party service with its own pricing, and you pay it: a price per text that depends on the country of the phone, and a monthly fee for the sending number. See Twilio's SMS pricing for your countries.

  1. Create an account at twilio.com and buy a phone number that can send texts to your country (some countries also allow a sender name instead of a number; Twilio's console says which).
  2. From the Twilio console copy the Account SID (starts with AC) and the Auth token.
  3. Paste them into Admin → Settings → SMS with the sending number in international form (for example +351910000000), or set TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN and TWILIO_FROM in .env.
  4. Press Test on the SMS row of the setup check (it reads your account; no text is sent), then sign in to the rider app with your own phone number.

The rules

  • A code has 6 digits, works for 10 minutes and allows 5 tries. Codes are kept only as a keyed hash, and neither codes nor message texts are ever written to the log.
  • Texts are limited per phone number and per visitor address (chapter 40), so nobody can run up your bill.
  • A new phone number makes a new rider account (in the rider app) or a new driver who then applies (in the driver app). Staff sign in to the web admin with email and password.

Without Twilio

Everything works, with three differences: the apps offer email and password sign-in only, SOS texts to emergency contacts are listed as "not sent: no SMS provider" for your staff (the SOS still reaches the admin and the safety email), and parcel receivers get no code by text (the sender passes it on). Twilio has its own pricing, and you pay it only once you turn it on, so running without it costs nothing.

Settings → SMS: the Twilio account, token and sending number
Settings → SMS: the Twilio account, token and sending number

10Email (SMTP)

Farelane sends password reset links, staff invitations, SOS alert emails to your safety address and ride receipts.

  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 Admin → Settings → Email, or the SMTP_* keys in .env. Use starttls on port 587, tls on port 465.
  3. Press Test on the Email row of the setup check, and type your address to get a real test email.

Without SMTP, each email is written to the app's log with its link (docker compose logs app), which is enough for testing and for the first owner's reset or invite links.

The emails

EmailWhenPlaceholders
Password resetSomeone asks for a reset; the link works for one hour.{{brand}}, {{name}}, {{link}}
Staff invitationThe owner invites a staff member; valid for 7 days.{{brand}}, {{role}}, {{inviter}}, {{link}}
SOS alertA rider or driver raises an SOS; it goes to the safety address (or the support email).{{who}}, {{ride}}, {{city}}, {{time}}, {{position}}, {{link}}
Ride receiptA completed ride is paid, and again after each refund. Never to riders without an email.{{ride}}, {{date}}, {{from}}, {{to}}, {{lines}}, {{total}}, {{method}}, {{refund}}, {{support}}

Under What the emails say, the Email settings page lets you reword the password reset, invitation and SOS emails (subject, text and button, with the placeholders above); empty parts keep the built-in words. The ride receipt keeps its built-in words.

Email costs

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

11File storage

Driver documents (licence, ID, insurance, registration, photo), parcel photos at pickup and drop-off, profile pictures and your logo are kept 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 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, not for several copies.

The Storage page also sets how much room each person's uploads may take (default 50 MB, 0 for no limit). Uploads are checked by their content, not their name: pictures are JPG, PNG or WebP of at most 5 MB, documents are PDF of at most 20 MB.

Files are never public. A file is shown to the person it belongs to and to your staff, and a parcel's photos to that ride's rider and driver. The apps get each picture through a signed link that works for at most 10 minutes.

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.

12Maps

A ride service uses three map services: map tiles (the picture of the streets in the apps and the web pages), routing (the distance and time of every trip, which the fare is quoted from) and address search (typing "Rua Augusta 24"). Farelane uses OpenStreetMap for all three by default, with no key, and Google Maps when you add a key. Routing and address search always go through your server, which keeps answers (address searches for 30 days, routes for an hour).

PartDefaultFor a busy serviceSetting
Map tilesOpenStreetMap's tile serverA tile provider (any {z}/{x}/{y} raster tiles) or your own tile serverSettings → Maps → Tile address and Map credit, or MAP_TILE_URL
RoutingOSRM's public demo server (OSRM_URL in the shipped .env.example)Your own OSRM serverSettings → Maps → Routing server, or OSRM_URL
Address searchNominatim's public serverYour own Nominatim or Photon server, or a provider that runs oneSettings → Maps → Address search, or GEOCODER_URL
The public servers are for light use

OpenStreetMap's tile server, Nominatim and the OSRM demo server are run by volunteers and ask for light use only: Nominatim allows at most one search a second (Farelane waits its turn and keeps every answer for 30 days), the OSRM demo server about one route a second with no guarantee, and the tile server forbids heavy use. They are right for trying Farelane and a quiet start. For a live service, point the three settings at your own servers or at a provider, or choose Google. When no routing server answers within 5 seconds, a quote uses the straight line × 1.3 at the city's average speed, so a price always shows; the setup check warns while that is the case.

Your own routing server (OSRM)

OSRM is free software that needs the OpenStreetMap data of your region and a server with enough memory for it (a country the size of Portugal fits in a few GB). Follow the OSRM documentation to run it with the car profile, then set its address, for example OSRM_URL=http://osrm:5000 (or in Settings → Maps). The routing test on the Setup page routes a trip across your first city.

Google Maps

  1. In the Google Cloud console, create a project, add a billing account and turn on the Directions API, the Geocoding API, the Map Tiles API (the web pages), the Maps SDK for Android and the Maps SDK for iOS.
  2. Make three API keys under APIs & Services → Credentials:
    • Server and web key: API restrictions Directions API, Geocoding API and Map Tiles API. Your server uses it for routes and address search, and the web pages for their map tiles, so it is readable in the browser; leave its application restriction at "None" (a website restriction would stop your server's calls, and an IP restriction the browsers'), and set a daily quota and a budget alert in Google Cloud. Paste it into Admin → Settings → Maps with the map set to Google Maps, or set MAP_PROVIDER=google and GOOGLE_MAPS_KEY in .env.
    • Android key: Maps SDK for Android, restricted to Android apps with your two application ids and their SHA-1 signing fingerprints (Google Play shows the fingerprint of its app signing key under Test and release → App integrity). Put it in the app .env as GOOGLE_MAPS_ANDROID_KEY.
    • iOS key: Maps SDK for iOS, restricted to iOS apps with your two bundle ids. Put it in the app .env as GOOGLE_MAPS_IOS_KEY.
  3. Rebuild the apps: Google's mobile SDKs read their key when the app is built. The apps follow the map the server chose (or MAP_PROVIDER in the app .env), and an app built without its Google key draws OpenStreetMap instead, so a map always shows.

With Google chosen and its key set, Google Directions measures every trip and Google Geocoding finds addresses; your OSRM and Nominatim settings are then not used.

Map costs

Google Maps Platform is a third-party service with its own pricing, and you pay it: routes, address searches and web map tiles are billed per request after a free monthly allowance (see Google's price list). Tile and routing providers for OpenStreetMap data have their own plans too. OpenStreetMap's public servers are free but run by volunteers, so respect their usage policies.

Credit on every map

OpenStreetMap data must be credited where it is shown. Every map in the apps and the web pages shows "© OpenStreetMap contributors" (or the credit you type for your own tile provider in Settings → Maps).

Settings → Maps: the map, tiles and credit, the routing server and address search
Settings → Maps: the map, tiles and credit, the routing server and address search

13Push notifications and ride alerts

Ride offers must reach a driver whose phone is locked in a pocket. Farelane sends them through Firebase Cloud Messaging in your own Firebase project: on Android the offer rings and fills the locked screen, on iPhone it rings as a time-sensitive notification. Riders get their ride updates the same way. Without Firebase, the apps still get every offer and update live while they are open.

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 both 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 (Firebase pricing).

1. Create the Firebase project

  1. Open the Firebase console, choose Create a project, name it after your service 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 both apps.

2. Register the two apps

In Firebase → Project settings → Add app, add an Android app and an iOS app for each of your two app ids (four in all: rider and driver, Android and iOS; chapter 17 sets the ids). Firebase offers a config file for each:

  • google-services.json of the rider app → farelane_mobile_flutter/android/app/src/rider/google-services.json; the driver app's → android/app/src/driver/google-services.json.
  • GoogleService-Info.plist of the rider app → farelane_mobile_flutter/ios/config/rider/GoogleService-Info.plist; the driver app's → ios/config/driver/GoogleService-Info.plist.

The download ships placeholders in those four places; a build uses a file only once it holds real ids. You can also run flutterfire configure (FlutterFire CLI) per app with --android-out and --ios-out pointing at those paths.

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

The apps start Firebase from the FIREBASE_* keys of the .env they are built with. The rider app and the driver app have different Firebase app ids, so keep one settings file per app, for example .env.rider and .env.driver (copies of .env.example), and copy the values from that app's config files:

Key in the app .envWhere the value is
FIREBASE_API_KEYcurrent_key in google-services.json (API_KEY in the plist works for an iOS-only build)
FIREBASE_PROJECT_IDproject_id (PROJECT_ID)
FIREBASE_MESSAGING_SENDER_IDproject_number (GCM_SENDER_ID)
FIREBASE_ANDROID_APP_IDmobilesdk_app_id in google-services.json (1:…:android:…)
FIREBASE_IOS_APP_IDGOOGLE_APP_ID in the plist (1:…:ios:…)
FIREBASE_IOS_BUNDLE_IDBUNDLE_ID in the plist
FIREBASE_STORAGE_BUCKETstorage_bucket (optional)

Then build each app with its own file, for example flutter run --flavor driver --dart-define-from-file=.env.driver. Until the keys are there, the app runs without push.

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 Admin → Settings → Notifications, paste the whole file and your Firebase project id, then save. 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. Press Test on the Push row of the setup check: Google accepts the key, and no message is sent.

5. Ride alerts on the driver's phone

A ride offer is sent as a high-priority message. What the driver's phone does with it depends on four settings the driver allows once, on the Ride alerts screen of the driver app (it opens after approval and stays in the account menu). The same screen has Test the ride alert, which rings exactly like a real offer.

SettingPhoneWhy
Location "Allow all the time"Android, iPhoneWhile online, the app keeps sending the driver's position with the screen off, so the nearest driver is really the nearest. On Android a "You're online" notification shows while it runs (a foreground service).
NotificationsAndroid, iPhoneOffers, rider messages and payouts.
Full-screen alertsAndroid 14 and newerLets the offer fill the locked screen and ring for its 15 seconds. From Android 14, Google Play grants this only to calling and alarm-style apps; Farelane asks the driver to turn it on in the system settings, and the screen links there.
Ignore battery optimisationAndroidStops the phone from putting the app to sleep while the driver is online. Some makers (Xiaomi, Huawei, Samsung, OnePlus) add their own "app sleep" lists; drivers on those phones should allow Farelane there too.
Time-sensitive alertsiPhoneLets an offer ring through Focus modes. The iOS app has the Time Sensitive Notifications capability on; keep it when you sign the app.

Without full-screen alerts or time-sensitive alerts the offer still arrives as a notification and in the open app; a driver who misses it simply lets it go to the next driver after 15 seconds. Three missed offers in a row take a driver offline, with a push saying why.

6. Test it

Install the driver app on a real phone (the iOS simulator does not get pushes), sign in as an approved driver, allow the ride alerts and go online. Lock the phone, then book a ride near it from the rider app or the admin's dispatcher: the driver's phone rings within a few seconds. Device tokens that Firebase reports as gone are removed by themselves.

Settings → Notifications: the Firebase project and service account, saved encrypted
Settings → Notifications: the Firebase project and service account, saved encrypted
Driver app: the ride alerts set-up
Driver app: the ride alerts set-up
Part 03

The mobile apps

The folder farelane_mobile_flutter/ is one Flutter project that builds two separate apps: the rider app 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. Both talk to your Farelane server.

14What you need

  • Flutter on the stable channel with Dart 3.9 or newer, from docs.flutter.dev. 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 Farelane server online at an https:// address (chapter 5), or a test copy on your computer for the emulator.
  • Real phones for what a simulator cannot do: push notifications and the locked-phone ride alert, background location and the parcel photos.

15Two apps from one codebase

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

AppFlavourName on the phoneAndroid application id and iOS bundle idLink schemeWho signs in
Rider appriderFarelanecom.farelane.riderfarelane://Riders. They sign up in the app with their phone number (or email and password).
Driver appdriverFarelane Drivercom.farelane.driverfarelane-driver://Drivers. They sign up in the app and apply; you approve them in the admin.

Change the names and ids to your own before you publish (chapter 17). An account signs in only to its own app: a rider who opens the driver app is refused with wrong_app and told to use the rider app.

First run

  1. Open a terminal in farelane_mobile_flutter/ and create the settings file:
    cp .env.example .env
  2. In .env, set API_BASE_URL to your server, for example https://rides.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 rider --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 (rider or driver) and its build configurations, such as Debug-rider. 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) falls back to APP_ROLE in the .env, then to the rider app.

Rider app: sign in with a phone number
Rider app: sign in with a phone number
Driver app: sign in, then apply
Driver app: sign in, then apply

16Every 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 Farelane server, without /api/v1, for example https://rides.yourbrand.com. Required.
MAP_PROVIDERosm (OpenStreetMap, no key) or google. Empty: the app uses the map the admin chose in Settings → Maps. Google without its key below falls back to OpenStreetMap, so a map always shows (chapter 12).
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 and ride alerts (chapter 13). The app ids differ per app, so keep one .env file per app. Empty: the app runs without push.
DEMO_LOGINStrue shows the one-click demo sign-ins on the sign-in screen, 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): rider or driver.
SAMPLE_DATAtrue turns on sample mode: the app answers every call from its own built-in Lisbon and Porto data and needs no server. Keep false for every build you publish.
SAMPLE_SCENESample mode only: the moment the app opens on, for example searching, bidding, on_trip, payment_failed or parcel in the rider app and offer, offer_bid, at_pickup or ended_cash in the driver app. Empty: each app's own start. The full list is in lib/core/services/api/sample/sample_backend.dart.

Sample mode

Sample mode is for changing the look of the apps without a server: every screen fills from the built-in sample cities, and rides move on by themselves. Try it with:

flutter run --flavor rider --dart-define-from-file=.env --dart-define=SAMPLE_DATA=true --dart-define=SAMPLE_SCENE=on_trip

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 service

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

17Make 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.rider and com.yourbrand.driver.

The quick way: one command

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

node tools/rename.mjs --name "CityRide" --id com.acme.cityride --dry       # only shows what would change
node tools/rename.mjs --name "CityRide" --id com.acme.cityride --color "#0EA5E9" --icon rider.png --driver-icon driver.png --icon-bg "#12161C"
OptionWhat it does
--nameThe brand people see. Replaces every "Farelane" in text: the app names ("CityRide", "CityRide Driver"), the emails, the starter legal pages and the web pages' default name. Letters, digits, spaces, dots and hyphens, up to 30 characters.
--idThe base of the two app ids, in reverse-domain form and lower case: com.acme.cityride gives com.acme.cityride.rider and com.acme.cityride.driver, on Android and on iOS. Set it before the first store upload.
--schemeOptional. The apps' link schemes: cityride:// and cityride-driver://, also on the page that brings people back from a Stripe page. By default the name in lower case without spaces. The script also changes APP_SCHEME in .env.example; set the same value in your own .env.
--colorOptional. The brand colour (hex) of the apps' theme and of the web pages' default; the lighter and darker tints for the light and dark themes are worked out for you.
--icon, --driver-iconOptional. Square PNGs of at least 1024 px with no transparency: the rider app's icon, and the driver app's own (without it, the driver app gets --icon too). The script copies them to farelane_mobile_flutter/assets/icon/ and runs flutter_launcher_icons for each app for you.
--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 (farelane_mobile_flutter, farelane-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 two 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 13). If you use Google Maps, add the new ids to your key restrictions (chapter 12).
  2. Rebuild the server and web pages: docker compose up -d --build. The company name, logo and colour on the web can still change at any time in Admin → Settings → General.
  3. Build the apps again (chapter 18).

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: farelane_mobile_flutter/android/app/build.gradle.kts.

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

// Each app's deep-link scheme (yourbrand://pay/return brings the rider back from Stripe Checkout).
val urlSchemes = mapOf("rider" to "yourbrand", "driver" to "yourbrand-driver")

Also change applicationId in defaultConfig to the rider id. The namespace (com.farelane) 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 farelane_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-rider, Release-rider, Profile-rider, and the same for driver. Set the rider values on the three rider configurations, and the driver values on the driver ones.
  3. Under Signing & Capabilities, choose your own Apple team (the project uses automatic signing and carries no team of ours). Keep the Push Notifications, Time Sensitive Notifications and Background Modes (Location updates, Remote notifications, Background fetch) capabilities.

By hand: names inside the apps

The name shown inside each app comes from lib/core/constants/app_role.dart ('Farelane' and 'Farelane Driver', with the ids and schemes). A few on-screen texts name the brand too: search the lib/ folder for Farelane and change them. On iOS, the permission prompts are in ios/Runner/Info.plist (NSCameraUsageDescription, NSLocationWhenInUseUsageDescription, NSLocationAlwaysAndWhenInUseUsageDescription, NSPhotoLibraryUsageDescription).

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

Logo and app icons

  • App icons: the sources are farelane_mobile_flutter/assets/icon/rider.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 farelane_mobile_flutter. It writes the Android icons to android/app/src/rider/res/ and android/app/src/driver/res/ and the iOS icon sets AppIcon-rider and AppIcon-driver. 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/components/fl_app_mark.dart. The launch screens are android/app/src/main/res/drawable/launch_background.xml and ios/Runner/Base.lproj/LaunchScreen.storyboard.
  • The web logo: upload yours in Admin → Settings → General; until then the web pages show the Farelane mark (PNG, SVG or WebP, up to 1 MB).

By hand: colours and fonts

The apps' whole look lives in one file, lib/core/theme/fl_theme.dart: every screen reads its colours, sizes and type from there, never a fixed value, in light and dark.

  • Brand colour: Farelane ships "asphalt" #12161C with a "lane cyan" #06A8C9: FlColors.asphalt and FlColors.cyan, and in the two colour sets FlColors.light and FlColors.dark the lane (buttons, the route), laneInk (cyan words on white) and laneSoft (soft cyan fills) colours. Change those for your brand; sos, ok and warn are the alert, success and warning colours.
  • Corners, sizes and type: FlRadii, FlSizes (button and field heights, page padding) and FlText (every text style).
  • Font: the apps use Manrope, bundled in assets/fonts/ (SIL Open Font License). To use another font, add its files there, list them under fonts: in pubspec.yaml and change the family name in the theme.

The web pages have their own colours in apps/frontend/src/styles.css; the brand colour from Settings → General overrides the cyan at run time without a rebuild.

  • Back from Stripe: after a Stripe page (saving a card, a top-up, paying a ride or a driver's settlement), Stripe sends the person to APP_URL/api/v1/pay/return. That page opens farelane://pay/return (the driver app's farelane-driver:// for a settlement), with a "Back to the app" button for when the app does not open by itself. The server takes the scheme from APP_SCHEME; change it together with the apps' scheme.
  • Notifications: tapping a push opens the right screen (the ride, the offer, the chat, the wallet).
  • Links out: the apps open phone calls, email, the driver's navigation app and web pages.

18Build release files

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

Android: sign, then build

  1. Make an upload key once (keep the file and its passwords safe and backed up; one key can sign both apps). Run this in your home folder or wherever you keep keys:
    keytool -genkey -v -keystore upload-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias upload
  2. Create farelane_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 rider --dart-define-from-file=.env.rider
    flutter build apk --flavor rider --dart-define-from-file=.env.rider
    The files land in build/app/outputs/bundle/riderRelease/app-rider-release.aab and build/app/outputs/flutter-apk/app-rider-release.apk. Repeat with driver and .env.driver.

iOS: archive and upload

  1. In your Apple Developer account, under Certificates, Identifiers & Profiles → Identifiers, register the two bundle ids with the Push Notifications and Time Sensitive Notifications capabilities. Xcode can do this for you with automatic signing.
  2. In App Store Connect, create the two apps (Apps → + → New App) with those bundle ids.
  3. Build the archive and the IPA:
    flutter build ipa --flavor rider --dart-define-from-file=.env.rider
    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 driver.

19Publish the two apps

Each app is published separately, under your own developer accounts and your own brand. Farelane's demo names, ids and screenshots are not yours to publish. The driver app asks for more than most apps (background location, a foreground service, full-screen alerts), so both stores ask you to explain why.

Google Play

  1. In the Play Console, choose Create app twice (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 collect location (pickup and destination; the driver's position while online and on a trip), photos (driver documents, parcel photos, profile pictures), name, phone number and email for the account, and payment info through Stripe (card numbers stay with Stripe).
  3. Answer the App content declarations for the driver app:
    • Location permissions (background location): "Drivers share their location while they are online so the service can offer them nearby ride requests and riders can follow their car; it stops when they go offline." Google asks for a short video showing the in-app explanation and the "Go online" switch.
    • Foreground service: type location; the "You're online" notification while a driver is available for rides.
    • Full-screen intent: ride requests are time-critical alerts the driver must answer within 15 seconds, like an incoming call.
    The rider app uses location only while it is open and needs none of these.
  4. 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.
  5. 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, for example https://rides.yourbrand.com/legal/privacy) and the App Privacy answers.
  2. The driver app uses the location, remote notifications and background fetch background modes and time-sensitive notifications. In the review notes, explain that drivers share their location while online to receive ride requests, and that ride requests are time-sensitive.
  3. Apple's review needs a working account in each app. Give a test rider and an approved test driver under App Review Information (email and password sign-in works without SMS), and a city whose zone covers the address you name, or explain how to book. Say that the two apps serve the two sides of one service.
  4. Both apps let people delete their account in the app (Account → Delete account; 30 days to change their mind), as Apple requires for apps with sign-up.
  5. Submit each build for review.

Links to your apps

Once an app is live, paste its store addresses in Admin → Settings → Apps: 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 website then shows the rider app's badges, and the driver app's on its "Drive" page. An app with no address shows no badge, so leave the fields empty until the apps are published.

Part 04

Run the service

Who uses what: you and your staff use the web admin (/admin, sign in at /signin); riders use the rider app; drivers use the driver app. Every rule in this part is checked by the server, so the apps and the web pages can never get around it; the numbers are the defaults, and each says where to change it.

20How a ride works

From the request to the rating, with the numbers. This chapter is a city with fixed upfront fares; chapter 21 shows what changes in a city where riders offer their own fare.

  1. Pickup inside a zone. The rider sets the pickup on the map. It is served when the point lies inside an active zone of an active city; otherwise the app says which city is nearest and how far, and offers Notify me, which puts the rider on the waitlist (chapter 29).
  2. Quote. The rider adds a destination (and up to a few stops) or chooses "ride without a set destination". The server measures the route once (chapter 12) and prices every vehicle type the city offers with the fare formula (chapter 29). A quote can be booked for 10 minutes. A promo code is checked here and again when booking.
  3. Request. The rider picks a vehicle type and a way to pay: cash (if the city allows it), card (a hold is placed at once, or for a scheduled ride when its search starts, chapter 8) or wallet (it must hold the fare). A rider with an unpaid ride settles it first. A scheduled ride is booked 30 minutes to 7 days ahead.
  4. Dispatch, one driver at a time. The ride is offered to the nearest free driver of that vehicle type who is approved, online, seen in the last 30 seconds, within the city's search radius (6 km) and not asked about this ride before. The offer rings for 15 seconds. Declined, missed, or the driver went offline or lost the connection: the next nearest driver is asked at once. After 3 drivers without an accept, or with nobody near, the ride ends as no driver: nothing is charged, the card hold is let go and the rider can try again.
  5. Accept, locked. The first accept takes the ride; the server checks the offer and the ride in one locked step, so a second accept (or an accept after the 15 seconds) gets "taken". A driver has one open offer and one live ride at a time. Three missed offers in a row take a driver offline, with a push saying why.
  6. On the way and arrived. The rider follows the car on the map with its time to pickup, sees the driver's name, photo, rating, car and plate, and can chat or call (phone numbers show only while the ride is live). The driver taps "Arrived"; the rider is told.
  7. Paid waiting. The first 3 minutes after "Arrived" are free; then each whole minute until the trip starts costs the city's waiting price (Lisbon €0.20). After 5 minutes the driver may cancel as a no-show, and the rider pays the cancellation fee.
  8. PIN. The rider's app shows a 4-digit PIN (never 0000 or four equal digits); the driver types it to start, which proves the right person got in. Five wrong tries lock the start until the rider shows a new PIN. Riders can turn the PIN off for themselves, unless the city requires it.
  9. The trip. The driver's phone sends its position every few seconds; while the trip is in progress those points are the ride's GPS trail. The rider can change the destination or add a stop (the fare is quoted again at that moment), share a trip link and raise an SOS (chapter 23).
  10. Final fare. The driver ends the trip. In a fixed-fare city the upfront price is kept, unless the trail was more than 25% longer than the planned route (then the trip is priced from the trail) or the destination or stops changed. A ride without a set destination is priced from the trail (metered). Paid waiting is added and a promo discount taken off.
  11. Payment. Card: captured from the hold (chapter 8). Wallet: one guarded spend that never goes below zero. Cash: the driver confirms "cash received"; if the rider can't pay, the ride is marked unpaid and the rider settles it in the app with the wallet or a card.
  12. Rating and tip. Rider and driver rate each other once (1 to 5 stars). The rider can add a tip (up to 200.00) on a card or wallet ride; cash rides are tipped in cash. The receipt is emailed when the ride is paid.
Who earns what

The booking fee is the platform's. The commission (set per city, Lisbon 20%) is taken from the fare without the booking fee, plus waiting. A promo discount is paid by the platform and never lowers the driver's earning. Tips go to the driver whole. The worked example is in chapter 29.

Cancelling

Who and whenFee
Rider, while searching for a driverFree
Rider, within 2 minutes of a driver acceptingFree
Rider, later, or after the driver arrivedThe city's cancellation fee (Lisbon €2.50). The app shows the fee before the rider confirms.
Rider, a scheduled ride before its search startsFree
Driver, "No-show" after 5 minutes of waiting at the pickupThe rider pays the cancellation fee.
Driver hands back an accepted ride before the trip startsFree for the rider; the ride goes to the next driver.
Staff cancel a ride (chapter 26)Free, unless staff choose to charge the fee and a driver was on the way.

A cancellation fee is split like a fare: the city's commission to the platform, the rest to the driver. The free times are in Settings → Dispatch (chapter 35); the fee is set per city and vehicle type.

Ride statuses

StatusMeaning
ScheduledBooked for later; the search starts 15 minutes before the pickup time.
SearchingLooking for a driver (an offer is ringing, or rider-offer proposals are coming in).
No driverNobody took it; nothing was charged.
AcceptedA driver is on the way to the pickup.
ArrivedThe driver is at the pickup; the waiting clock runs.
In progressThe trip started with the PIN (or the parcel photo).
CompletedEnded with its final fare. Its payment is held, paid, unpaid, refunded or partly refunded.
CancelledBy the rider, the driver, your staff or the system, with the reason and any fee.

Every change writes an event on the ride (the timeline in the admin), updates every open screen at once and sends a push where it matters.

Scheduled rides

A rider books 30 minutes to 7 days ahead and gets a reminder. The search starts 15 minutes before the pickup time (Settings → Dispatch); until then the rider can cancel for free, or change the pickup time (Edit time, again 30 minutes to 7 days ahead) at no cost. A card ride gets its hold when the search starts, not at booking (a hold lasts only about 7 days); if the bank refuses it then, the rider is told and the ride goes ahead, with the fare charged to the card when it ends. A dispatcher can give a scheduled ride to one driver when booking it (chapter 25): the driver is told, confirms it in the driver app (Scheduled rides), and is offered it first when the search starts; if they let that offer pass, the usual search goes on. The driver can hand it back before the trip, which returns it to the open requests. If the rider changes the time, the driver is told and confirms again.

21Rider offers (bidding)

In a city set to riders offer a fare (Porto in the sample data), the rider names a price and nearby drivers answer. Each city has one mode or the other; you can run both in different cities.

  1. The suggested fare. The rider sees a suggested fare: the normal quote rounded to the nearest 0.10. The rider may offer less, down to the city's lowest offer (80% of the suggested fare, rounded down to 0.10), or more.
  2. Broadcast. The request goes at once to up to 8 nearest free drivers of that vehicle type.
  3. Drivers answer. Each driver may accept the rider's price or counter with +0.50, +1.00 or +1.50 (never above twice the suggested fare). Either answer is a proposal the rider sees with the driver's name, rating, car and time to pickup, for 30 seconds.
  4. The rider chooses. Accepting one proposal gives the ride to that driver (the same locked step as an accept); every other proposal and offer closes. The rider may also decline a proposal, or raise the offer, which sends a new round to the same drivers and new ones.
  5. Time limit. A request with no proposal chosen ends as no driver after 2 minutes (counted again after each raise).
  6. The agreed fare is final, plus paid waiting. There is no detour rule and no booking fee: the platform takes only its commission.
Worked example: Porto

Cais da Ribeira → Casa da Música by Car, 3.9 km and 13 minutes on Porto's tariff (base 1.80, 0.60 per km, 0.14 per minute, booking fee 0.40): 1.80 + 2.34 + 1.82 = 5.96, plus 0.40 = 6.36, so the suggested fare is €6.40 and the lowest offer €5.10. Tiago offers €6.00; a driver could accept it or counter with €6.50, €7.00 or €7.50. Agreed at €6.00, Porto's 15% commission is €0.90 and the driver earns €5.10.

The four numbers (lowest offer 80%, offer lifetime 120 s, counter lifetime 30 s, 8 drivers) are set per city in Cities and zones (chapter 29).

Rider app: drivers' answers to a €6.00 offer in Porto
Rider app: drivers' answers to a €6.00 offer in Porto

22Parcels

Riders send a parcel across town with the same apps and drivers. A parcel is a ride with a few extra steps that prove it reached the right person.

  • Sizes: Small (up to 5 kg, a shoebox), Medium (up to 10 kg, a backpack) and Large (up to 20 kg, a carry-on case). Parcels go by the vehicle types marked "carries parcels" (Moto and Car in the sample data); Large goes by Car only.
  • Price: the ride fare of that vehicle type plus the city's parcel handling fee (€1.00 in the sample cities).
  • Receiver: the sender gives the receiver's name and phone and a note. The server makes a 4-digit receiver code, shown only to the sender and texted to the receiver when SMS is set up.
  • Who pays: the sender, in any way the city allows, or the receiver in cash at the drop-off (cash on delivery, only where the city takes cash). The driver sees on the offer and at the door that the receiver pays, and collects the cash once the code is checked; if the receiver can't pay, the parcel is marked unpaid and the sender settles it in the app.
  • Pickup: the driver photographs the parcel; the photo starts the trip.
  • Drop-off: the driver photographs it at the door and types the receiver's code. Five wrong codes stop the step: the driver calls the sender.
  • Nobody there: 10 minutes after reaching the drop-off (Settings → Dispatch), the driver may take the parcel back to the sender; the whole trip, there and back, is then priced from the GPS trail.

The sender follows the parcel like a ride, sees both photos, and the admin's Parcels page shows them with the code check (chapter 26).

Rider app: send a parcel
Rider app: send a parcel
Driver app: photo and receiver code at the door
Driver app: photo and receiver code at the door

23Safety: SOS, PIN and trip link

SOS

During a ride (accepted, arrived or in progress) the rider and the driver each have a safety sheet with a Call button for the local emergency number (Settings → Safety, 112 by default) and an SOS alert that is held down to send, so it is never sent by mistake. An alert:

  • keeps where the person was and appears at once on every open admin screen: a red banner on the overview and a count on Safety (chapter 33);
  • emails your safety address (Settings → Safety; the support email when empty);
  • texts the rider's emergency contacts the trip link (when SMS is set up; otherwise listed as "not sent: no SMS provider").

The person can tap "I'm safe": the alert stays open for your staff, marked safe. Only staff close an alert, with a note. On the demo, a ride with an open SOS is never moved by the simulator.

PIN

See chapter 20: 4 digits per ride, typed by the driver to start, 5 tries. A city can require it on every ride.

Trip link

The rider shares a link (APP_URL/t/…, a random code) that shows the car moving on a map, the driver's first name, car and plate and the arrival time, to anyone, without an app. It hides every phone number and the rider's last name, and stops working 30 minutes after the ride ends (Settings → Safety), after which it says the link has expired.

Share every trip. In the rider app's safety settings, a rider can turn on Share every trip for an emergency contact. When each trip starts, that contact gets a text with the live trip link ("Ana started a Farelane trip (FL-48213). Follow it live: …"). It needs SMS (chapter 9) and is sent once per ride.

The shared trip page: the car on the map, no phone numbers
The shared trip page: the car on the map, no phone numbers
Rider app: an SOS sent to the emergency contact and your staff
Rider app: an SOS sent to the emergency contact and your staff

24Admin: overview and live map

The admin lives under /admin. Its sidebar has five groups: Operate (Overview, Live map, Dispatcher, Rides, Parcels, Safety), People (Drivers, Riders, Staff), Pricing (Cities and zones, Vehicle types and fares, Promo codes), Money (Payouts, Reports) and System (Settings, Setup). Each role sees only what it may open (chapter 34). On a phone the admin has a bottom bar with Overview, Dispatcher, Rides and More.

Overview

The live tiles (drivers online, rides live, parcels live, scheduled rides in the next hour, drivers waiting for approval), today so far (rides, gross fares, commission) with rides per hour, a small live map, the live rides, today's numbers per city and a Needs attention list: open SOS alerts, drivers and documents to check, unpaid rides, failed background jobs and setup rows that need a look. An open SOS shows as a red banner on top. Everything updates live; a city filter narrows it to one city.

Live map

Every online driver on one map: free, on a trip, or offline in the last 30 minutes, filtered by city, vehicle type and status, with a search for a driver, a plate or a ride. Click a car for the driver's card: their trips and earnings today and this week, and their current ride.

The overview with an open SOS banner and the needs-attention list
The overview with an open SOS banner and the needs-attention list
The live map with a driver's card open
The live map with a driver's card open

25Dispatcher

For phone bookings: someone calls, your dispatcher books the ride for them and watches it go out.

  1. Caller. Type the caller's phone number. A known rider shows with their saved places, last trips, saved cards and usual way to pay; a new caller needs only a name (an account is made for that number).
  2. Route. Pickup (search an address or pick a saved place) and, optionally, the drop-off. The prices of every vehicle type show as soon as the pickup is set.
  3. When. Now, or a day and time (30 minutes to 7 days ahead).
  4. Payment. Cash, or for a known rider their wallet or one of their saved cards (a card hold is placed as in the app).
  5. Dispatch. Auto-dispatch sends it to the nearest driver exactly like an app booking. Pick a driver lists the nearest free drivers of that type with their distance and time. For a ride now, it is offered to the one you choose first (if they let it pass, the usual search goes on). For a scheduled ride, the driver you choose is booked for it at once, confirms it in the driver app, is reminded before the pickup and gets the offer first when the search starts.
  6. A note for the driver ("door, landmark, help the caller needs") goes with the offer.

The live requests list beside the form shows rides still looking for a driver (from the apps and the phone), the last hour's "no driver" rides and the scheduled rides of the next two hours, with how many drivers were asked. A caller who already has a live ride is refused with their ride's number, so nobody books twice.

The dispatcher: a known caller, the fares, and the nearest free drivers
The dispatcher: a known caller, the fares, and the nearest free drivers

26Rides and parcels

Rides and Parcels are two tables with tabs (live, scheduled, completed, cancelled, unpaid, all), filters for city, vehicle type and payment, a search by ride number, rider, driver or plate, and a CSV export. Click a row for the ride sheet:

  • the timeline of every event with who did it (status changes, receipts emailed, refunds, reassigns, the trip link running out);
  • the map with the planned route and the GPS trail;
  • the fare breakdown (upfront price, waiting, stops, booking fee, discount, tip, total) and the split: commission, the platform's share and what the driver earns;
  • the rider and the driver, the payment and its Stripe steps, the dispatch log (which drivers were asked) and any problem the rider reported;
  • for parcels: the pickup and drop-off photos and when the code was confirmed.

Actions

ActionWhat it doesWho
Cancel rideCancels for the rider with a reason. Free, unless you tick "charge the cancellation fee" while a driver was on the way.Any staff
Reassign driverBefore the trip starts: takes the ride from its driver and looks again, first offering it to the driver you pick (if any).Any staff
RefundGives money back to the card (through Stripe, 5 to 10 days) or to the rider's wallet (at once), with a reason. Never more than was paid; partial refunds add up. The rider gets a new receipt.Admin, owner
Copy trip link, call rider, message driverQuick ways to help on a live ride.Any staff
Rides: tabs, filters and the live rides
Rides: tabs, filters and the live rides
A ride sheet: timeline, trail, fare and split, refund and cancel
A ride sheet: timeline, trail, fare and split, refund and cancel

27Drivers and documents

Drivers sign up in the driver app and apply: city, vehicle type, the vehicle (make, model, colour, plate, year) and five documents: driving licence, ID, insurance, vehicle registration and a photo. You approve them here.

  1. Open Drivers → Waiting approval (the sidebar shows how many). The driver sheet shows each document full size with its expiry date.
  2. Approve or Reject each document; a rejection needs a reason, which the driver sees in the app and can answer with a new upload.
  3. Approve the driver. A rejected or missing document stops it. The driver is told and can set up ride alerts and go online.

Other tabs show active, online, suspended and rejected drivers. The sheet also has the vehicle (you can change the city, vehicle type or vehicle), this week's earnings, the last trips and payouts.

  • Suspend (with a reason): the driver goes offline at once, their open offer and any ride not yet started go to other drivers, and the app shows why. A driver in the middle of a trip is suspended once it ends. Approve again lifts it.
  • Expired documents: a driver with a document past its expiry date cannot go online until they upload the new one.
  • Message (on the Drivers page, or in a driver sheet's More menu): a title and up to 500 characters, shown in the app's notifications and sent as a push, to one driver, to the approved drivers you tick, or to every approved driver in one city or every city (only those online now, if you like). Riders are messaged the same way from Riders.
  • More → Download their data saves everything kept about the driver as a JSON file (chapter 40).

Reading the driver list is open to every staff role; approving, rejecting, suspending, messages and exports need an admin or the owner.

Drivers: waiting approval, active and suspended
Drivers: waiting approval, active and suspended
A driver sheet: approve or reject each document
A driver sheet: approve or reject each document

28Riders and wallets

The rider table (active, suspended, deleted) with a sheet per rider: profile, last trips, saved cards (brand and last 4 digits), problems they reported and their wallet with every entry.

  • Suspend a rider (with a reason): they are signed out everywhere and cannot book until you let them back. Admin or owner.
  • Wallet adjustment: the owner can add credit, or take it off, with a reason that shows on the entry. A wallet never goes below zero, and every change is logged.
  • More → Send a password reset emails a rider who signs in by email a link to set a new password: it works for one hour and is never shown to staff. Riders who sign in by phone have no password, so the item is not shown for them. Admin or owner.
  • More → Download their data saves everything kept about the rider as a JSON file (chapter 40). More → Message sends them a message, as for drivers.
Where wallet money comes from

Only from card top-ups (5.00 to 200.00, confirmed by Stripe), refunds you give and the owner's adjustments. Riders spend it on rides and tips; it is never paid out.

A rider sheet with the wallet and its entries
A rider sheet with the wallet and its entries

29Cities, zones, vehicle types and fares

This is how you open a city and set what rides cost. Admins and owners.

Open a city, step by step

  1. Cities and zones → New city. Name, country, time zone and the centre on the map. A new city stays off until it has a zone and fares.
  2. Pricing mode: fixed upfront fares, or riders offer a fare (chapter 21). Commission in percent, cash on or off, and whether every ride needs the PIN.
  3. Draw the zones. On the city's map, draw one or more service zones over the streets you serve, and drag their corners to adjust. A pickup must be inside an active zone; drop-offs may be anywhere.
  4. Vehicle types and fares. Turn on the vehicle types the city offers and set each one's fare (below).
  5. Turn the city on. It appears in the apps, on the website's Cities page and in the dispatcher.

Each city also has its dispatch and rider-offer numbers:

SettingDefaultAllowed
Offer time (how long an offer rings)15 s5 to 120 s
Drivers asked before "no driver"31 to 20
Search radius6 km0.5 to 50 km
Average speed (for straight-line estimates)24 km/h5 to 120
Lowest offer (rider-offer cities)80%10 to 100% of the suggested fare
Offer lifetime (rider-offer cities)120 s30 to 900 s
Counter lifetime (rider-offer cities)30 s10 to 300 s
Drivers asked at once (rider-offer cities)81 to 30

Where people ask for the service

The Cities and zones page has an Asked for service card: the people who asked to hear when you reach their place, with the places asked for most on top, then everyone, newest first, with how to reach them. They come from the website's form (10 sign-ups an hour per visitor address) and from the rider app, where a pickup outside every city shows "Not in your area yet" with Notify me. Use it to choose where to open next, tell those people when you do, then Remove their entry. Admins and owners. On the public demo the emails and phone numbers are shown only in part.

Vehicle types

The five shipped types are Moto (1 seat), Tuk-tuk (3), Car (4), Comfort (4) and XL (6). In Vehicle types and fares you rename them, change their seats and note, say whether they carry parcels, add your own types and turn types off (a type is never deleted, so old rides keep their name).

The fare

Each city sets a fare for each vehicle type it offers, in the platform currency:

FieldWhat it isLisbon Car
BaseAdded to every ride€2.00
Per kmPer kilometre of the route€0.65
Per minutePer minute of the route's driving time€0.15
MinimumThe least a ride costs, before the booking fee€4.00
Booking feeThe platform's, on every fixed-fare ride; never on an agreed rider-offer fare€0.50
Free waitingTime after "Arrived" before waiting is paid3 min
Waiting per minuteEach whole minute after the free time€0.20
Cancellation feeLate cancels and no-shows€2.50
Stop feeEach extra stop€0.75
Parcel feeAdded to a parcel€1.00
quote = max(minimum, base + km × per km + minutes × per minute) + stops × stop fee + booking fee (+ parcel fee)

Rounded half up to the cent. A change applies to new quotes; rides already booked keep the fare they were booked with.

Worked example: ride FL-48213 in Lisbon

Rua Augusta 24 (Baixa) → LX Factory (Alcântara) by Car, a planned route of 5.4 km and 15 minutes, paid by card, with a €1.00 tip.

StepWorkingAmount
Base + distance + time2.00 + 5.4 × 0.65 + 15 × 0.15 = 2.00 + 3.51 + 2.25 (above the €4.00 minimum)€7.76
+ booking fee€0.50
Upfront pricewhat the rider sees before booking€8.26
Card hold8.26 + the larger of 20% (1.65) and 3.00€11.26
The tripThe GPS trail measured 5.6 km: under 25% more than 5.4 km, so the upfront price is kept. The driver waited 2 minutes (within the free 3), so no waiting.€8.26
Commission20% of 7.76 (the fare without the booking fee)€1.55
Driver earns7.76 − 1.55, plus the €1.00 tip€7.21
Platform keeps1.55 commission + 0.50 booking fee€2.05
Rider pays8.26 captured from the hold, then the 1.00 tip€9.26

Had the trail been more than 6.75 km (25% over 5.4), the ride would have been priced from the trail's own kilometres and minutes. Had the driver waited 6 minutes, 3 paid minutes would add €0.60 (and €0.48 more for the driver after commission).

How the trail is measured

The distance of a trip is the sum of the steps between the driver's GPS points while the trip is in progress, leaving out points less accurate than 50 m, jumps faster than 200 km/h and steps shorter than 5 m (standing still). A gap in the signal of more than 60 seconds and 500 m counts as the straight line × 1.3.

A city: pricing mode, commission, cash and its zone on the map
A city: pricing mode, commission, cash and its zone on the map
Vehicle types and fares, per city
Vehicle types and fares, per city

30Promo codes

Admin → Promo codes → New code:

FieldWhat it does
CodeWhat riders type, for example WELCOME5.
Kind and amountA fixed amount off, or a percentage with an optional largest discount (for example 10% up to €3.00).
Max uses, per riderHow many rides may use it in all, and per rider.
CitiesOnly in these cities (empty: everywhere).
Starts, endsWhen it works.
First ride onlyOnly for a rider's first ride.
ActiveTurn it off without deleting it.
  • The discount is never more than the fare without its booking fee, and it is paid by the platform: the driver earns as if there were no promo.
  • A code is checked when the rider sees the price and again inside the booking, with the code locked, so its last use goes to one rider only. A cancelled ride gives its use back; a completed one keeps it with the discount the final fare allowed.
  • In the rider app, a rider types a code at Choose a ride or picks one of their codes there or under Account → Promotions. That list shows only codes running now that the rider can still use, with the uses left (a first-ride code only before the first ride).
  • When a code doesn't apply, the rider is told why in plain words, for example "This code has ended." or "This code isn't active yet."
  • A code never used can be deleted; a used one is turned off instead, so old rides keep it.
Promo codes with their uses
Promo codes with their uses

31Payouts

You collect card and wallet money in your Stripe account; drivers keep the cash they collect. Each week the Payouts page tells you what you owe each driver, or what a driver owes you.

due = fares after commission + tips + their share of cancellation fees − cash the driver collected
  • A week runs Monday to Sunday in the platform time zone (Settings → General) and is paid the next Monday.
  • On a cash ride the driver keeps the whole amount the rider paid, so it counts as cash collected.
  • Below zero, the driver owes you: they can pay it by card from the driver app ("Pay what you owe", a Stripe page), which brings the week back to zero; or you settle it with them yourself.
  • Mark paid records the payout of a finished week for every driver (or the ones you pick), once: marking again changes nothing. You pay drivers yourself, by bank transfer for example; the driver app shows the payout details the driver saved and their payouts.
  • CSV downloads the week as a spreadsheet for your bank or accountant.
Example: Rui's week, 23 to 29 November

47 trips: €473.80 in fares after commission + €38.50 in tips = €512.30 earned. He collected €142.00 in cash on cash rides, so €370.30 is due on Monday 30 November.

The week's payouts: earnings, cash collected and what is due
The week's payouts: earnings, cash collected and what is due

32Reports

Rides and money for any period (the last 30 days by default, up to 400 days), for one city or a vehicle type, grouped by day, week, month, city or vehicle type: rides, gross fares, commission, booking fees, discounts, tips and refunds, with the totals. CSV downloads the same report as a spreadsheet. Admins and owners.

Reports: rides, gross fares and commission by day
Reports: rides, gross fares and commission by day

33Safety alerts

Admin → Safety lists the open SOS alerts first: who raised it (rider or driver), the ride, where they were on a live map, whom the emergency texts reached, and whether the person tapped "I'm safe". Call the rider or the driver from there, then Resolve the alert with a note of what happened. The history keeps every alert with its note. Every staff role can see and resolve alerts; the sidebar's count and the overview's banner show open ones at all times.

Safety: an open SOS with the live position
Safety: an open SOS with the live position

34Staff and roles

The owner invites staff in Admin → Staff with their email and role; the invitation email is valid for 7 days (with SMTP off, its link is in the app's log). The owner can change a role or remove a staff member, who is signed out at once. There is always at least one owner.

RoleMay open
OwnerEverything, including Settings, Setup, Staff and wallet adjustments.
AdminEverything except Settings, Setup, Staff and wallet adjustments: drivers' approval, cities, fares, promo codes, payouts, reports, refunds.
DispatcherOverview, live map, dispatcher, rides and parcels (cancel, reassign), safety alerts, and reading drivers and riders.

The server checks the role on every request; a page a role cannot use answers "Your role can't open that".

Staff and invitations
Staff and invitations

35Settings and legal pages

Admin → Settings (owner only). Each screen saves on its own; values saved here win over .env.

ScreenWhat it holds
GeneralCompany name, brand colour and logo, support email, phone and page, help pages link, currency and time zone.
PaymentsThe Stripe keys and webhook address; card payments and the wallet on or off (chapter 8).
MapsThe map, tile address and credit, Google key, routing server and address search (chapter 12).
DispatchThe timings that are the same in every city (below).
NotificationsThe Firebase project and service account (chapter 13).
SMSThe Twilio account (chapter 9).
EmailThe SMTP server and the wording of the platform emails (chapter 10).
SafetyThe local emergency number the apps' Call button dials (112 by default; for example 911 in the US), where SOS alerts are emailed, and how long trip links work after a ride (30 minutes).
Legal pagesTerms, privacy, refunds, cookies and driver terms (below).
AppsThe store links of both apps, and sign-ups: open (riders register, drivers apply) or closed (invitations only).
StorageWhere files go and the upload room per person (chapter 11).
MaintenanceMaintenance mode with a message: the apps and website show it, the admin keeps working.
ServerVersion, address, database, last migration, install date and whether this is the public demo.

Dispatch timings

SettingDefaultAllowedWhat it does
Driver seen within30 s10 to 600 sOnly drivers whose phone sent a position this recently get offers.
Connection grace60 s10 to 600 sA driver whose live connection dropped stays online this long.
Missed offers in a row31 to 20Then the driver is taken offline and told why.
Scheduled rides start searching15 min5 to 120 minBefore the pickup time.
Free cancelling120 s0 to 1,800 sAfter a driver accepts.
No-show after300 s60 to 3,600 sOf waiting at the pickup.
Parcel wait at drop-off600 s60 to 3,600 sThen the driver may return the parcel.
A quote can be booked for10 min2 to 60 min

Offer time, drivers asked and search radius are per city (chapter 29).

Legal pages

Five pages written in Markdown with a preview: Terms, Privacy, Refunds, Cookies and Driver terms. They show on the website at /legal/terms, /legal/privacy, /legal/refunds, /legal/cookies and /legal/driver-terms and are linked from the apps. A new install starts with all five empty, and a page with no text is left out of the website and the apps. Farelane ships starter texts in apps/backend/seed/legal/ (Markdown files you can paste into the editor); loading the sample cities fills the pages with them while you have not saved your own. They are not legal advice, so have them checked for your country before you open.

Settings → Dispatch
Settings → Dispatch
Legal pages: Markdown with a preview
Legal pages: Markdown with a preview

36Rider app

  • First open: sign in with a phone number and a texted code (or email and password), allow location, and the app finds the city.
  • Home: the map at the pickup with the cars nearby and their times, "Where to?", saved places (home, work and more), a parcel button and scheduled rides. Places show their name, where they have one, with the street address under it ("LX Factory", "Rua Rodrigues de Faria 103"). A pickup outside every city shows "Not in your area yet" with the nearest city, Notify me and Browse anyway.
  • Choose a ride: each vehicle type with its price and time to pickup, the payment method, a promo code (typed, or one of the rider's codes with Use it), "schedule", and in a rider-offer city the offer with its suggested and lowest price.
  • Searching: how many drivers were asked; in a rider-offer city, the drivers' proposals to choose from, raise the offer or wait.
  • On the trip: the car on the map, the driver and car, the PIN, chat and call, change destination, share the trip link, SOS, and the price changes explained ("upfront price kept", "price updated for the new route", paid waiting so far).
  • Trip complete: the fare and its breakdown, rate the driver, tip, receipt, report a problem (a lost item or another problem goes to your staff).
  • Activity: upcoming and past rides and parcels with receipts. A scheduled ride can be moved (Edit time) or cancelled, free until its search starts.
  • Account: profile, payment methods (saved cards, wallet with top-ups and its entries), promotions (the codes the rider can still use), safety settings (emergency contacts, share every trip, PIN on every ride), notifications, help and delete account.
Choose a ride: prices and times per vehicle type
Choose a ride: prices and times per vehicle type
The driver is here: the PIN to start
The driver is here: the PIN to start
Trip complete: fare, rating and tip
Trip complete: fare, rating and tip
The wallet: top-ups, refunds and rides
The wallet: top-ups, refunds and rides

37Driver app

  • Become a driver: sign in, choose the city and vehicle type, add the vehicle and upload the five documents; follow each document's status (in review, approved, rejected with the reason) until approval.
  • Ride alerts: the set-up screen with the settings a locked phone needs and a test alert (chapter 13).
  • Home: go online or offline, today's trips, earnings and time online, and scheduled rides given to you.
  • An offer: rings for 15 seconds with what the driver earns (the fare after commission), the pickup distance and time, the trip, the payment method and the rider's first name and rating; parcels show their size. In a rider-offer city: accept the rider's price or one of three counter prices.
  • The trip: navigate to the pickup in Google Maps, Apple Maps or Waze, "Arrived" with the waiting clock, the no-show button after the wait, the PIN to start, navigate to the drop-off, end the trip; for parcels the photos and the receiver's code; chat, call and SOS.
  • Trip ended: what the driver earned, "cash received" or "rider can't pay" on cash rides, rate the rider.
  • Earnings: by day and week (trips, time online, fares after commission, tips, cancellation fees, cash collected, what is due), payouts and their dates, and paying back cash owed by card.
  • Account: vehicle and documents, payout details, ride alert sound and vibration, navigation app, notifications, help and delete account.
Online, waiting for an offer
Online, waiting for an offer
At the pickup: start with the rider's PIN
At the pickup: start with the rider's PIN
Trip ended: what the driver earned
Trip ended: what the driver earned
Earnings this week and the next payout
Earnings this week and the next payout
Part 05

The sample cities

38Lisbon and Porto, the sample cities

Two real cities with everything a ride service needs, so you can try every screen before you open your own. Their zones, places and the simulated drivers' routes follow the real streets (map data © OpenStreetMap contributors). Prices are in euros.

LisbonPorto
Pricing modeFixed upfront faresRiders offer a fare
Commission20%15%
Vehicle typesMoto, Tuk-tuk, Car, Comfort, XLMoto, Car, XL
Car farebase 2.00, 0.65/km, 0.15/min, minimum 4.00, booking fee 0.50base 1.80, 0.60/km, 0.14/min, minimum 3.80, booking fee 0.40
CashOnOn

Both cities share waiting (3 free minutes, then €0.20 a minute), the cancellation fee (€2.50), the stop fee (€0.75) and the parcel fee (€1.00).

  • People: riders Ana Ribeiro (Lisbon, a saved card and wallet credit), Tiago Sousa (Porto) and Carlos Matos; drivers Rui Costa (Lisbon, Toyota Corolla Hybrid), Paulo Neves, Marta Lopes and Hugo Pinto (Porto) and Joana Melo (Lisbon, a Moto courier); the owner Miguel Antunes and the dispatcher Nuno Ferreira. Every sample email ends in @example.com.
  • About 1,040 simulated drivers spread over both cities (about 320 of them online on the demo), each at its own spot on a real street, and six drivers waiting for your approval.
  • Promo codes: LISBOA3 (€3 off a ride in Lisbon), WELCOME5 (€5 off a first ride), PORTO10 (10% off in Porto, up to €3), SEND2 (€2 off a ride or parcel) and OUTONO5 (ended, so you can see how an ended code looks), each with past uses in the ride history.
  • Eight weeks of history: rides and parcels in both cities, priced by the same fare engine as a real ride, with ratings, tips, cash and card payments, and the drivers' weeks for the payouts page; and one open SOS alert to show the Safety page.
  • The starter legal texts.

Load it

docker compose exec app farelane seed-demo --confirm

It answers seeded: {…} with what it added, and takes a few seconds. Every row it adds is marked as sample data. --confirm is needed once your install has a real account (the owner the wizard made); without real accounts the command runs without it. Running it a second time changes nothing.

On a live service

The sample people have no passwords, so nobody can sign in as them outside demo mode, and the simulated drivers stand still outside demo mode (they are never offered real rides only because they never come online). Load the sample cities on a test copy to explore, and remove them before you open to the public. To try both apps with moving cars, use a test copy in demo mode (next chapter).

Remove it

Admin → Setup → Remove demo data (owner only). Only rows marked as sample data are deleted: the sample cities with their zones and fares, people, rides, promo codes, waitlist and their files, in one step that either does everything or nothing. It cannot be undone. The vehicle types stay (they suit any city). Rides of real riders in the sample cities go with those cities.

Change the sample cities

The data is in apps/backend/seed/demo.json: cities with their zones, fares and places, people, promo codes and the name lists of the simulated drivers. The sample document pictures of the drivers waiting for approval are in the documents/ folder next to it. To load your own file instead, set DEMO_SEED to its path (with its own documents/ folder beside it, or the documents stay without pictures).

39Demo 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 service; the shipped file has it "false". With it on:

  • The sample cities are loaded at start and reset every night at 03:00 UTC.
  • The sign-in pages show one-click sign-ins: on the web the owner and the dispatcher; in the rider app (built with DEMO_LOGINS=true) a Lisbon and a Porto rider; in the driver app a Lisbon and a Porto driver. They are limited per visitor address.
  • The simulator keeps both cities busy: simulated drivers answer offers in a few seconds (rider-offer proposals in 5 to 20 seconds), drive the rides along real streets, enter the PIN, end the trip and take the cash; simulated riders book rides and parcels. A sample account someone is using is left alone for 10 minutes, so a visitor signed in as a demo driver gets a real offer near them within seconds of going online (at most one every 40 seconds; every third is a parcel), and a visitor booking as the Lisbon rider is picked up by a simulated driver who drives the route. In Porto the visitor's driver is asked first; the simulated rider chooses their answer after a few seconds, and simulated drivers answer only after 20 seconds, so a visitor who waits can lose the ride to one of them. When a visitor's driver arrives for a simulated rider, the rider sends the PIN in the chat a few seconds later, as a real rider would read it out; on a parcel, the receiver's code arrives in the chat once the parcel is picked up.
  • Card payments use the server's own test page instead of Stripe; no text, push or receipt email is sent; the install wizard is off; secrets show only as set or not set.
  • Demo sign-ins are read-only for settings, money and other people's data (403 demo_locked), but may book, drive, chat and rate.

Settings → Server shows whether demo mode 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 farelane seed-demoAdds the sample cities, every row marked as sample data. It only adds rows and never deletes anything. It refuses a database with any real account; --confirm adds the sample cities next to real data anyway.
docker compose exec app farelane reset-demoRemoves the sample data and adds it again, as the nightly reset does. It refuses to run when the database holds any real account, with no way round it.
Admin → Setup → Remove demo dataDeletes only rows marked as sample data (see above).
docker compose exec app farelane migrateApplies the database migrations and stops (the server also does this on every start).

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

The demo's admin sign-in page with its one-click sign-ins
The demo's admin sign-in page with its one-click sign-ins
Part 06

Security

40Security and personal data

What the server checks and limits, what it keeps about people and for how long, so you can answer your riders' and drivers' questions and know what to keep safe.

Roles and privacy

  • Every role is checked by the server on every request; the screens only hide what a role cannot use. A rider token cannot call a driver route (403 not_driver) and the other way round (not_rider); staff routes answer staff_only, owner_only or dispatcher_cannot. Each app accepts only its own kind of account. A suspended or deleted person's sessions are refused everywhere.
  • A driver sees the rider's first name and rating before accepting. Rider and driver see each other's phone number only while the ride is live, and talk in the ride's chat (open during the ride and an hour after).
  • The trip link shows no phone numbers and only the rider's first name. The PIN and a parcel's receiver code are in the rider's own data only.
  • Files (driver documents, parcel photos, profile pictures) are private: shown to their owner, to staff, and parcel photos to that ride's rider and driver, through signed links that work for at most 10 minutes.

Accounts and sessions

  • Passwords (10 to 200 characters) are hashed with Argon2id. A password change or reset signs the person out on every other device. Sign-in codes (6 digits, 10 minutes, 5 tries) are kept only as a keyed hash.
  • On the web, the fl_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-farelane: 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). A token never goes into a link.
  • Session tokens, reset links and invitations are stored only as SHA-256 hashes; a reset link works once, for one hour.
  • The secrets you save in the admin (Stripe, SMTP, storage, Twilio, 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.

Rides and money

  • An offer is accepted in one locked database step: two drivers accepting one ride, an accept racing an expiry or a cancel, exactly one goes through. One open offer and one live ride per driver are enforced by the database itself.
  • Driver steps (arrived, start, end, cash) lock the ride and check its status, so a double tap or a retried request is applied once.
  • Saved cards and top-ups are confirmed only by Stripe events with a valid signature, each applied once. Every capture, charge and refund carries an idempotency key; a refund is claimed in the database first and undone if Stripe refuses, so it is never paid twice or more than was paid.
  • The wallet changes only in one guarded database update with a unique key per movement: a spend tried twice counts once, and the balance can never go below zero.
  • A promo code is checked again inside the booking with its row locked, so its last use goes to one rider only.
  • Prices are always worked out by the server from the city's fare and the measured route; nothing an app sends sets a price except a rider's offer, which must sit between the city's lowest offer and twice the suggested fare.

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, phone or 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
Sign-in codes texted, per phone5 per hourSign-in codes texted to one phone number
Sign-in codes, per address20 per hourSign-in codes asked for from one address
Website price checks, per address30 per minuteWebsite price checks from one address
CSV and data exports, per staff member10 per minuteSpreadsheet exports by one staff member (on a public demo many visitors share one account)
Messages to drivers or riders, per staff member20 per hourMessages to drivers or riders sent by one staff member
Promo codes typed, per rider20 per 10 minutesPromo codes a rider types in Promotions (so codes can't be guessed by trying many)
Waitlist sign-ups, per address10 per hour"Tell me when you're here" sign-ups to the waitlist, per visitor address
Invites, per staff member50 per hourInvites sent by one staff member

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 11), and count against their owner's room. The logo may be PNG, WebP or SVG of at most 1 MB; an SVG with scripts or event handlers is refused.
  • A parcel photo must be the driver's own upload of a picture.

What loads from other servers

The web pages' fonts and icons are part of the build. Map tiles load from the tile server you chose (OpenStreetMap's by default, or Google's), which sees the visitor's address like any map. Routes and address searches go through your server, so those providers see your server, not the rider. Stripe's card pages open on Stripe's own site. Push messages go through Firebase.

Personal data: what is kept, for how long, and requests

DataWhere (table)Kept
Account: name, email, phone, picture, settingsusers, mediaUntil the account is deleted, then 30 days
Sessions and push tokenssessions, push_tokensUntil sign-out or expiry (cleared hourly)
Saved places, emergency contacts, saved cards (brand, last 4 digits, Stripe's id), notifications, support reportssaved_places, emergency_contacts, rider_cards, notifications, support_reportsUntil removed or the account is purged
Driver vehicle, documents and their filesvehicles, driver_documents, mediaUntil the account is purged
Driver profile: last position, payout detailsdriver_profilesBlanked by the purge
Ride chatride_messagesUntil the rider or the driver of that ride is purged
Rides: addresses, route, GPS trail, parcel receiver, payments, ratingsrides, ride_trail, payments, ratingsKept for the books; a purged rider's rides lose what places them (below)
Wallet entries, payoutswallet_entries, payoutsKept for the books
SOS alerts with positionssos_alertsKept for safety, also after a purge
Sign-in codes, reset links, rate-limit counterssms_codes, password_resets, rate_limitsMinutes to hours (cleared hourly)

Deleting an account. Riders and drivers delete their account in the app (Account → Delete account). It is closed at once (a driver goes offline) and kept for 30 days, during which a fresh sign-in brings it back. After that the daily purge job removes its sessions, push tokens, reset links, sign-in codes, saved places, emergency contacts, saved cards, notifications, support reports, the chat of every ride they were in, a driver's vehicle and documents, and every uploaded file, then the account itself. When rides or payments still point at the person, the account is kept as "Deleted account" with the name, email, phone, password, picture and Stripe customer blanked, so the books stay whole without naming them, and:

  • the rides they took keep their city, times, distance and money, but lose their addresses (each point is rounded to about a kilometre and reads "Address removed"), route, GPS trail, parcel receiver, PIN, parcel code, trip link and note;
  • a driver's profile loses its last position and payout details;
  • SOS alerts stay as they were raised, for safety.

A request for a copy of someone's data (an access or portability request): open the person in Admin → Riders or Drivers and choose More → Download their data. It downloads one JSON file with everything Farelane holds about them: the account, driver profile, vehicle and documents, rides as rider and as driver, payments, wallet entries and top-ups, saved cards (brand and last 4 digits), saved places, emergency contacts, promo codes used, chat messages, SOS alerts, support reports, notifications, payouts and cash settlements, and a list of their uploaded files. Password and token hashes, payment processor ids, ride PINs and trip-link tokens are left out. The owner and admins can do this; dispatchers cannot. Each export is written to the audit log and counts against the export limit above. The same file comes from APP_URL/api/v1/admin/riders/<id>/export (drivers: /api/v1/admin/drivers/<id>/export) opened in a browser where an admin is signed in. Send the uploaded files themselves from your storage bucket if the person asks for them.

A request to erase data. Ask the person to delete the account in the app; the purge then removes it after 30 days as described above. To erase it without the wait, or for someone who cannot use the app, run this in the Farelane folder with their email. It closes the account at once and the next daily purge (within 24 hours) removes it:

docker compose exec -T postgres sh -c 'psql -U "$POSTGRES_USER" "$POSTGRES_DB"' <<'SQL'
update users set status = 'deleted', deleted_at = now() - interval '31 days'
where lower(email) = lower('person@example.com') and kind <> 'staff';
SQL

It answers UPDATE 1 when it found the person. For a person who signs in by phone only, use where phone = '+12025550123' with their number instead. The purge then removes and blanks everything as described above.

Keep it safe

  • Use https (chapter 5), long unique passwords and two-factor sign-in on your Stripe, Twilio, 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 Farelane updates; security fixes are marked as such in the changelog.
Part 07

For developers

41Every server key, explained

Every setting in the server's .env. The outside-service keys can also be set in 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 16.

KeyRequiredWhat it does
Required
APP_URLYesThe public address of the app, without a trailing slash, for example https://ride.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 farelane.
POSTGRES_USERNoThe database user the stack creates. Default farelane.
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 (profile photos, driver documents, parcel 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 farelane; 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_PROVIDERNoosm (the default: OpenStreetMap tiles, OSRM routes and Nominatim address search, no key) or google (Google tiles, Directions and Geocoding with GOOGLE_MAPS_KEY; Google charges after a free monthly allowance). Admin → Platform settings → Maps takes precedence.
GOOGLE_MAPS_KEYNoYour Google Maps key, used when MAP_PROVIDER is google: map tiles in the web pages, trip routes (Directions API) and address search (Geocoding API) on the server. It ships in the web pages, so restrict it to your domain and your server's IP address. The apps take their own Android and iOS keys in their .env. Admin → Platform settings → Maps takes precedence.
MAP_TILE_URLNoThe map tiles the web pages draw with osm, as a {z}/{x}/{y} address. Empty: OpenStreetMap's own tile server, which asks for light use only; a busy site should use a tile service or its own tile server.
OSRM_URLNoThe OSRM routing server that measures every trip, so quotes follow the real streets. The example uses OSRM's public demo server https://router.project-osrm.org: fine to try the app, but it allows about one request a second, gives no guarantee and may block heavy use, so run your own OSRM on a live site (or use Google). Empty: a straight line × 1.3 at each city's average speed. Answers are kept, so a repeated trip is measured once.
GEOCODER_URLNoYour own Nominatim or Photon server for address search. Empty: Nominatim's public server, at most one search a second for the whole platform. Answers are kept 30 days. Not used with Google and its key.
Text messages (Twilio SMS; empty = phone sign-in off)
TWILIO_ACCOUNT_SIDFor SMSYour Twilio Account SID (Twilio console → Account info). With the Auth token and a number it turns on phone sign-in codes, SOS texts to emergency contacts and parcel receiver codes. Empty: phone sign-in is off and those texts are listed as not sent. Twilio charges per message. Admin → Platform settings → SMS takes precedence.
TWILIO_AUTH_TOKENFor SMSYour Twilio Auth token (Twilio console → Account info). It is never written to the log.
TWILIO_FROMFor SMSThe Twilio number texts come from, in +E.164 form (for example +351910000000).
Push messages (Firebase Cloud Messaging; empty = push off)
FCM_PROJECT_IDFor pushYour Firebase project id (Firebase console → Project settings), with FCM_SERVICE_ACCOUNT_JSON. Empty: no push messages; the apps still get offers and trip updates while open.
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 Admin → Platform 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 Farelane <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 ride.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 Farelane 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.
APP_SCHEMENoThe link scheme of the rider app, default farelane; the driver app uses the same with -driver. After a card payment, the payment page sends people back to the app through <scheme>://pay/return. Change it only together with the apps' own scheme. Letters, digits, +, . and -, starting with a letter.
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 cities (Lisbon and Porto, with drivers on the move and a history of trips) 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 card rides, saved cards, wallet top-ups and cash settlements finish on a demo card page without Stripe (labelled DEMO). Only for a private test copy, never on a live site. DEMO_MODE turns it on as well.
DEMO_SEEDNoThe sample city file that farelane seed-demo and the nightly demo reset load. The Docker image already has its own copy (/app/seed/demo.json); set this only to load your own seed file.
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/farelane, 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.
TWILIO_API_URLNoFor tests only: another address for Twilio's API. Default https://api.twilio.com.
WEB_DISTSet by DockerWhere the built web app is, when it is not packed into the program.

42File structure

Server and web pages

farelane/
├── apps/
│   ├── backend/                 the Rust server (Axum): crate farelane-server, program "farelane"
│   │   ├── 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 pages, middleware
│   │   ├── src/api/             one file per area: public (config, quote, install), auth, me, rides, driver,
│   │   │                        ws (the apps' live connection), events (the admin's stream), media, webhooks,
│   │   │                        admin, admin_rides (rides, dispatcher), admin_people, admin_cities, admin_money,
│   │   │                        admin_contact (messages to people, password reset links, personal-data export)
│   │   ├── src/auth.rs, crypto.rs   sessions, roles, password hashing and encryption
│   │   ├── src/fares.rs        the fare engine: quotes, the GPS trail, final fares, the money split
│   │   ├── src/cities.rs        cities, zones, vehicle types and fares
│   │   ├── src/booking.rs       quotes and bookings (book.rs: the booking itself)
│   │   ├── src/dispatch.rs      offers, accepts and rider-offer proposals (bidding.rs: the rider's side)
│   │   ├── src/expiry.rs        the dispatch clock: expiries, scheduled rides, quiet drivers
│   │   ├── src/trips.rs         the driver's steps: arrived, PIN, end, cash, no-show (parcels.rs: parcel proof)
│   │   ├── src/riding.rs        the rider's side: cancel, destination, PIN, trip link, chat, ratings
│   │   ├── src/drivers.rs       applying, online and offline, positions
│   │   ├── src/payments.rs      card holds and charges, wallet and cash rides (stripe.rs, checkout.rs, refunds.rs)
│   │   ├── src/wallet.rs        wallet credit and spending
│   │   ├── src/payouts.rs       the weekly payouts (settlements.rs: drivers paying cash they owe)
│   │   ├── src/promos.rs        promo codes
│   │   ├── src/safety.rs        SOS alerts
│   │   ├── src/storage.rs, uploads.rs, media_links.rs   files: S3 or a folder, upload checks, signed links
│   │   ├── src/rate_limit.rs    the rate limits (chapter 40)
│   │   ├── src/purge.rs         deleting closed accounts after 30 days
│   │   ├── src/push.rs, sms.rs, email.rs, receipts.rs   push (FCM), texts (Twilio), email, ride receipts
│   │   ├── src/routing.rs, geo.rs   routes (OSRM or Google) and address search (Nominatim, Photon or Google)
│   │   ├── src/realtime.rs      live events through PostgreSQL to every server copy
│   │   ├── src/jobs.rs, ops.rs  the job queue and scheduler, and the 2-second clock
│   │   ├── src/settings.rs      admin settings over .env
│   │   ├── src/setup_check.rs   the setup check rows and live tests
│   │   ├── src/demo*.rs, sim.rs the sample cities, demo sign-ins, history, the nightly reset and the simulator
│   │   ├── seed/                demo.json (the sample cities) and legal/ (starter legal texts)
│   │   ├── tests/api/           server tests against a real PostgreSQL (chapter 43)
│   │   └── README.md            every module of the server, for developers
│   └── frontend/                the web pages (React Router 7, Vite, Tailwind CSS 4)
│       ├── src/routes.ts        every page: URL → file (lists in src/routes/)
│       ├── src/pages/           admin/, public/ (website), trip/ (trip link), auth/, install/
│       ├── src/map/             the web maps (Leaflet), tiles and the live car layer
│       ├── 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/realtime/        the admin's live event stream
│       ├── src/styles.css       colours, fonts and sizes (design tokens)
│       ├── public/images/maps/  the website's map pictures (OpenStreetMap)
│       └── e2e/                 browser tests (Playwright) of the admin, the website, the trip link and the install
├── 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 17)
├── 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

farelane_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 two apps)
│   │   ├── theme/fl_theme.dart      colours, sizes and type, light and dark
│   │   ├── router/                  rider_routes.dart, driver_routes.dart, deep links
│   │   ├── providers/               app state (Riverpod): session, rider, driver, live, push, theme
│   │   ├── services/api/            the API client; sample/ = sample mode
│   │   ├── services/data/           one file per area (auth, rider, driver, files) calling the API
│   │   ├── services/live/           the live connection (WebSocket) and location sending
│   │   ├── services/firebase/       Firebase start-up and push
│   │   └── services/general/        secure token store, preferences, ride alerts and permissions
│   ├── domain/models/               the JSON the API answers, as Dart classes
│   ├── components/                  shared widgets (Fl…): bars, buttons, fields, sheets, map, trip parts
│   └── features/                    common/ (sign-in, account, chat), rider/, driver/: the screens
├── android/                         app/build.gradle.kts (flavours, ids, names, signing),
│                                    app/src/<flavour>/google-services.json, app/src/driver/AndroidManifest.xml
├── ios/                             Runner (schemes rider, driver), config/<flavour>/GoogleService-Info.plist
├── assets/fonts/                    Manrope
├── assets/icon/                     rider.png, driver.png: the app icon sources
├── flutter_launcher_icons-*.yaml    the icon settings of each app (dart run flutter_launcher_icons)
├── test/                            unit and widget tests (every screen, light and dark, two phone sizes)
├── pubspec.yaml                     packages, fonts and the app version
└── .env.example                     every app setting

43Customise, 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 pages from apps/frontend: pnpm install, then pnpm dev, and open http://localhost:5173. Calls to /api go to the server on port 8080. 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 rider --dart-define-from-file=.env. Flutter's hot reload works as usual.

Tests

PartCommandWhat it covers
Server, unitcargo test -p farelane-server --libThe fare engine (quotes, minimum, stops, parcels, the trail, detours, metered, agreed fares, waiting, promos, commission, cancel fees, card holds) and the other pure parts. No database needed.
Server, APITEST_DATABASE_URL=postgres://user:password@127.0.0.1:5432/postgres cargo test -p farelane-serverThe whole server in process against a real PostgreSQL: rides, dispatch races (two accepts, accept against expiry), bidding, parcels, money to the cent, payments with a stand-in Stripe, refunds, wallet, promo codes, permissions of every role, safety, the demo. Each test gets a fresh database, so the login must be allowed to create databases. Without TEST_DATABASE_URL they say so and pass.
Load testTEST_DATABASE_URL=… cargo test --release -p farelane-server --test api load -- --ignored --nocapture300 drivers on live connections sending positions every 2 seconds and 150 riders booking; prints the time from request to first offer and to accept.
Server lintscargo clippy --workspace --all-targets -- -D warningsKept clean; cargo deny check checks advisories and licences.
Web pagespnpm testUnit tests (Vitest), run in apps/frontend. Also pnpm typecheck and pnpm lint (Biome).
Web, end to endpnpm e2ePlaywright tests of every staff role's admin flows, the website, the trip link and the demo inside another site's frame, against the real server with nothing mocked. Start the server with DEMO_MODE=true and one owner made with the install wizard, and pass that owner as E2E_OWNER_EMAIL and E2E_OWNER_PASSWORD. The tests build the pages, serve them on port 4173 and send /api to API_ORIGIN (default http://127.0.0.1:8080); E2E_BASE_URL points them at a running site instead. The install test needs its own server on an empty database: set E2E_INSTALL_URL and E2E_INSTALL_TOKEN.
Flutter appsflutter testUnit and widget tests of both apps on the sample data, including every screen in light and dark at two phone sizes, run in farelane_mobile_flutter. flutter analyze checks the code.

Change the server

  • Each area of the API is one file in apps/backend/src/api/; its routes() function lists the addresses, and a handler's role is one argument (RiderCtx, DriverCtx, Staff, Admin or Owner). The business rules 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.

Example: add an admin report of the week's busiest drivers

  1. In apps/backend/src/api/admin_money.rs, add the handler. Taking Admin makes it admins and owners only:
    /// `GET /api/v1/admin/top-drivers`: the ten drivers with the most completed rides in the last 7 days.
    async fn top_drivers(State(state): State<AppState>, _a: Admin) -> ApiResult<Json<Value>> {
        let items: Vec<Value> = sqlx::query_scalar(
            "select json_build_object('name', u.name, 'trips', count(*))
             from rides r join users u on u.id = r.driver_id
             where r.status = 'completed' and r.ended_at > now() - interval '7 days'
             group by u.id, u.name order by count(*) desc limit 10",
        )
        .fetch_all(&state.db)
        .await?;
        Ok(Json(json!({ "items": items })))
    }
  2. Register it in the same file's routes(): .route("/admin/top-drivers", get(top_drivers)).
  3. Add a test in apps/backend/tests/api/ next to the others (sign in as an admin, call the address, check the answer; a dispatcher must get 403).
  4. Show it in the web admin, for example on the Reports page, with the admin's data hook: useAdmin<{ items: { name: string; trips: number }[] }>("/admin/top-drivers") from src/pages/admin/_shared/api.ts.
  5. Rebuild (docker compose up -d --build).

Change the web pages

  • Colours, fonts and sizes are CSS variables in apps/frontend/src/styles.css; the brand colour from Settings → General overrides the cyan at run time.
  • Pages are in apps/frontend/src/pages/; src/routes.ts and src/routes/ map each URL to its file. The public website is src/pages/public/ and the trip link src/pages/trip/.

Change the apps

  • Screens are in lib/features/<app>/, each app's routes in lib/core/router/, and the shared widgets in lib/components/.
  • Every API call goes through one of the files in lib/core/services/data/ and the client in 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 pages alone reuses the compiled server and is quicker still. Rebuild the apps with the commands in chapter 18. Keep your changes in a Git repository, so you can compare them with each new Farelane version.

44API reference

The web pages, the two apps and your own integrations use the same /api/v1 API. These 186 addresses are generated from the server code when the release is built.

  • JSON in and out with camelCase keys; times in RFC 3339 UTC; money in whole cents of the platform currency (…Cents); distances in metres or km; ids are UUIDs, and rides also have a number such as FL-48213 (parcels PC-10294). Lists in the apps page by cursor ({items, next}), admin tables by ?page=&size=.
  • Errors: {"error": {"code": "…", "message": "…", "field"?: "…"}} with the HTTP status, for example outside_service_area, card_declined (402), taken, rider_busy, unpaid_ride (409), offer_expired, link_expired (410), wrong_pin, wrong_code, promo_invalid, offer_out_of_range, parcel_too_large (422), pin_locked, call_sender (423), wrong_app, not_approved, suspended, demo_locked (403) and rate_limited (429). The message is written to be shown to people as it is.
  • The web admin signs in with the fl_session cookie and sends x-farelane: 1 on every change. The apps send "client": "app" and their "app" (rider or driver) when signing in and get a token back, then send Authorization: Bearer <token>.
  • Live updates. The apps open a WebSocket at GET /api/v1/ws (the token as a Bearer header or ?token=). It hears the person's own messages at once and a ride's after {type: "join", rideId} (leave stops them). Server messages are {type, …}: offer.new, offer.closed, ride.updated, ride.location, proposal.new, proposal.closed, chat.message, sos.updated, notification; refetch asks the app to reload what it shows and restarting to reconnect (a deploy). The driver app sends {type: "loc", lat, lng, heading, speed, accuracy, at} every few seconds, and both apps {type: "ping"}. While the connection is down the apps check the ride and the current offer every 5 seconds instead. The web admin reads a Server-Sent Events stream at GET /api/v1/events (driver.moved, drivers.moved, ride.updated, sos.raised, counts).
  • File links in answers are signed (/api/v1/media/{id}?exp=…&sig=…) and work for at most 10 minutes: always use the link the API gives.
  • Shapes worth knowing. A place is {name?, address, area, lat, lng}: name ("LX Factory") only when it differs from the street line in address. GET /auth/me carries a summary for the apps' home (walletCents, unread notifications, unpaidRideId). A ride's sos is {id, status, safeAt, safeBy} while an alert exists. In the driver's view of a completed or cancelled ride, earnCents is what the driver earned and fare.commissionCents the commission.
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, payment pages and inbound webhooks
GET/api/v1/public/configAnyoneWhat the web app and the apps need before sign-in: the brand, currency, cities, the map provider, which payments and sign-ins work, the demo sign-ins, support and legal links, the app links (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/public/trips/{token}AnyoneThe trip link's view (no phone numbers, the rider's first name only); 410 link_expired after the set minutes past the end
POST/api/v1/public/waitlistAnyoneAsks to hear when the service reaches a place (10 an hour per address)
POST/api/v1/public/quoteAnyoneThe website's price check (no sign-in, 30 a minute per address): the city, its pricing mode and each vehicle type's fare (the suggested fare in a rider-offer city) and pickup time; nothing is kept, so it can't be booked. Outside the service area: 422 outside_service_area
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 owner account and the brand (runs once)
GET/api/v1/public/logo/{file}AnyoneThe uploaded brand logo (no sign-in; long cache, the name changes with the file)
POST/api/v1/webhooks/stripeStripe (signed webhook)Stripe's signed events; each is applied once (checkout.session.completed for card setups and top-ups, payment intents, refunds and disputes)
GET/api/v1/pay/demo/{session}Anyone with the page link (demo payments only)The demo checkout page (public demo or DEMO_PAYMENTS only): a test card form that works with 4242 4242 4242 4242 and declines 4000 0000 0000 0002
POST/api/v1/pay/demo/{session}Anyone with the page link (demo payments only){ card } pays a demo checkout with a test card (402 card_declined for the declined card)
GET/api/v1/pay/returnAnyoneWhere Checkout sends the person back
Sign-in and account
POST/api/v1/auth/phone/startAnyoneTexts a 6-digit sign-in code (10 minutes, 5 tries)
POST/api/v1/auth/phone/verifyAnyoneSigns in with a texted code, making a rider or driver account for a new number (isNew: true)
POST/api/v1/auth/registerAnyoneA new rider (or a driver who applies next) with email and password; staff are invited instead
POST/api/v1/auth/loginAnyoneSigns in with email and password (wrong passwords count down, then the account waits)
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 person
GET/api/v1/auth/sessionAnyone{ me } like /auth/me when signed in, { me: null } when not (always 200, so the public pages ask without an error in the browser console)
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; other sessions end)
GET/api/v1/auth/reset/{token}AnyoneWhose link this is (404 when it expired or was used)
GET/api/v1/auth/invites/{token}AnyoneWhat a staff invitation is for (email, the name it was sent to, role, who sent it)
POST/api/v1/auth/invites/acceptAnyoneAccepts a staff invitation and signs in
PATCH/api/v1/auth/profileSigned in, not the public demo's sign-insChanges the person's own details
POST/api/v1/auth/passwordSigned in, not the public demo's sign-insSets or changes the password (the current one is asked for when there is one); other sessions end
POST/api/v1/auth/demoAnyone, public demo onlyThe public demo's one-click sign-in (DEMO_MODE only): role is rider, rider_porto, driver, driver_porto, owner or dispatcher
GET/api/v1/meSigned inThe signed-in person (Me)
PATCH/api/v1/meSigned inThe same as PATCH /auth/profile (name, email, phone, photo, settings.pinRequired, notifyPrefs)
DELETE/api/v1/meSigned in, not the public demo's sign-insDELETE /api/v1/me {password} (or {confirm: "DELETE"} from an app): deletes the person's own account
POST/api/v1/me/devicesSigned inThe push token of the device this session runs on
DELETE/api/v1/me/devicesSigned inStops push messages to this device
GET/api/v1/me/placesSigned inThe saved places, home and work first
POST/api/v1/me/placesSigned inSaves a place (a second home or work replaces the first)
PATCH/api/v1/me/places/{id}Signed inChanges a saved place
DELETE/api/v1/me/places/{id}Signed inRemoves a saved place
GET/api/v1/me/contactsSigned inThe emergency contacts texted when the person raises an SOS (and, with shareEveryTrip, sent the trip link each time a ride starts)
POST/api/v1/me/contactsSigned inAdds an emergency contact (five at most)
PATCH/api/v1/me/contacts/{id}Signed inChanges an emergency contact (only the fields sent)
DELETE/api/v1/me/contacts/{id}Signed inRemoves an emergency contact
GET/api/v1/me/walletSigned inThe balance and the entries, newest first
POST/api/v1/me/wallet/topupSigned in, not the public demo's sign-insA Checkout page for a top-up ({checkoutUrl}); the wallet is credited once the payment is confirmed
GET/api/v1/me/cardsSigned inThe saved cards, the default first
POST/api/v1/me/cards/setupSigned in, not the public demo's sign-insA Checkout page that saves a card ({checkoutUrl}); the card appears once Stripe confirms it
PATCH/api/v1/me/cards/{id}Signed inMakes a card the default
DELETE/api/v1/me/cards/{id}Signed in, not the public demo's sign-insRemoves a saved card (rides already booked with it keep their hold)
GET/api/v1/me/promosSigned inThe promo codes running now that this rider can still use (a first-ride code only before their first ride, none they have used up), with the uses left of each
POST/api/v1/me/promosRiderChecks a code the rider typed (every rule but the city, which the quote checks): the promo as in the list, or 422 promo_invalid with the reason (details.endedAt for an ended code)
POST/api/v1/me/waitlistRiderA signed-in rider asks to hear when the service reaches a place; they are reached through their account (email, or phone when they sign in by phone)
POST/api/v1/me/reportSigned inA report to support (a lost item, a fare question, a safety concern), shown to staff
Rider app
GET/api/v1/cities/atAnyoneThe city serving a position (422 outside_service_area with the nearest city and its distance otherwise)
GET/api/v1/geo/searchAnyonePlaces matching the words, nearest the position first
GET/api/v1/geo/reverseAnyoneThe address at a position (place: null when unknown)
GET/api/v1/notificationsSigned inThe in-app notifications, newest first, with the unread count
POST/api/v1/notifications/readSigned inMarks notifications read (all of them without ids)
POST/api/v1/rides/quoteRiderThe prices of every vehicle type for a trip (a Quote, bookable for 10 minutes)
GET/api/v1/ridesRiderThe rider's rides and parcels, 20 a page (upcoming: scheduled and live, soonest first; past: newest first)
POST/api/v1/ridesRiderBooks a quote; the search for a driver starts at once (or 15 minutes before a scheduled pickup)
GET/api/v1/rides/currentRiderThe rider's live ride (ride, or null) and every live trip (items: a ride and a parcel can run at once)
GET/api/v1/rides/{id}RiderOne of the rider's rides (the full Ride, with the PIN and proposals)
PATCH/api/v1/rides/{id}RiderA new pickup time for a scheduled ride; answers the ride
GET/api/v1/rides/{id}/cancel-previewRider{canCancel, feeCents, freeUntil, reason} for the cancel sheet
POST/api/v1/rides/{id}/cancelRiderCancels (free while searching and for 2 minutes after an accept, otherwise the city's cancellation fee)
POST/api/v1/rides/{id}/raiseRiderA higher rider offer: a new round to the same drivers and new ones, with the clock reset
POST/api/v1/rides/{id}/proposals/{pid}/acceptRiderTakes a driver's proposal: the ride is theirs at that price and every other proposal closes
POST/api/v1/rides/{id}/proposals/{pid}/declineRiderTurns a driver's proposal down
PATCH/api/v1/rides/{id}/destinationRiderA new destination or stops (the price is quoted again)
POST/api/v1/rides/{id}/pinRiderA new start PIN ({pin}); it also unlocks a start locked by wrong tries
POST/api/v1/rides/{id}/shareRiderThe trip link {url, token, expiresAt}
POST/api/v1/rides/{id}/sosRiderRaises an SOS on a live ride (the SosAlert)
POST/api/v1/rides/{id}/sos/closeRiderThe rider says they are safe; their alert stays open for staff, marked safe
GET/api/v1/cars/nearbyRiderThe home screen's cars: up to 12 free cars within 3 km (position, heading and type only, under an id made for this answer) and the time the nearest car of each type would take to come
GET/api/v1/rides/{id}/messagesSigned inThe ride's chat (its rider, its driver or staff)
POST/api/v1/rides/{id}/messagesSigned inA chat message to the other side
POST/api/v1/rides/{id}/ratingRiderRates the driver once, with an optional tip
POST/api/v1/rides/{id}/payRiderSettles an unpaid ride
GET/api/v1/rides/{id}/receiptRiderThe receipt of a finished ride
Driver app
POST/api/v1/driver/applyDriver (not while suspended)The city, the vehicle type and the vehicle; review starts once every document is in
GET/api/v1/driver/statusDriverThe DriverStatus (approval, online, documents, today's numbers, current ride and offer)
GET/api/v1/driver/documentsDriverThe documents sent and the ones still needed
POST/api/v1/driver/documentsDriver (not while suspended)Sends (or replaces) a document for review
POST/api/v1/driver/onlineDriver (not while suspended)Goes online (approved drivers with valid documents) or offline
POST/api/v1/driver/locationDriver (not while suspended)Positions sent over HTTP (a batch after a reconnect), oldest first; at most 500
GET/api/v1/driver/offers/currentDriverThe open offer or pending proposal (offer: null when none)
POST/api/v1/driver/offers/{id}/acceptDriver (not while suspended)Takes the ride (dispatch) or proposes the rider's price (bidding)
POST/api/v1/driver/offers/{id}/declineDriver (not while suspended)Passes; the ride goes to the next driver
POST/api/v1/driver/offers/{id}/counterDriver (not while suspended)A counter-price on a rider offer (one of the offered steps)
GET/api/v1/driver/rides/currentDriverThe ride the driver holds (ride: null when none)
GET/api/v1/driver/rides/{id}DriverOne of the driver's rides
POST/api/v1/driver/rides/{id}/arrivedDriver (not while suspended)At the pickup (the waiting clock starts)
POST/api/v1/driver/rides/{id}/startDriver (not while suspended)Starts the trip with the rider's PIN (five wrong tries lock it)
POST/api/v1/driver/rides/{id}/endDriver (not while suspended)Ends the trip; the final fare comes from the trail
POST/api/v1/driver/rides/{id}/cashDriver (not while suspended)Confirms the cash (or says the rider did not pay)
POST/api/v1/driver/rides/{id}/no-showDriver (not while suspended)Cancels after the no-show wait; the rider pays the cancellation fee
POST/api/v1/driver/rides/{id}/releaseDriver (not while suspended)Gives an accepted ride back before the pickup (it goes to another driver), or a scheduled ride staff gave the driver
POST/api/v1/driver/rides/{id}/confirmDriver (not while suspended)The driver confirms a scheduled ride staff gave them (confirmedAt; once)
POST/api/v1/driver/rides/{id}/sos/closeDriver (not while suspended)The driver says they are safe; their alert stays open for staff, marked safe
POST/api/v1/driver/rides/{id}/parcel/pickupDriver (not while suspended)The parcel is collected (a photo is required)
POST/api/v1/driver/rides/{id}/parcel/deliverDriver (not while suspended)Delivered with a photo and the receiver's code (five tries, then call the sender)
POST/api/v1/driver/rides/{id}/parcel/returnDriver (not while suspended)The receiver was not there: the parcel goes back to the sender
POST/api/v1/driver/rides/{id}/sosDriver (not while suspended)Raises an SOS on the live ride
GET/api/v1/driver/rides/{id}/messagesDriverThe ride's chat
POST/api/v1/driver/rides/{id}/messagesDriver (not while suspended)A chat message to the rider
POST/api/v1/driver/rides/{id}/ratingDriver (not while suspended)Rates the rider once
GET/api/v1/driver/earningsDriverOne week's earnings (the current week by default)
GET/api/v1/driver/earnings/dayDriverOne day's trips and earnings (today by default)
GET/api/v1/driver/payoutsDriverWeeks paid, last week's and this week's amounts, and the payout details
POST/api/v1/driver/payouts/settleDriver (not while suspended)A payment page for the cash the driver owes {checkoutUrl, amountCents, weekStart} (422 nothing_owed when they owe nothing)
PATCH/api/v1/driver/payout-detailsDriver (not while suspended)Where the driver is paid
GET/api/v1/driver/tripsDriverThe driver's finished trips, newest first, 20 a page
GET/api/v1/driver/scheduledDriverScheduled requests of the driver's city and vehicle type in the next 24 hours (offered to nearby drivers 15 minutes before the pickup), and every scheduled ride staff gave the driver (assignedToMe, confirmedAt)
Live updates and files
GET/api/v1/eventsSigned inStreams the events of the person's rooms: ready first, a ping every 25 seconds, refetch when this screen fell behind, and the end of the stream when a deploy hands over (the client reconnects to the new copy)
GET/api/v1/wsSigned in (app token)Opens the live connection (401 without a valid token, 503 while a deploy hands over)
POST/api/v1/mediaSigned inUploads one of the person's own files (multipart file; typed by content, size limits per kind)
GET/api/v1/media/{id}Its owner, staff or the ride's rider and driver; or anyone with a signed linkA file, to the person it belongs to, to staff, or (a parcel photo) to the rider and driver of its ride; or to anyone with a valid signed link (?exp=&sig=)
Staff (admin)
GET/api/v1/admin/overviewStaff (dispatcher, admin or owner)Today's rides, money and live numbers, the last 14 days, each city's day and what needs attention (all queries side by side)
GET/api/v1/admin/countsStaff (dispatcher, admin or owner)The menu badges: drivers in review, documents to check, open SOS alerts, open support reports, unpaid rides, live rides and scheduled rides due within the hour
GET/api/v1/admin/liveStaff (dispatcher, admin or owner)The live map: online drivers (position, busy or free), drivers who went offline in the last 30 minutes (online: false, seenAt) and live rides
GET/api/v1/admin/staffAdmin or ownerThe staff and the open invitations
POST/api/v1/admin/staffOwner, not the public demo's sign-insEmails an invitation (7 days) to join the staff; the name is shown on the invite page and filled in for them
PATCH/api/v1/admin/staff/{id}Owner, not the public demo's sign-insChanges a staff member's role (the last owner stays owner)
DELETE/api/v1/admin/staff/{id}Owner, not the public demo's sign-insRemoves a staff member (signed out at once) or withdraws an invitation
GET/api/v1/admin/sosStaff (dispatcher, admin or owner)SOS alerts, newest first
POST/api/v1/admin/sos/{id}/resolveStaff (dispatcher, admin or owner), not the public demo's sign-insCloses an alert with a note
GET/api/v1/admin/settingsOwnerThe platform settings (secrets masked), server facts and storage stats
POST/api/v1/admin/settings/branding/logoOwner, not the public demo's sign-insThe 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}Owner, not the public demo's sign-insSaves one settings section (secrets are sealed; an empty secret keeps .env)
GET/api/v1/admin/emailsOwnerThe platform emails with their built-in and saved wording, for the email editor
GET/api/v1/admin/setup-checkOwnerThe setup check rows, and whether sample data is there to remove (demoData)
POST/api/v1/admin/setup-check/{id}/testOwner, not the public demo's sign-insTests one setup check row against the real service
GET/api/v1/admin/jobsOwnerBackground jobs (status and kind filters) with counts per status
POST/api/v1/admin/jobs/{id}/retryOwner, not the public demo's sign-insQueues a failed job again
POST/api/v1/admin/demo-data/removeOwner, not the public demo's sign-insRemoves the demo data (demo-marked rows only)
GET/api/v1/admin/ridesStaff (dispatcher, admin or owner)The ride table with each tab's count (two queries side by side)
GET/api/v1/admin/rides/{id}Staff (dispatcher, admin or owner)The ride sheet: the ride, its payments, the dispatch log, support reports, the money split, the GPS trail and the events (side by side)
POST/api/v1/admin/rides/{id}/cancelStaff (dispatcher, admin or owner), not the public demo's sign-insCancels a ride for the rider (no fee unless chargeFee and a driver was on the way)
POST/api/v1/admin/rides/{id}/refundAdmin or owner, not the public demo's sign-insGives money back (never more than was paid)
POST/api/v1/admin/rides/{id}/reassignStaff (dispatcher, admin or owner), not the public demo's sign-insTakes the ride from its driver (before the trip starts) and looks again, first offering it to driverId when given
GET/api/v1/admin/dispatch/lookupStaff (dispatcher, admin or owner)The rider with this phone number (rider: null when new), their saved places, last trips, saved cards and usual way to pay (the most used of their last 10 rides)
POST/api/v1/admin/dispatch/quoteStaff (dispatcher, admin or owner)The prices for a phone booking
POST/api/v1/admin/dispatch/ridesStaff (dispatcher, admin or owner)Books a ride for a rider on the phone; the first offer goes to driverId when given (a scheduled ride is given to them to confirm)
GET/api/v1/admin/dispatch/nearestStaff (dispatcher, admin or owner)The 10 nearest free online drivers (of a type when given) with the distance and a rough time to the point
GET/api/v1/admin/dispatch/queueStaff (dispatcher, admin or owner)Rides still looking for a driver, the last hour's no_driver ones and the scheduled rides of the next two hours, with how many drivers were asked
GET/api/v1/admin/driversStaff (dispatcher, admin or owner)The driver table with each tab's count
POST/api/v1/admin/driversAdmin or owner, not the public demo's sign-insAdds a driver the team signed up in person
POST/api/v1/admin/drivers/{id}/rejectAdmin or owner, not the public demo's sign-insTurns down an application that is still being filled in or reviewed; the driver sees the reason in the app and may apply again with new documents
GET/api/v1/admin/drivers/{id}Staff (dispatcher, admin or owner)The driver sheet: the profile, vehicle, documents, this week's earnings and the last trips (side by side)
PATCH/api/v1/admin/drivers/{id}Admin or owner, not the public demo's sign-insChanges a driver's city, vehicle type, vehicle or note
POST/api/v1/admin/drivers/{id}/documents/{doc}/approveAdmin or owner, not the public demo's sign-insApproves a document
POST/api/v1/admin/drivers/{id}/documents/{doc}/rejectAdmin or owner, not the public demo's sign-insRejects a document with the reason
POST/api/v1/admin/drivers/{id}/approveAdmin or owner, not the public demo's sign-insApproves a driver (their pending documents with them); a rejected or missing required document stops it
POST/api/v1/admin/drivers/{id}/suspendAdmin or owner, not the public demo's sign-insSuspends a driver: offline at once, their open offers and a ride not yet started go to other drivers, and every driver write answers 403 suspended (the driver app still signs in to show why)
GET/api/v1/admin/ridersStaff (dispatcher, admin or owner)The rider table, with each tab's count for the search
GET/api/v1/admin/riders/{id}Staff (dispatcher, admin or owner)The rider sheet: profile, last trips, wallet entries, cards and reports
PATCH/api/v1/admin/riders/{id}Admin or owner, not the public demo's sign-insSuspends a rider (signed out everywhere) or lets them back
POST/api/v1/admin/riders/{id}/walletOwner, not the public demo's sign-insThe owner adds to (or, below zero, takes from) a rider's wallet, with the reason on the entry
POST/api/v1/admin/messagesAdmin or owner, not the public demo's sign-insA message in each person's notifications and as a push (sent in the background); answers how many it reaches
POST/api/v1/admin/riders/{id}/password-resetAdmin or owner, not the public demo's sign-insEmails the rider a link (1 hour) to set a new password
GET/api/v1/admin/riders/{id}/exportAdmin or ownerThe rider's data as a JSON file
GET/api/v1/admin/drivers/{id}/exportAdmin or ownerThe driver's data as a JSON file
GET/api/v1/admin/citiesAdmin or ownerEvery city with its drivers, online drivers, zones and today's rides
POST/api/v1/admin/citiesAdmin or owner, not the public demo's sign-insA new city (inactive until it has a zone and fares)
GET/api/v1/admin/cities/{id}Admin or ownerOne city with its zones and fares
PATCH/api/v1/admin/cities/{id}Admin or owner, not the public demo's sign-insChanges any city setting
POST/api/v1/admin/cities/{id}/zonesAdmin or owner, not the public demo's sign-insA new service zone
PATCH/api/v1/admin/cities/{id}/zones/{zid}Admin or owner, not the public demo's sign-insChanges a zone
DELETE/api/v1/admin/cities/{id}/zones/{zid}Admin or owner, not the public demo's sign-insRemoves a zone
GET/api/v1/admin/cities/{id}/faresAdmin or ownerThe city's fare for every vehicle type
PUT/api/v1/admin/cities/{id}/fares/{vehicle_type}Admin or owner, not the public demo's sign-insSets a fare (rides already booked keep the fare they were booked with)
GET/api/v1/admin/vehicle-typesAdmin or ownerEvery vehicle type
PATCH/api/v1/admin/vehicle-typesAdmin or owner, not the public demo's sign-insAdds or changes vehicle types (a key never changes; a type is turned off, never removed)
GET/api/v1/admin/promosAdmin or ownerEvery promo code with its uses
POST/api/v1/admin/promosAdmin or owner, not the public demo's sign-insA new promo code (amount is cents, or basis points for percent)
PATCH/api/v1/admin/promos/{id}Admin or owner, not the public demo's sign-insChanges a promo code (the whole form)
DELETE/api/v1/admin/promos/{id}Admin or owner, not the public demo's sign-insRemoves a promo never used, or turns off one that was
GET/api/v1/admin/waitlistAdmin or ownerThe people who asked to hear when the service reaches their place (from the website or the rider app), newest first (500 at most), with the total
DELETE/api/v1/admin/waitlist/{id}Admin or owner, not the public demo's sign-insRemoves an entry (once the person has been told)
GET/api/v1/admin/payoutsAdmin or ownerEvery driver's week: earnings, tips, cancel fees, cash collected and what is due, with the totals
POST/api/v1/admin/payouts/mark-paidAdmin or owner, not the public demo's sign-insMarks a finished week paid (one row per driver; marking again changes nothing)
GET/api/v1/admin/payouts.csvAdmin or ownerThe week's payouts as a spreadsheet (read-only, so the public demo may export too; 10 a minute per staff member)
GET/api/v1/admin/reportsAdmin or ownerRides and money for a period, grouped
GET/api/v1/admin/reports.csvAdmin or ownerThe same report as a spreadsheet (amounts in currency units; read-only, so the public demo may export too; 10 a minute per staff member)

45Database

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. Rides, payments and payouts are kept when a rider or a driver is deleted. These 45 tables are generated from the migrations when the release is built.

TableWhat it holdsKeysPoints to
Accounts and sign-in
usersEveryone who signs inprimary key id; unique email (any case), when email is not null and erased_at is null; unique phone, when phone is not null and erased_at is null–
sessionsA signed-in browser or appprimary key id; unique token_hashusers
push_tokensThe push token (FCM) of the device a session runs on: one per sessionprimary key id; unique session_id; unique tokensessions, users
sms_codesPhone sign-in codes: 6 digits, kept as a keyed hash, 10 minutes, 5 triesprimary key phone–
password_resetsPassword reset links (only a hash is kept; valid for one hour, used once)primary key id; unique token_hashusers
invitesStaff invitations to the web adminprimary key id; unique token_hash; unique email (any case), when accepted_at is nullusers
rate_limitsFixed-window counters for sign-in, sign-up, SMS codes and reset limits (keys hold a keyed hash, never a plain address or phone number)primary key key–
notificationsWhat each person sees under Notifications in the apps (every push is also kept here)primary key idusers, rides
audit_logWho changed what in the admin, and money moves made by peopleprimary key idusers
Cities, zones and fares
citiesA cityprimary key id; unique slug–
zonesThe service area of a city: a pickup is served when its point is inside an active zone's polygonprimary key idcities
vehicle_typesThe kinds of vehicle riders pick fromprimary key key–
city_faresA city's fare for one vehicle type, in cents (per km and per minute are cents per whole km and minute)primary key city_id + vehicle_typecities, vehicle_types
waitlistPeople who asked to hear when the service reaches their placeprimary key id; unique email (any case); unique user_id, when user_id is not nullusers
geo_cacheGeocoding answers kept for 30 days (provider rate limits and cost)primary key key–
Drivers
driver_profilesOne row per driver accountprimary key user_idusers, cities, vehicle_types
vehiclesThe vehicle a driver drivesprimary key driver_idusers
driver_documentsA driver's documents, one per kind: the latest upload replaces the one beforeprimary key id; unique driver_id + kindusers, media
driver_shiftsEach time a driver was online (the earnings screen's online time)primary key id; unique driver_id, when ended_at is nullusers
Rides and parcels
ride_quotesA quote a rider can book within 10 minutes: the route and every vehicle type's priceprimary key idusers, cities
ridesA ride or a parcelprimary key id; unique number; unique share_token; unique rider_id + idem_key, when idem_key is not null; unique driver_id, when status in ('accepted', 'arrived', 'in_progress'); unique rider_id + kind, when status in ('searching', 'accepted', 'arrived', 'in_progress')cities, vehicle_types, users, promo_codes, rider_cards, media
ride_eventsEvery status change of a ride, with who made itprimary key idrides, users
ride_offersAn offer to one driverprimary key id; unique ride_id, when status = 'accepted'; unique driver_id, when status in ('open', 'proposed')rides, users
ride_trailThe driver's GPS trail while the ride is in progress (the final fare is priced from it)primary key idrides
ride_messagesChat between the rider and the driver (and staff) about one rideprimary key idrides, users
ratingsOne rating per ride and side: the rider rates the driver, the driver rates the riderprimary key ride_id + raterrides, users
Safety and the rider's lists
sos_alertsAn SOS raised by the rider or the driver during a ride: where they were, who was texted, and how staff resolved itprimary key id; unique ride_id + raised_role, when status = 'open'rides, users
emergency_contactsPeople a rider wants texted when they raise an SOSprimary key idusers
saved_placesA rider's saved places (home, work, others)primary key id; unique user_id + label, when label in ('home', 'work')users
support_reportsSomething a person reported to support from the app (a lost item, a fare question, a safety concern)primary key idusers, rides
Money
rider_cardsA rider's card, saved through Stripe Checkout in setup mode (only Stripe's payment method id is kept)primary key id; unique user_id + stripe_pm, when deleted_at is null; unique user_id, when is_default and deleted_at is nullusers
card_setupsA card being saved through a Stripe Checkout page in setup modeprimary key id; unique stripe_session_idusers
paymentsEvery payment step of a rideprimary key id; unique idem_keyrides, users
promo_codesPromo codes: fixed (cents off) or percent (amount in basis points, capped at max_discount_cents, 0 = no cap), with a total use limit, a per-rider limit, the cities it works in (empty = all), dates and first ride onlyprimary key id–
promo_redemptionsOne promo use per ride; a cancelled ride releases itprimary key id; unique ride_idpromo_codes, users, rides
wallet_accountsOne wallet per rider: the balance in cents, never below zero; every change is a wallet_entries rowprimary key user_idusers
wallet_entriesEvery wallet movement, once per idempotency keyprimary key id; unique idem_keyusers, rides
wallet_topupsA wallet top-up paid through a Stripe Checkout page (credited by the webhook, never by the app)primary key id; unique stripe_session_idusers
payoutsA week's payout marked as paid to one driver (marking twice does nothing)primary key id; unique driver_id + week_startusers
cash_settlementsA driver paying the cash they owe for a week by card (Stripe Checkout, or the demo page); applied onceprimary key id; unique stripe_session_idusers
stripe_eventsEach Stripe event applied once: a row is written before the event is applied and removed again when applying fails, so Stripe's next delivery applies it (see apps/backend/src/stripe.rs)primary key id–
Files
mediaEvery uploaded file belongs to one person (a driver's documents, parcel photos, profile pictures)primary key id; unique storage_keyusers
Platform
platform_settingsPlatform settings set from the admin (override .env)primary key keyusers
email_noticesPlatform emails sent once per subject and period (a weekly payout notice once a week, …)primary key subject + kind + period–
jobsThe durable job queue (claimed with FOR UPDATE SKIP LOCKED)primary key id; unique dedupe_key, when dedupe_key is not null and status in ('queued', 'running')–
Part 08

Help

46Updating 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 Farelane folder. It reads the database user and name from the postgres container, so it works whatever you set as POSTGRES_USER and POSTGRES_DB; -T keeps a terminal out of the dump. Run it every day with cron and keep copies off the server.

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 farelane/ (not inside it), run unzip -o farelane-x.y.z.zip with the new version's file name. The zip has a top-level farelane/ folder, so it unpacks over your install and replaces every shipped file, also ones you changed in the web pages or the apps: keep your changes in Git (chapter 43) 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 farelane
    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. Drivers' apps reconnect by themselves within seconds.
  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 farelane_mobile_flutter/, or compare with Git, then raise the build number in pubspec.yaml, build and upload as in chapter 18. Update the server first: new apps may need the new server, while the old apps keep working with it.

47Troubleshooting

A driver gets no offers

  1. The driver is approved, online in the driver app and has no document past its expiry date (Drivers → their sheet).
  2. The phone is sending its position: the driver must allow location "all the time" (chapter 13). Only drivers seen in the last 30 seconds get offers; the live map shows when each driver was last seen.
  3. The ride is for the driver's vehicle type and city, and the pickup is within the city's search radius (6 km) of the driver.
  4. The driver has no other ride or ringing offer, and was not already asked about this ride.
  5. The offer reached the phone: with the app in the background it needs push (Setup → Push messages green, the app built with its Firebase keys) and the ride alert settings. On the driver's phone, Ride alerts shows each setting and has Test the ride alert.
  6. Three missed offers in a row take a driver offline; the driver goes online again.
  7. Behind your own proxy, the WebSocket must pass (chapter 5): without it the apps fall back to checking every few seconds, and offers arrive late.

The map is blank or grey

  • The tile address in Settings → Maps is wrong or the tile server refuses you (OpenStreetMap's server blocks heavy use): put the default back (empty) or use a tile provider.
  • Google is chosen without a key: the setup check's Maps row warns, and the maps fall back to OpenStreetMap. A Google key that is set but wrong, unpaid or restricted gives grey maps: check it in the Google Cloud console (the Map Tiles API for the web, the Maps SDKs for the apps).
  • An app built for Google Maps needs its own key at build time (chapter 16); without it the app draws OpenStreetMap.
  • Quotes show but routes look like straight lines: no routing server answers. See the setup check's "Routes and prices" row (chapter 12).

SMS codes don't arrive

  • Setup → Text messages must be green; its Test reads your Twilio account.
  • A Twilio trial account texts only the numbers you verified in Twilio. Upgrade it for real riders.
  • Twilio must be allowed to text that country (Twilio console → Messaging → Settings → Geo permissions) from your sending number.
  • The number is typed with its country code. Codes are limited per phone and per address, so repeated tries wait.
  • Twilio's message log shows each text and why one failed. On the public demo no texts are sent.

Saved cards or top-ups never show (the Stripe webhook)

Stripe's webhook does not reach the server. Webhooks cost nothing extra in Stripe, which has its own pricing: you pay its fees on payments only. Setup → Stripe must show the webhook signing secret. In Stripe → Developers → Webhooks, the endpoint must be APP_URL/api/v1/webhooks/stripe with the events of chapter 8; Stripe shows every delivery and the server's answer there, and can resend one. A signing secret from another endpoint (or from test mode on a live endpoint) is refused. Card rides themselves do not need the webhook.

Card rides end unpaid

The bank refused the charge after the trip (the capture, or the off-session charge that replaces a failed capture or takes the rest above the hold). The ride sheet shows each Stripe step and its answer, and Stripe's dashboard shows the bank's reason; the rider is asked to settle it in the app.

No push notifications

  1. Setup → Push messages must be green (the service account is saved and Google accepts it).
  2. The app was built with that app's own FIREBASE_* keys (chapter 13). 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, and the app is signed with the Push Notifications capability.
  5. For ride offers on a locked phone, see the four ride alert settings (chapter 13); phones from some makers also need Farelane allowed in their own battery or "app sleep" lists.

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 other app"

Each account signs in only to its own app: riders to the rider app, drivers to the driver app, staff to the web admin. Use the app it names.

Riders are told you don't serve their area

Their pickup is outside every active zone of every active city. Check the city's zones in Cities and zones, and look at the waitlist for where people ask.

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 46). 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 the setup check's Email row and check that the sender's domain is verified with your provider.

The live map or the overview does not move

A proxy is buffering the admin's live stream. With the bundled Caddy it works as is; with Nginx add proxy_buffering off; (chapter 5).

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

48FAQ

Do I publish two apps?

Yes: the rider app and the driver app are two listings on Google Play and two 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; drivers keep the cash of cash rides. The payouts page tells you each week what you owe each driver (or what they owe you), and you pay them yourself. Drivers need no Stripe account.

Fixed prices or bidding?

Both: each city picks one. Lisbon in the sample data uses fixed upfront fares, Porto lets riders offer a fare.

Does it work without card payments?

Yes: cash rides work without Stripe, and so does wallet credit you add or refund. Saved cards, card rides and wallet top-ups need Stripe.

Do I need Google Maps?

No. OpenStreetMap works with no key. For a busy service run your own routing server or move to a provider or Google (chapter 12).

Does it work without SMS?

Yes: riders and drivers then sign in with email and password, and SOS alerts still reach your staff by the admin and email. Phone sign-in, SOS texts to contacts and texted parcel codes need Twilio.

Can I use another currency or country?

Set the currency and time zone in Settings → General before the first ride, and each city's own time zone; Stripe takes payments in it where your Stripe account allows. The apps and the web pages are in English.

How many drivers can it handle?

In our load test one copy of the server, with 300 drivers on live connections sending positions every 2 seconds and 150 riders booking, offered every ride to a driver in under 40 ms at the 99th percentile (server and PostgreSQL on one computer; add your network's time). For more, run several copies (chapter 5).

What is not in this version?

Intercity rides, hourly rentals, shared rides, fleet owners with several drivers, in-app voice calls, surge pricing and different currencies per city.

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 farelane 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 rides and payments from riders, the Envato Extended Licence. See chapter 51.

49Credits and licences

Farelane 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 pages' 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 farelane_mobile_flutter/pubspec.lock.

LicenceRust cratesnpm packages
MIT55272
Apache-2.0 OR MIT2142
Unicode-3.018–
ISC210
Apache-2.0110
MIT OR Unlicense5–
OFL-1.1–4
(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
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
Total324310

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

Images

The download contains no photos. The logo and app icons are original artwork, every image in this guide is a screenshot of the running apps, and the website's pictures are map renders of OpenStreetMap, credited on screen. Put pictures of your own city in their place if you like.

50Changelog

1.0.0 (December 2026)

First release.

  • Two Flutter apps from one codebase: the rider app and the driver app, as two 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.
  • Booking: rides now or up to 7 days ahead, five vehicle types per city (Moto, Tuk-tuk, Car, Comfort, XL), rides with no set destination, extra stops, saved places, promo codes, a pickup time riders can change on scheduled rides, a waitlist where the service does not run yet, and a live trip link riders can share.
  • Two pricing modes, chosen per city: fixed upfront fares, or the rider offers a fare and nearby drivers accept or counter it; fares come from the GPS trail with waiting time, stops, a booking fee and the commission rules of each city.
  • Dispatch: the nearest free driver gets the offer first, one driver at a time for 15 seconds, up to 3 drivers per ride, with an accept that only one driver can win; scheduled rides go out 15 minutes before pickup.
  • Driver alerts: ride offers ring on a locked phone (a full-screen alert on Android, a time-sensitive alert on iPhone), with a set-up screen that checks every permission and a test ring.
  • Parcels: small, medium and large parcels, a photo at pickup, a photo and the receiver's 4-digit code at drop-off, a metered return when nobody takes the parcel, and cash on delivery (the receiver pays the courier).
  • Safety: an SOS button for riders and drivers that alerts the admin and the rider's emergency contact, a 4-digit PIN to start each ride, trip links that end 30 minutes after the ride, and contacts who get the trip link by text at the start of every trip if the rider asks.
  • Paying: cards through Stripe (saved with Stripe Checkout, charged at the end of the ride), cash with "Rider can't pay" for the driver, and a wallet for top-ups and refunds that can never go below zero; tips go to the driver in full.
  • Admin (web): the overview with live tiles, the live map of every driver, the dispatcher for phone bookings, rides and parcels with refunds and reassigning, drivers with document approval, riders, cities and zones drawn on the map, vehicle types and fares, promo codes, weekly payouts with CSV export, reports, safety alerts, staff roles (owner, admin, dispatcher), settings, and a Setup page that tests every outside service.
  • Public website: home with a price check, drive with us, send parcels, cities and legal pages, plus the live trip page that works in any browser without signing in.
  • Maps: OpenStreetMap with no key by default, or Google Maps when you add a key; place search and routes through the server.
  • Sign in: phone number with an SMS code (through your SMS provider) or email and password.
  • 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 Lisbon and Porto sample cities, 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 role limited on the server.

51Support and licence

Questions, bug reports and help with installation: use the Support tab on the item's page on the marketplace. Please include your Farelane 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, Twilio, Google, Apple and other outside services, which are handled by those companies.

Licence

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

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