← All docs

Flyaway docs

Self-hosting

Flyaway runs on your own server: PostgreSQL, the backend API and the website, started together with Docker Compose. The iOS and Android app can then point at that server instead of flyaway.day.

Docker Compose

cp .env.example .env              # set a unique POSTGRES_PASSWORD first
docker compose up -d --build      # postgres + backend + web
# then run migrations against the running db
docker compose exec backend node dist/database/migrate.js up

Every setting is described in .env.example and, in more detail, in apps/backend/.env.example.

All three services are published only on 127.0.0.1 by default, so other machines cannot connect through the host’s network interfaces. The default flyaway credentials match the backend’s example DATABASE_URL and keep local setup working without extra configuration.

For self-hosted data, set a unique POSTGRES_PASSWORD and WEBSITE_KEY in the root .env before the first start. Generate the website key with openssl rand -hex 24. If you run the backend outside Docker, update its DATABASE_URL to match any custom database credentials or port. Changing POSTGRES_PASSWORD does not change the password in an existing database volume; update the database role’s password as well. For remote database administration, use an SSH tunnel to the host’s loopback port.

If a reverse proxy terminates TLS in front of the Node website, set WEB_TRUST_PROXY_HOPS to the number of trusted proxy hops. The website reads the visitor address from that position at the right of X-Forwarded-For; leave it unset when visitors reach the website directly or the site runs on Cloudflare. Keep the website port reachable only through those proxies, or a direct client could spoof that header. Set SERVICE_BIND_ADDRESS=0.0.0.0 only when deliberate LAN access is needed and no forwarded headers are trusted.

The hosted backend (https://api.flyaway.day) is deployed differently: see deploy/README.md. Its Compose file requires a database password and does not publish a Postgres port. The hosted website runs on Cloudflare; see Website on Cloudflare.

Pointing the app at your server

The app uses the backend it was built with (EXPO_PUBLIC_BACKEND_URL in apps/mobile/.env) unless you set another in Settings → Server and data → Flyaway server. Enter the address (for example flyaway.example.com or http://192.168.1.20:3001); Test & Save checks /health there and at /api, and only saves an address where a Flyaway backend answers. Use Built-in goes back to the build’s default. Plain http:// is allowed for servers on the local network only. Share links stay with the server that created them, so switching servers doesn’t break links you already sent.

Accounts and sign-in

Flyaway works without an account. Signing in adds sync across devices, a public profile and following, and lets the server limit its costly features to people with an account. Every setting below is optional.

  • Sign in with Apple: enable it for your app’s bundle id. For the website, create a Services ID with your domain and the return URL https://<your domain>/signin (APPLE_WEB_CLIENT_ID). To revoke Apple tokens when someone deletes their account, add a Sign in with Apple key (APPLE_TEAM_ID, APPLE_KEY_ID, APPLE_PRIVATE_KEY).
  • Google: an OAuth iOS client for the app (GOOGLE_CLIENT_IDS, and EXPO_PUBLIC_GOOGLE_IOS_CLIENT_ID for the app build) and a web client with your website as an authorised JavaScript origin (GOOGLE_WEB_CLIENT_ID).
  • Email codes: an SMTP server in SMTP_URL and a sender in MAIL_FROM, with SPF and DKIM set up for the sending domain.

The Apple and Google client ids default to the official app’s. The website needs PUBLIC_WEB_URL, its own public address, for Apple’s return URL.

The website calls the backend on its visitors’ behalf and passes their address in X-Forwarded-For, so for per-visitor rate limits the backend has to trust both your reverse proxy and the website (TRUST_PROXY, loopback, uniquelocal in Docker Compose).

What needs an account

Feature Signed out Signed in
Flight search with the server’s AeroDataBox key A few a day per address, or bring your own key Daily quota
Past flight paths (if OpenSky is on) Not available Daily quota
Live traffic (if OpenSky is on), aircraft, airports, weather Allowed Allowed
Share links Allowed (rate limited) Allowed, managed by the account
  • GATED_FEATURES: flightSearch, pastTracks (both when unset), or none to open everything.
  • QUOTA_FLIGHT_SEARCH_PER_DAY (default 50) and QUOTA_PAST_TRACKS_PER_DAY (default 200): allowance per account per UTC day; 0 means no limit.
  • GUEST_FLIGHT_SEARCH_PER_DAY (default 3): searches a visitor without an account may try per address per UTC day; 0 means none.

A search with someone’s own AeroDataBox key is never limited.

Flight data

Most features work without any API keys. Restart the backend after changing these settings, and keep operator keys on the backend: never put them into an app build or a public environment variable.

Flight search uses AeroDataBox. Set AERODATABOX_API_KEY and, in AERODATABOX_GATEWAY, where you subscribed: rapidapi (the default), apimarket, or direct for a key from AeroDataBox itself. Commercial use needs a paid plan, and how far back and ahead you can search depends on it. Without a server key, people can still enter their own in the app.

curl 'http://localhost:3001/flights/lookup?flightNumber=LX318&date=2026-10-12'
curl 'http://localhost:3001/flights/route?from=ZRH&to=LHR'

AeroDataBox’s terms allow shared caching for seven days unless your plan says otherwise; Flyaway’s caches expire much sooner. Keep attribution visible if your plan requires it.

Watching flights for changes

People can watch a flight in the app and follow its times, gates, baggage belt, aircraft and diversions. Watching is off by default and uses the server’s AeroDataBox key:

FLIGHT_WATCH_ENABLED=true
FLIGHT_WATCH_INTERVAL_SECONDS=600
FLIGHT_WATCH_REFRESHES_PER_DAY=50

Flights far away are checked rarely and nearer ones more often, down to the interval. FLIGHT_WATCH_REFRESHES_PER_DAY caps the lookups per UTC day across the whole server, failed ones included; choose it to fit your plan and leave room for ordinary searches. People watching the same flight share its lookups. Keep at least one backend running with the worker on (FLIGHT_WATCH_WORKER_ENABLED).

Flight alerts. With FLIGHT_ALERTS_ENABLED=true, AeroDataBox pushes changes to the backend instead of the backend polling for them. Each delivered flight costs an alert credit, from a balance separate from your plan’s requests; the backend warns when fewer than 100 remain. The callback goes to PUBLIC_API_URL/flights/alerts/<FLIGHT_ALERT_WEBHOOK_SECRET>, so PUBLIC_API_URL must be public https, and the path should stay out of your proxy’s access logs (the bundled nginx site does this). Before changing the secret, switch alerts off for one worker run, which removes the old subscriptions. There is no polling fallback while alerts are on.

Push notifications. With an APNs key (APNS_KEY_ID, APNS_PRIVATE_KEY and APNS_TEAM_ID), iPhones are told about cancellations, diversions, departures, landings, delays of five minutes or more, gate changes and the baggage belt. A self-built app needs its own key, its bundle id in APNS_TOPIC and the Push Notifications capability. Instead of holding the key, the backend can send through a relay that does (APNS_RELAY_URL, APNS_RELAY_TOKEN); flyaway.day works this way. Android isn’t notified yet.

Flight paths and live traffic

Every flight gets its distance and the countries it crosses, worked out offline, with its path estimated along the great-circle route.

Recorded flight paths and the live traffic on the globe come from the OpenSky Network. They are off by default, and flyaway.day doesn’t use them. To turn them on, you need a written agreement with OpenSky under their terms of use. Then set OPENSKY_ENABLED=true on the backend, EXPO_PUBLIC_OPENSKY_ENABLED=true when building the app, and OPENSKY_ENABLED=true when building the website (for Joyride Live). API credentials alone don’t turn anything on.

Once enabled:

  • The app records a flight’s track while it’s in the air.
  • Past flights (up to 30 days) are looked up through the backend, which needs an OpenSky API client (OPENSKY_CLIENT_ID, OPENSKY_CLIENT_SECRET).
  • For the live traffic, the backend fetches every aircraft OpenSky sees every OPENSKY_STATES_INTERVAL_MINUTES (default 60; 0 turns it off). Each fetch costs 4 of OpenSky’s daily credits (400 without an API client, 4,000 with one), so every 15 minutes works anonymously and about every 2 minutes with a client.

Airport weather

Set OPENWEATHER_API_KEY in the backend environment (or the root .env for Docker Compose), then recreate the backend container or restart the process. The app uses its configured Flyaway server; users do not supply weather keys. Without a server key, new weather lookups return no data. The app hides the section when there is no saved weather.

GET /weather/ZRH?lang=en returns { weather: ... }, or { weather: null } when the provider is unavailable or unconfigured. Only bundled airport codes and the app’s six languages are accepted. This is current weather, not a forecast for the flight’s departure or arrival time.

Results are shared for ten minutes per airport and language; missing or failed results are cached for five minutes. Pending lookups share one request. Uncached lookups are limited to 30 per IP per minute, 50 total per minute, 30,000 total per 24 hours, and six concurrent requests, with a ten-second upstream timeout. These limits and caches live in one backend process and reset on restart. Share budgets across replicas before scaling, and allow for other uses of the same OpenWeather account when selecting a plan or setting provider-side limits.

Weather cards show linked OpenWeather attribution and its bundled logo, from OpenWeather’s logo library. See OpenWeather’s plans and licence.

Moderation

Operators can view server statistics at /admin. Set ADMIN_USER_IDS to a comma-separated list of user UUIDs; empty means no admins. Find your ID with pnpm --filter @flyaway/backend moderate show <handle>. The dashboard includes 30 days of search metadata and provider usage, without API keys, email or IP addresses. Nothing on the site links to it.

Public profiles carry what people write about themselves, so the server keeps an eye on them:

  • Handles, display names and bios with slurs, sexual terms or strong profanity are refused (apps/backend/src/common/word-filter.ts, in the app’s six languages). Add your own words with BLOCKED_WORDS.
  • Anyone signed in can report a profile or block its owner, in the app and on the website. Blocked accounts can’t see each other’s profiles, and their follows end. People manage their blocks in Settings → Following.
  • Reports are stored and emailed to MODERATION_EMAIL (needs SMTP_URL), with the profile as it was when reported. Without that address they’re only logged.

Act on reports with the moderate command:

pnpm --filter @flyaway/backend moderate reports                      # development
docker compose exec backend node dist/database/moderate.js reports   # Docker

show <handle> lists a profile and its reports; clear <handle> removes its name, bio and picture, gives it a neutral handle and makes it private; suspend <handle> hides it from everyone but its owner (unsuspend undoes it); resolve <handle|report id> marks reports handled; delete-share <id> removes a shared link. Handled reports are deleted after a year. The App Store expects reports to be acted on within 24 hours.

Demo profile

The demo command creates or refreshes a public profile, @demo, for Gabriel, the example traveler from the website and the screenshots, with the same flights and a picture. App Review uses it to try following, reporting and blocking. The account has no sign-in, and the command refuses a handle that someone signs in with. Run it again after the example flights change.

pnpm --filter @flyaway/backend demo                       # development
docker compose exec backend node dist/database/demo.js    # Docker

Website on Cloudflare

flyaway.day runs apps/web as a Cloudflare Worker. The same code builds for Node (Docker, pnpm dev:web) by default; ASTRO_ADAPTER=cloudflare switches to the Cloudflare adapter. The Worker’s settings live in apps/web/wrangler.jsonc.

pnpm --filter @flyaway/web cf:dev       # build the Worker and run it locally (workerd)
pnpm --filter @flyaway/web cf:deploy    # build and upload it

cf:dev reads local overrides from apps/web/.dev.vars (ignored by git), for example BACKEND_URL=http://127.0.0.1:3001.

First deployment:

  1. pnpm --filter @flyaway/web exec wrangler login, with an account that has the zone for your domain.
  2. Remove any DNS records for the domain and its www subdomain. The Worker claims both as custom domains, and Cloudflare creates their records and certificates on deploy. www redirects to the bare domain.
  3. Copy WEBSITE_KEY from the backend’s .env, then run pnpm --filter @flyaway/web exec wrangler secret put WEBSITE_KEY and paste it. With it, the backend counts rate limits per visitor rather than per Cloudflare address: Cloudflare doesn’t pass X-Forwarded-For through, so the Worker names the visitor in its own header, and the backend only believes that header when the key matches.
  4. pnpm --filter @flyaway/web cf:deploy.

Images on server-rendered pages are resized by Cloudflare Images (the IMAGES binding; the free plan includes 5,000 unique transformations a month, and the landing page needs about ten). Prerendered pages get theirs resized at build time.

The Workers free plan gives each request 10 ms of CPU time. The airport, airline and aircraft pages render in about 2 ms; built ahead instead, they’d be some 11,000 files and 600 MB per deployment. If pages fail with “exceeded CPU” errors in the Worker’s logs, move to Workers Paid.

Edit this page on GitHub