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

Install it, open your community, publish your dating app

Heartfold is a dating app that you run as your own business. Members meet in the member app (Android and iOS): profiles with photos and prompts, a match only when both like each other, chat, gifts and video calls. You and your staff run the community from the web admin: members, reports, photo review, chat safety, plans and prices, and settings. A public website carries your home page, the safety and legal pages, a support form and the account-deletion page the app stores ask for.

This guide is written for first-time installers. Every command is shown in full, every setting says where to find it, and every rule is explained in plain words. Read Part 01 to get the server running, Part 02 to connect email, push, calls and purchases, and Part 03 to build and publish the app under your own name.

Part 01

Get started

1Welcome

Thank you for choosing Heartfold. This guide takes you from the download to a running dating community with your own owner account, your own keys and your own app in the stores.

What you get

  • The member app (Flutter, one app for Android and iOS): sign-up with email, password and date of birth (18 and over, checked on the server), the community promise (terms, privacy policy and community rules), password reset by emailed code, profile setup (2 to 6 photos, 3 prompts, up to 8 interests, the basics, a rough location or a chosen area), Discover cards with like, pass and super like, filters, profile pages, the match moment, who liked you, chats with read receipts, typing and gifts, video calls between matches, report and block on every profile, card, chat and call, Heartfold Plus and packs bought through the App Store and Google Play, restore purchases, settings, a safety centre, pause and delete account. Light and dark themes.
  • The web admin for you and your staff: an overview, members (warn, suspend, ban, remove a photo, export their data, delete), the reports queue with the evidence of each report, photo review, chat safety (banned words and the messages held back), plans and prices, gifts, purchases, analytics, staff with three roles (owner, admin, moderator), settings and a setup check that tests every outside service live.
  • A public website: a home page with your app's store badges, a safety page, the legal pages you write in the admin, a support form, and the delete your account page Google Play asks dating apps for.
  • An install wizard and a sample city ("Bellmare": 67 sample members, chats, reports and purchases) you can load with one command to see every screen with data in it.
  • One-command self-hosting with Docker: the server (one compiled Rust program that also serves the web admin and the website), PostgreSQL, MinIO file storage and optional automatic HTTPS with Caddy. Calls run on your own LiveKit (LiveKit Cloud or the bundled docker/livekit).

What is in the download

PathWhat it is
apps/backend/The server, written in Rust (Axum): the /api/v1 API for the web admin, the website and the member app, live updates, the background jobs, call tokens for LiveKit and the built web app, compiled into one program called heartfold. apps/backend/seed/ holds the sample city and the starter legal texts.
apps/frontend/The web app: React 19, React Router 7, Vite, Tailwind CSS 4 and shadcn/ui. The web admin, the public website, sign-in and the install wizard.
heartfold_mobile_flutter/The member app in Flutter, for Android and iOS.
migrations/The PostgreSQL database schema. The server applies it by itself when it starts.
docker/, compose.yamlThe Dockerfile, the Docker Compose stack, the Caddy HTTPS config and docker/livekit (your own LiveKit server for calls, optional).
.env.exampleEvery server setting, explained. Copy it to .env. The app has its own, heartfold_mobile_flutter/.env.example.
tools/rename.mjsA command that gives the app and the web app your name, id, link scheme, colour, fonts and icon (chapter 16).
docs/This documentation as one HTML file and as a PDF, plus the list of third-party licences.
README.md, CHANGELOG.md, LICENSE.txtA one-page quick start, the version history and the licence notes.

How the parts fit together

Everything that is yours runs on one server in Docker. The member app and the browsers talk to it over HTTPS. The outside services are run by other companies, with your own accounts and keys; each one is optional until you need it.

In words: the member app calls the API over HTTPS and keeps a live connection open for new matches, messages and calls. The server keeps everything in PostgreSQL (the job queue and the rate limits too, so there is nothing else to run) and the photos in file storage. When two matches start a call, the server signs a short token and the app joins your LiveKit room directly; the video never passes through your server. Members pay Apple or Google in the app; the app hands the server the store's proof, and the server checks it with the store before it unlocks anything. The stores later tell the server about renewals and refunds. Push messages go out through your Firebase project; emails through your SMTP provider.

Screenshots

The main screens of the web admin, the website and the member app. The chapters in Part 03 and Part 04 have more.

The admin overview: members, matches and messages today, Plus members, store sales and what needs attention
The admin overview: members, matches and messages today, Plus members, store sales and what needs attention
A report with the messages and photos copied when it was made, and the moderator's actions
A report with the messages and photos copied when it was made, and the moderator's actions
Photo review: new photos wait here before other members see them
Photo review: new photos wait here before other members see them
The public home page with your app's store badges
The public home page with your app's store badges
Discover: one card at a time, with a rough distance only
Discover: one card at a time, with a rough distance only
The match moment, with openers from their prompts
The match moment, with openers from their prompts
A chat with a gift and read receipts
A chat with a gift and read receipts
A video call between two matches
A video call between two matches

2Requirements

To run the server (recommended: Docker)

  • A 64-bit Linux server (Intel/AMD or ARM) with Docker Engine 24 or newer and Docker Compose 2.20 or newer (the stack uses Compose's include feature). Docker Desktop or Colima on macOS, or Docker Desktop on Windows, works for trying it on your own computer.
  • For the first build (Docker compiles the Rust server and the web app from source): 2 processor cores and 4 GB of memory (or 2 GB plus swap) and about 6 GB of free disk for Docker's build cache. Later builds reuse the cache. docker builder prune gives the cache space back once the app runs.
  • To run it the server needs far less: the app itself is one small program; PostgreSQL and MinIO run beside it, so plan at least 1 GB of memory for a small community. You can also build on another computer and run the result on a smaller server (chapter 5).
  • A domain name and HTTPS for a public launch. The app needs 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 member app

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

To build or change the server without Docker

  • Rust 1.90 or newer (stable; rust-toolchain.toml picks the stable channel and adds clippy and rustfmt) 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
Apple Developer Program and Google Play ConsolePublishing the member app under your own name, and selling Plus and the packs inside it.To publish the app
An SMTP email providerPassword reset codes, staff invitations and the website's account-deletion codes. Without it, each email is written to the app's log.For a public launch
Firebase (Google)Push notifications to locked phones: new matches, likes, messages, gifts and incoming calls. Without it, the app still updates live while it is open.Strongly advised
LiveKit (LiveKit Cloud, or your own LiveKit server)Video calls between matches. Without it, the call button is hidden and chat still works.For calls
Google Cloud (the project of your Play service account)The service account that checks Android purchases, and a Pub/Sub topic that tells your server about Android renewals and refunds.To sell on Android
S3-compatible storageMember photos and your logo. The bundled MinIO does this on the same server.Optional

3Extra costs you pay

Heartfold has no monthly fee of its own. What you pay each month depends on the outside services you turn on. Each of them is a third-party service run by another company with its own pricing, and you, the buyer, are responsible for every one of these costs. The prices below are the providers' published list prices in November 2026; they change, so check each provider's own pricing page before you set your prices.

ServicePriceWhat that means for you
Apple App Store commission (pricing)15% or 30%Apple keeps a share of every Plus subscription and pack sold on iPhone: 15% in the App Store Small Business Program (under $1 million a year) and on subscriptions after a subscriber's first year, otherwise 30%.
Google Play service fee (pricing)15% or 30%Google keeps 15% of subscriptions and of the first $1 million a year of other sales, 30% above that.
Apple Developer Program (pricing)$99 a yearNeeded to publish on the App Store.
Google Play Console (sign up)$25 onceNeeded to publish on Google Play.
LiveKit Cloud (pricing)Free plan, then from $50 a monthBilled by the minute each person is connected, and by the video data sent. The free Build plan includes 5,000 minutes and 50 GB a month; the Ship plan ($50) includes 150,000 minutes, then $0.0005 a minute, and 250 GB, then $0.12 a GB. A 15-minute call between two members uses 30 minutes. Your own LiveKit server instead costs only that server and its traffic.
Firebase Cloud Messaging (pricing)FreeNo charge per push message. Other Firebase products you turn on yourself may be billed.
Google Cloud Pub/Sub (pricing)By data volumeCarries Google Play's purchase notifications to your server. Purchase notifications are small messages; check the free allowance and prices on Google's page.
Email (for example Amazon SES)$0.10 per 1,000Per email sent. Other SMTP providers sell monthly plans with a free tier.
File storage$0 to $0.015 per GBThe bundled MinIO or the server's own disk costs nothing extra. Cloudflare R2, for example, charges $0.015 per GB a month with the first 10 GB free and no fee for downloads.
Server (VPS)about $10 to $40 a monthOne server with 2 cores and 4 GB of memory runs the whole Docker stack for a city.
Domain nameabout $10 to $20 a yearThe address of your community, for example app.example.com.
Where the money comes from

Members pay for Heartfold Plus and the packs inside the app. Apple and Google collect the money, keep their commission and pay the rest to your developer accounts; Heartfold never sees a card. You set the prices in App Store Connect and the Play Console (chapter 12).

4Install with Docker

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

  1. Unzip the download and open a terminal in the heartfold/ folder (the one with compose.yaml in it).
  2. Create your settings file:
    cp .env.example .env
  3. Open .env in any text editor and fill in these four values:
    APP_URL=http://localhost:8080                 # your public https:// address on a server
    APP_SECRET=paste-a-random-string-here         # make one with: openssl rand -hex 32
    POSTGRES_PASSWORD=pick-a-long-password        # letters and digits only
    S3_SECRET_ACCESS_KEY=pick-another-password    # at least 8 characters
    Change both passwords: the example values are public. Keep APP_SECRET safe and never change it after the install, because it encrypts the keys you save in the admin. Leave DATABASE_URL empty: Docker builds the database address from the values above. Leave DEMO_MODE and DEMO_PURCHASES at "false".
  4. Start everything:
    docker compose up -d
    The first time, Docker builds the web app and the Rust server, then starts PostgreSQL and MinIO (file storage), creates the storage bucket and starts the app, which applies the database migrations by itself. After you change the code or update to a new version, add --build (docker compose up -d --build).
  5. Find the install token in the app's log (if the app has restarted, use the last line):
    docker compose logs app | grep -i "install token"
    The line reads Install token: hf-install-… (open /install and paste it).
  6. Open http://localhost:8080. The install wizard opens: paste the token, check the server, create your owner account, name your community and, if you like, connect email.
  7. Optional: load the sample city to see everything with data in it (chapter 33):
    docker compose exec app heartfold 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 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 app 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 members, Heartfold must be reachable at a public https:// address: the app talks to it, Apple and Google send their purchase notifications to it, and the website and the delete-account page live there.

1. Pick a server (VPS)

SizeGood for
2 cores, 4 GB memory, 40 GB diskBuilding on the server and running a community of thousands of members.
1 to 2 cores, 1 to 2 GB memoryRunning a build made on another computer (see "Build on another computer" below), or building with swap added.
4+ cores, 8+ GB memoryA large community, or several server copies behind a load balancer (chapter 32).

Any provider that sells Linux servers with Docker works. Disk use grows mainly with member photos, so move files to outside storage once it grows (chapter 9). Run your own LiveKit on a second server, or use LiveKit Cloud (chapter 11).

2. DNS

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

3. Settings

In .env:

APP_URL=https://app.example.com
APP_DOMAIN=app.example.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

The https profile adds Caddy, a web server that gets and renews a free certificate for APP_DOMAIN by itself. Open https://app.example.com; the first visit takes a few seconds while the certificate is issued. Caddy passes the live updates (the app's WebSocket and the admin's event stream) through as they happen.

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 and let your proxy pass visitors on to Heartfold, as the next part shows.

Behind a proxy you already run (Traefik, Nginx)

Where the proxy runs decides how it reaches the app:

  • Installed on the server itself (Nginx or Apache from the system's packages): point it at http://127.0.0.1:8080 (APP_PORT), the port the app opens on this server only.
  • In a Docker container (Traefik, Nginx Proxy Manager, an Nginx container): it cannot use 127.0.0.1:8080, because inside a container that address is the container itself. Put the app on the proxy's Docker network instead, with a compose.override.yaml file next to compose.yaml. Docker Compose reads it by itself on every docker compose command. docker network ls shows the proxy's network name; the examples call it proxy.

Traefik: the labels tell Traefik the address, the entrypoint and the certificate resolver. Use the entrypoint and resolver names from your own Traefik setup (websecure and letsencrypt are common). Traefik passes WebSockets through by itself.

# compose.override.yaml: Heartfold 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.heartfold.rule=Host(`app.example.com`)
      - traefik.http.routers.heartfold.entrypoints=websecure
      - traefik.http.routers.heartfold.tls.certresolver=letsencrypt
      - traefik.http.services.heartfold.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: Heartfold on the network of an Nginx container
services:
  app:
    networks:
      default:
      proxy:
        aliases: [heartfold]

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

Then send the traffic to http://heartfold:8080 (or http://127.0.0.1:8080 for an Nginx on the server itself). The member app keeps a WebSocket open, so Nginx needs the upgrade headers:

location / {
    proxy_pass http://heartfold: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 app's live connection (WebSocket)
    proxy_set_header Connection "upgrade";
    proxy_read_timeout 1h;
    proxy_buffering off;                        # the admin's live updates are a stream
    client_max_body_size 21m;                   # photos go up to 10 MB
}

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

Heartfold limits sign-ins, sign-ups, password resets and the support form per visitor address, so nobody can guess passwords at speed. It reads the visitor's address from the X-Forwarded-For header only behind the number of proxies you trust, set with TRUSTED_PROXY_HOPS. A visitor can type any X-Forwarded-For they like, so trusting it without a proxy would let them make up a new address for every try.

Your setupSetting
The bundled Caddy (--profile https)TRUSTED_PROXY_HOPS=1 (the Docker default). The app port is published on 127.0.0.1 only, so Caddy is the only way in, and Caddy replaces any X-Forwarded-For a visitor sends with the real address.
Your own Nginx, Apache or Traefik on the same server (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.
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, so every visitor counts as one address: the per-address limits (for example 5 sign-ups an hour) are shared by everyone. The app also needs HTTPS, so this suits only testing.

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

Build on another computer

If your server is small, build the program on a bigger computer with Docker and copy it over. The packed program is one file that already holds the web app.

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

# copy prebuilt/heartfold into the same folder on the server, then on the server:
BUILD_TARGET=prebuilt docker compose --profile https up -d --build

Set BUILD_TARGET=prebuilt in .env to keep it for later starts. The program must match the server's processor type (Intel/AMD = linux/amd64, ARM = linux/arm64).

Without Docker

Build the web app, then the server, and run the server behind your own HTTPS proxy:

cd apps/frontend && corepack enable && pnpm install && pnpm build && cd ../..
cargo build --release -p heartfold-server
./target/release/heartfold pack apps/frontend/dist/client ./heartfold
# .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 ./heartfold serve

Keep it running with a service manager such as systemd. The server applies the migrations when it starts; ./heartfold migrate applies them on their own.

Other hosts

  • Platforms that run a Docker image (most cloud container services): build the image with docker build -f docker/Dockerfile -t heartfold ., 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 and needs WebSockets.
  • Managed PostgreSQL works through DATABASE_URL (a direct connection, not a transaction pooler: see chapter 32).
  • Shared web hosting (cPanel, PHP hosting) cannot run Heartfold: it needs a server that runs Docker or a Linux program.

Two copies on one server

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

# .env of the live copy
COMPOSE_PROJECT_NAME=heartfold
APP_PORT=8080
APP_URL=https://app.example.com

# .env of the staging copy
COMPOSE_PROJECT_NAME=heartfold-staging
APP_PORT=8081
APP_URL=https://staging.example.com
SEARCH_INDEXING=off

COMPOSE_PROJECT_NAME keeps each copy's containers, database, files, network, image and build cache apart. Left empty, it is the folder's name, so always set it when you run two copies. Give each copy its own passwords and its own APP_SECRET. Only one copy can run the bundled Caddy, so put both behind one proxy you run yourself. SEARCH_INDEXING=off keeps search engines away from the staging copy.

6Install wizard

The first visit to a new install opens the wizard at /install. It has five steps and runs once; afterwards the page is locked so nobody else can take the server over. Closed the tab or reloaded after step 2? Sign in with the owner account you just made and open /install again within a day: the wizard carries on at the Community step.

  1. Server checks. Paste the setup token from the app's log (docker compose logs app | grep -i "install token") and press Check the server. The app prints a new token at every start until the install is finished, so use the last line. Lost it? Set INSTALL_TOKEN in .env to a value of your choice and restart the app with docker compose up -d. The wizard then lists the database, file storage, the app address and the other checks; a red line blocks the next step until you fix .env, restart the app and check again.
  2. Your owner account. Your name, email and a password of at least 10 characters. This is the community's owner, the highest role (chapter 20).
  3. Community. The name members see (up to 60 characters), the support email members write to, the time zone (reports, the daily likes reset and the nightly jobs follow it) and the minimum age, from 18 to 99. Nobody younger than 18 can ever sign up, whatever you enter.
  4. Email (SMTP). The mail server, port, user name, password and the sender. Optional now (you can skip it): until it is set, reset codes and invitations are written to the app's log.
  5. Finish. The wizard lists what is set up and what is left for later (legal pages, push and calls), with buttons to the setup check and the admin.
Step 1: the setup token and the server checks
Step 1: the setup token and the server checks
Step 3: the community's name, support email, time zone and minimum age
Step 3: the community's name, support email, time zone and minimum age

7Setup check

Admin → Setup check lists everything a running community depends on, with a plain-words status and what to do about it. Run again checks everything again and then tests every service that can be tested for real; the results replace the rows they test. Use it after every change of keys: it is the quickest way to test each integration.

RowWhat it shows, and what the test does
DatabasePostgreSQL is reachable and how many migrations are applied. The test reads the PostgreSQL version.
File storageThe S3 bucket, or a warning that files are on this server's disk. The test writes, reads and deletes a small test file.
Email (SMTP)The sender and mail server. The test connects and signs in; with an address typed in, it also sends a real test email.
Push messagesWhether a Firebase service account and project id are saved. The test asks Google for an access token with that service account (it sends no message).
Video calls (LiveKit)Whether the LiveKit address, key and secret are set. The test asks your LiveKit server for its rooms with your key.
App Store purchasesOff, checked by Apple's signature only (bundle id set, no API key), or checked and confirmed with Apple (key set). The test signs an App Store Server API token with your key and asks Apple about a purchase that does not exist: Apple's "not found" proves the key; nothing is bought.
Google Play purchasesOff, on without refunds and renewals (no notifications token), or fully on. The test asks Google for an access token with your Play service account.
PurchasesHow the app buys now: through the stores, off ("Purchases aren't set up" in the app), or red when DEMO_PURCHASES is on outside the public demo.
Legal pagesWhether the terms, privacy policy and community rules have text. The app stores ask for them before a dating app goes live.
App addressWhether APP_URL is https. The test calls APP_URL/api/health from the server itself.
Visitor addressesThe TRUSTED_PROXY_HOPS setting (chapter 5).
Background jobsJobs that failed in the last 24 hours, or wait over 10 minutes. See jobs opens the list, where a failed job shows why and can be retried (chapter 31).
InstallWhether the install wizard has finished.
Setup check: each service with its status, where to fix it, and a live test
Setup check: each service with its status, where to fix it, and a live test
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, 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. Only admins and the owner open Settings.

8Email (SMTP)

Heartfold sends the 6-digit password reset codes (and the reset link for staff on the web), staff invitations, and the codes of the website's delete-your-account page. It sends no newsletters or marketing.

  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. Test it on the Email row of the setup check with your own address typed in.

Without SMTP, each email is written to the app's log with its code or link (docker compose logs app), which is enough for testing. The same settings page lets you reword the three emails (password reset, delete account, staff invitation): subject, text and button, with placeholders filled in for each email and a preview.

Email costs

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

9File storage

Member photos and your logo are stored in an S3-compatible bucket. The Docker stack includes MinIO with a private bucket on the same server, so this works out of the box. Photos are private: the server hands each one only to its owner, the staff, and members allowed to see it (never across a block).

  • 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; several server copies need a shared bucket.

The Storage page also sets the room each person gets for their files (default 100 MB, 0 for no limit), shows what is stored and has a Test storage button. Uploads are checked by their content, not their name: profile photos are JPEG, PNG, WebP or HEIC (iPhone) of at most 10 MB, six per member; the logo is PNG, SVG or WebP of at most 1 MB.

Storage costs

The bundled MinIO and the server's own disk cost nothing extra. Outside storage providers are third-party services with their own pricing, and you pay them for space and sometimes for downloads: Cloudflare R2, for example, charges $0.015 per GB a month after the first 10 GB, with no download fees.

10Push notifications (your own Firebase project)

Push notifications reach a locked phone: a new match, a like, a message, a gift and an incoming call. They go through Firebase Cloud Messaging in your own Firebase project. Without it, the app still shows everything live while it is open, and the in-app notifications list still fills.

There are two halves: the app needs your project's ids (so each phone can get a push token), and the server needs a service account key (so it can send). Members choose which kinds they get in the app (Settings → Notifications). A push names the person (for a message, with its first 80 characters), and only the first unread message of a chat sends one.

Firebase costs

Firebase is a third-party service run by Google with its own pricing structure, 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.google.com/pricing).

Not in the download

The zip contains no Firebase files of any kind: no google-services.json, no GoogleService-Info.plist, no firebase_options.dart, no service account key and no Firebase ids in any .env. Every one comes from your own Firebase project, made in the steps below.

1. Create the Firebase project

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

2. Register the app with flutterfire configure

Install the tools once: the Firebase CLI (npm install -g firebase-tools, then firebase login) and the FlutterFire CLI (dart pub global activate flutterfire_cli). Decide your app's id first (chapter 16), then run this in heartfold_mobile_flutter/ with your own project id and app id:

flutterfire configure --project=your-firebase-project --platforms=android,ios \
  --android-package-name=com.example.yourapp --ios-bundle-id=com.example.yourapp --yes

It registers the Android and iOS app in your project and writes lib/firebase_options.dart, android/app/google-services.json and ios/Runner/GoogleService-Info.plist. The app reads its Firebase settings from its .env (next step), so these files are only where you copy the values from. You can also add the apps by hand in Firebase → Project settings → Add app and read the same values there.

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

Key in heartfold_mobile_flutter/.envWhere the value is
FIREBASE_API_KEYapiKey of the android options in firebase_options.dart (current_key in google-services.json).
FIREBASE_PROJECT_IDprojectId
FIREBASE_MESSAGING_SENDER_IDmessagingSenderId
FIREBASE_ANDROID_APP_IDappId of the android options (1:…:android:…)
FIREBASE_IOS_APP_IDappId of the ios options (1:…:ios:…)
FIREBASE_IOS_BUNDLE_IDiosBundleId
FIREBASE_STORAGE_BUCKETstorageBucket (optional)

Then run or build the app with that .env (chapter 14). With FIREBASE_API_KEY, FIREBASE_PROJECT_ID or FIREBASE_MESSAGING_SENDER_ID empty, the app quietly runs with push off. The app asks for permission on the "Turn on notifications" step of profile setup and sends its push token to the server.

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 → Push, paste the file's text or press Upload the JSON file, 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. The Push row of the setup check turns green. Its test (the same as Send a test push on the settings page) checks the service account with Google; it does not send a message to a phone.

5. Test it

Install the app on a real phone (simulators don't get pushes reliably), sign in, allow notifications and lock the phone. From a second account that has matched the first, send a message: the locked phone shows a notification within a few seconds. Device tokens that Firebase reports as gone are removed by themselves.

Settings → Push: the Firebase service account, saved encrypted
Settings → Push: the Firebase service account, saved encrypted

11Video calls (LiveKit)

Two members who matched can video call each other from their chat. Calls run on LiveKit, an open-source video server: either LiveKit Cloud (nothing to run) or your own LiveKit server from docker/livekit. Until it is set up, the app hides the call button and chat works as usual.

How a call works

  1. The caller taps the video button in a chat. The server checks that the two are matched, neither has blocked the other, the person called allows calls from matches (Settings → Privacy in the app), neither is already on a call, and the caller has started fewer than 10 calls this hour.
  2. The server makes a room for this call only (call-<id>) and signs a token for the caller with your LiveKit API secret: it lets this one person into this one room, lasts 2 hours and never leaves the secret on your server. The other person's phone rings (a live event, and a push when the app is closed).
  3. The person called answers (and gets their own token) or declines. Nobody answering for 30 seconds makes it a missed call.
  4. Both phones send their camera and microphone straight to LiveKit; the video never passes through your Heartfold server. A room holds two people at most.
  5. Either side hangs up; the chat gets a call line with its length, and the server closes the room. A block, an unmatch, a suspension, a ban or a deleted account ends a live call at once.

Before the first call, the app shows a short safety sheet once. In a call, members can mute, turn the camera off, flip the camera and open the menu to report or block.

LiveKit costs

LiveKit Cloud is a third-party service with its own pricing, and you pay it: billed by the minute each person is connected and by the video data sent. In November 2026 the free Build plan includes 5,000 minutes and 50 GB a month, and the Ship plan ($50 a month) 150,000 minutes, then $0.0005 a minute, and 250 GB, then $0.12 per GB. A 15-minute call between two members counts 30 minutes. See livekit.io/pricing. Your own LiveKit server is free software (Apache 2.0): you pay only for that server and its traffic.

Option A: LiveKit Cloud

  1. Sign up at cloud.livekit.io and create a project.
  2. In the project's Settings → API keys, create a key. Copy the WebSocket URL (wss://your-project.livekit.cloud), the API key and the API secret.
  3. Paste them into Admin → Settings → Calls (LiveKit address, API key, API secret) or into LIVEKIT_URL, LIVEKIT_API_KEY and LIVEKIT_API_SECRET in .env. Leave the Room API address empty.
  4. Press the test on the Video calls row of the setup check.

Option B: your own LiveKit server (docker/livekit)

Calls use bandwidth and processor time, so give LiveKit a small server of its own (2 cores and 2 GB are plenty to start). It also needs ports 80 and 443 for its certificate, which the Heartfold server's Caddy already uses.

  1. Point a domain at the LiveKit server, for example calls.example.com.
  2. Open these ports on its firewall: 80/tcp and 443/tcp (Caddy: the certificate and the signalling), 7881/tcp and 7882/udp (the call media).
  3. Copy the docker/livekit folder to that server and put a .env next to it with three keys:
    LIVEKIT_API_KEY=heartfold                         # any name
    LIVEKIT_API_SECRET=paste-a-long-random-secret     # openssl rand -base64 48 (32+ characters)
    LIVEKIT_DOMAIN=calls.example.com
  4. Start it there: docker compose up -d (on the Heartfold server itself, docker compose --env-file ../../.env up -d from docker/livekit reads the same keys from Heartfold's .env, but only if ports 80 and 443 are free).
  5. In Heartfold (Admin → Settings → Calls, or .env): LIVEKIT_URL=wss://calls.example.com and the same key and secret. Test it on the setup check.

docker/livekit/livekit.yaml lets two people into a room, closes an empty room after a minute, and finds the server's public address by itself (use_external_ip); behind an address it cannot see, set node_ip there. LiveKit's own self-hosting guide: docs.livekit.io.

Calls that connect but show no video

Almost always the media ports: 7881/tcp and 7882/udp must be open on the LiveKit server and on any cloud firewall in front of it. Mobile networks and office Wi-Fi that block UDP fall back to TCP 7881.

Settings → Calls: the address, API key and secret
Settings → Calls: the address, API key and secret

12In-app purchases (App Store and Google Play)

Members buy Heartfold Plus (a subscription) and packs of super likes, boosts and coins inside the app, through Apple's and Google's own payment sheets. The money goes to your developer accounts. Nothing is unlocked by what the app says: the server checks every purchase with the store, using your own keys, before it adds anything.

Store commission

The App Store and Google Play are third-party services with their own pricing: each keeps a commission of every sale, usually 15% to 30% (Apple, Google), and charges its developer fee ($99 a year for Apple, $25 once for Google). You pay these, not Heartfold.

Licence

Selling Plus, packs or coins to your members through Heartfold requires the Envato Extended Licence (chapter 45).

What members can buy

Every install starts with these products. Their store ids are samples: create the same ids in your store accounts, or change the ids in Admin → Plans and prices to the ones you create. The price shown in the app always comes from the store; the sample price is only what the admin shows.

ProductSample store id (Apple and Google)Kind in the storeWhat it gives
Plus · 1 week, 1 month, 6 monthsheartfold.plus.week, heartfold.plus.month, heartfold.plus.halfyearAuto-renewable subscription (Apple: one subscription group) / Subscription (Google)Unlimited likes, see who liked you, undo a swipe, 5 super likes a week, 1 boost a month and the advanced Discover filters, until the period ends.
5 or 15 super likesheartfold.superlikes.5, heartfold.superlikes.15Consumable / One-time productSuper likes to spend in Discover.
1 or 5 boostsheartfold.boosts.1, heartfold.boosts.5Consumable / One-time productA boost puts the member first in Discover for 30 minutes (Settings → Discovery and limits).
100, 550 or 1,200 coinsheartfold.coins.100, heartfold.coins.550, heartfold.coins.1200Consumable / One-time productCoins pay for gifts in chat. The person who receives a gift gets nothing they can spend or cash out.

1. App Store (iPhone)

  1. In App Store Connect, create your app with your bundle id (chapter 17), accept the Paid Apps agreement and fill in your banking and tax details (Business); Apple sells nothing until these are done.
  2. Under your app → Monetization → Subscriptions, create one subscription group (for example "Plus") with three subscriptions whose product ids match Plans and prices. Under In-App Purchases, create the seven packs as Consumable. Give each a price, a display name and a review screenshot.
  3. Make the In-App Purchase key for the App Store Server API: Users and Access → Integrations → In-App Purchase → generate a key. Copy the Issuer ID and the Key ID, and download the .p8 file (Apple lets you download it once).
  4. Enter them in Admin → Settings → Store keys: the bundle id, the issuer id, the key id and the contents of the .p8 file, and which purchases to accept (both, the default, so App Review's sandbox purchases work; or production or sandbox only). Optionally add the app's numeric Apple ID (App Store Connect → the app → App Information): once it is set, a store notification that names another app's Apple ID is refused. In .env instead: APPLE_BUNDLE_ID, APPLE_ISSUER_ID, APPLE_KEY_ID, APPLE_PRIVATE_KEY (one line, \n for the line breaks), APPLE_ENVIRONMENT and APPLE_APP_ID.
  5. Turn on App Store Server Notifications: your app → App Information → App Store Server Notifications, set the Production and the Sandbox server URL to https://app.example.com/api/v1/webhooks/apple with Version 2. They need no token: each notification is signed by Apple and the server checks that signature.
  6. In Xcode, add the In-App Purchase capability to the Runner target (Signing & Capabilities → + Capability).

With only the bundle id, purchases are checked by Apple's signature on the transaction; with the key as well, the server also asks Apple for its own copy of each one, which then wins. The setup check's App Store row says which.

2. Google Play (Android)

  1. In the Play Console, create your app with your package name and set up a payments profile. Upload a first build to a testing track (Google lets you create products only after that).
  2. Under Monetize with Play → Products: create the three Plus plans as Subscriptions (each with a base plan) and the seven packs as One-time products, with product ids matching Plans and prices.
  3. Make a service account: in the Google Cloud console, in any project of yours, turn on the Google Play Android Developer API, create a service account under IAM & Admin → Service accounts and add a JSON key to it (it downloads). In the Play Console → Users and permissions, invite the service account's email with access to your app and the permissions View financial data and Manage orders and subscriptions. Google can take up to a day to accept a new service account.
  4. Enter the package name and the JSON key's text in Admin → Settings → Store keys (GOOGLE_PLAY_PACKAGE_NAME and GOOGLE_PLAY_SERVICE_ACCOUNT_JSON in .env).
  5. Turn on real-time developer notifications (RTDN), so renewals and refunds reach your server:
    • Make up a long random word for the push address: openssl rand -hex 24. Save it as the notifications token in Settings → Store keys (GOOGLE_PLAY_RTDN_TOKEN).
    • In Google Cloud → Pub/Sub, create a topic (for example play-notifications) and give google-play-developer-notifications@system.gserviceaccount.com the Pub/Sub Publisher role on it.
    • Add a push subscription to the topic with the endpoint https://app.example.com/api/v1/webhooks/google?token=YOUR-WORD.
    • In the Play Console → Monetize with Play → Monetization setup, paste the full topic name (projects/your-project/topics/play-notifications) and press Send test notification.
Google Cloud Pub/Sub costs

Pub/Sub is a third-party Google Cloud service with its own pricing, and you pay any costs (cloud.google.com/pubsub/pricing). Purchase notifications are small and few compared with its free allowance, but Google needs a billing account on the project.

3. How the server checks a purchase

  1. The member buys on the store's own sheet in the app. The app never takes a card.
  2. The store hands the app its proof: on iPhone a signed StoreKit 2 transaction, on Android a purchase token.
  3. The app sends that proof to your server, signed in as the member.
  4. The server checks it with the store. Apple: the transaction's certificate chain must end at Apple's root certificate (bundled with the server) and its signature must match; the bundle id and environment must be yours; with your In-App Purchase key, Apple is also asked for its own copy. Google: the Play Developer API, called with your service account, says what the token bought and whether it is paid. A pending purchase (a bank check, Ask to Buy) unlocks nothing yet.
  5. Only a real, paid purchase of one of your products for this app goes on. A purchase made for another account of your app is refused.
  6. One database transaction records and grants it: the purchase row has a unique store id, so the same purchase posted twice, even at the same moment, is granted once. Plus runs until the latest end date of the member's verified Plus purchases; a pack adds its credits with a ledger line that can only be written once.
  7. The app shows the result: "You're on Plus until…", or the new balance.
  8. Google purchases are acknowledged (Plus) or consumed (packs, so they can be bought again). If Google can't be reached, a background job tries again.
  9. Renewals arrive as store notifications: Apple's App Store Server Notifications v2 (signed, checked like a transaction) and Google's real-time developer notifications (with your token; the server then fetches the subscription from Google). Each notification is applied once, however often the store sends it.
  10. The new period is recorded and Plus runs to its new end. An expiry notification ends it; without any notification, Plus ends by itself at the end of the last verified period.
  11. Refunds and revocations arrive the same way (Apple: refund or revoke; Google: a voided purchase or a revoked subscription).
  12. The purchase is marked refunded: Plus ends at once, and what is left of a pack's credits is taken back, never below zero (if the member already spent part of it, the shortfall is noted on the purchase). Admin → Purchases shows refunded purchases in red with what was taken back.
  13. The member's app updates through its live connection.

When a notification is missed

Stores send notifications again when your server doesn't answer: Apple retries a failed notification several times over the following days, and Google's Pub/Sub push keeps retrying until your server accepts it. While your server is down, nothing is lost as long as it comes back within those retries. If a renewal still never arrives:

  • Restore purchases in the app (Settings, or the Plus page) sends the store's current purchases to the server, which checks each one again and records any renewal it did not know. This is also how a member gets Plus back on a new phone.
  • Re-check with the store (Admin → Purchases, a purchase's menu; admins) asks Apple or Google about that purchase again and applies what changed, once, exactly as the notification would have: a refund takes Plus or the pack's unspent credit back, a renewal moves Plus on, an ended subscription ends Plus. A purchase the store still shows as it is changes nothing. Apple purchases need the In-App Purchase key in Store keys for this; demo purchases have no store to ask.
  • Plus never runs past the last period the server has verified, so a missed renewal can only end Plus early (the member restores it in one tap), never give it away.
  • To look at what arrived, Admin → Purchases lists every purchase with its store, status and date, and Admin → Setup check → Background jobs shows Google acknowledgements that are still being retried.

Demo purchases stay off

DEMO_PURCHASES must be "false"

DEMO_PURCHASES="true" lets purchases finish without Apple or Google (labelled "Demo purchase", no money taken): anyone would get Plus and coins for free. It exists only for a private test copy and is "false" in the shipped .env.example. The setup check shows a red "Purchases" row while it is on outside the public demo. With no store keys and no demo flag, the app shows "Purchases aren't set up" and sells nothing.

Apple's and Google's rules for digital goods

  • Plus, packs and coins are digital goods used inside the app, so they must be sold through Apple's and Google's in-app purchase (App Store Review Guideline 3.1.1, Google Play's Payments policy). Don't add your own card payment or a link to a web checkout for them in the app.
  • Subscriptions must say what they give, the price and the period, that they renew until cancelled and how to cancel, with links to your terms and privacy policy (Guideline 3.1.2). The Plus page in the app shows all of this; keep your legal pages filled in.
  • A Restore purchases button is required on iOS; the app has one on the Plus page and in Settings.
  • Coins buy gifts only. Gifts never turn into money for the person who receives them, so there is no payout to declare.
Settings → Store keys: Apple's In-App Purchase key and Google's service account and notifications token
Settings → Store keys: Apple's In-App Purchase key and Google's service account and notifications token
Purchases: every store purchase, checked on the server, with refunds in red
Purchases: every store purchase, checked on the server, with refunds in red
The Plus page with the store's own prices, restore and the subscription terms
The Plus page with the store's own prices, restore and the subscription terms
Packs of super likes, boosts and coins
Packs of super likes, boosts and coins
Part 03

The member app

The folder heartfold_mobile_flutter/ is one Flutter project that builds the member app for Android and iOS. You publish it in your own Google Play and App Store accounts, under your own name, id and icon. It talks to your Heartfold server.

13What you need

  • Flutter 3.35 or newer on the stable channel (Dart 3.9 or newer), from docs.flutter.dev. The app is built and tested with Flutter 3.44. flutter doctor tells you what is still missing.
  • For Android: Android Studio with the Android SDK (the app compiles against and targets API 36) and Java 17. The app runs 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 app runs on iOS 15 and newer.
  • Your Heartfold server online at an https:// address (chapter 5), or a test copy on your computer for the emulator.
  • A real phone for what a simulator can't do well: push notifications, the camera in video calls, and store purchases.

14Run the app

  1. Open a terminal in heartfold_mobile_flutter/ and create the settings file:
    cp .env.example .env
  2. In .env, set API_BASE_URL to your server, for example https://app.example.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:
    flutter run --dart-define-from-file=.env
    The first iOS run installs the CocoaPods by itself.
Always pass the .env

Every run and every build needs --dart-define-from-file=.env. The settings are built into the app; nothing reads a .env file on the phone. After changing .env, run or build again.

Every key in the app .env

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 Heartfold server, without /api/v1, for example https://app.example.com. Required: without it the app shows "Can't reach Heartfold".
FIREBASE_API_KEY, FIREBASE_PROJECT_ID, FIREBASE_MESSAGING_SENDER_ID, FIREBASE_ANDROID_APP_ID, FIREBASE_IOS_APP_ID, FIREBASE_IOS_BUNDLE_ID, FIREBASE_STORAGE_BUCKETYour Firebase project, for push notifications (chapter 10). Empty: the app runs without push.
SUPPORT_EMAILThe address shown in Help and on error screens. Optional.

Everything else the app needs comes from your server when it starts: the community's name and city, the legal page links, whether calls and purchases are set up, the likes limit and its reset hour, the distance unit, and on the public demo the one-click demo members. Change those in the admin; the app follows without a rebuild.

Change every key

KeyWhere you change it
The server addressAPI_BASE_URL in the app's .env, then build again.
Firebase (push), app sideThe FIREBASE_* keys in the app's .env, then build again.
Firebase (push), server sideAdmin → Settings → Push, or FCM_* in the server's .env.
LiveKit (calls)Admin → Settings → Calls, or LIVEKIT_*. No app rebuild: the server signs each call's token and hands the app the address.
Apple and Google purchasesAdmin → Settings → Store keys, or APPLE_* and GOOGLE_PLAY_*. Product ids: Admin → Plans and prices. No app rebuild.
Email (SMTP)Admin → Settings → Email, or SMTP_*.
StorageAdmin → Settings → Storage, or S3_*.
Every other server keyThe server's .env (chapter 35), then docker compose up -d.
Welcome: create an account or sign in
Welcome: create an account or sign in
The date of birth: 18 and over only, checked on the server
The date of birth: 18 and over only, checked on the server
Profile setup: 2 to 6 photos, with "in review" until approved
Profile setup: 2 to 6 photos, with "in review" until approved
Discover filters, with Plus-only filters locked for free members
Discover filters, with Plus-only filters locked for free members

15App file structure

The app follows a plain layout: models, data, state (Riverpod providers), widgets and screens each in their own folder. main.dart only starts the app; routes, theme and settings live in their own files.

heartfold_mobile_flutter/
├── lib/
│   ├── main.dart, app.dart          start-up and the app root (theme, router)
│   ├── core/
│   │   ├── env/app_env.dart         every .env key the app reads
│   │   ├── api/                     the API client (token, errors, offline cache) and the error codes
│   │   ├── router/                  every route and the gates (signed in, profile complete, suspended)
│   │   ├── session/                 the session, the secure token store and app preferences
│   │   ├── push/push_service.dart   Firebase start-up and push tokens
│   │   ├── providers/               shared app state (Riverpod): config, connectivity, theme
│   │   ├── theme/                   hf_colors.dart (colours), hf_type.dart (type), app_theme.dart
│   │   └── utils/                   formatting, links, haptics
│   ├── domain/models/               the JSON the API answers, as Dart classes
│   ├── data/                        one repository per area (auth, me, discover, social, calls, store,
│   │                                safety, notifications, catalog) and the live events socket
│   ├── components/                  the shared Hf… widgets: buttons, fields, cards, sheets, chat parts
│   └── features/                    the screens, one folder per area:
│       ├── launch/                  welcome, sign in, sign up, forgot password
│       ├── setup/                   profile setup: about, photos, prompts, interests, basics, location
│       ├── discover/                the card stack, profile page, filters, limits, report and block
│       ├── match/, likes/           the match moment, who liked you, who you liked
│       ├── chats/, calls/           the chats list, a chat, gifts, video calls
│       ├── store/                   Plus, packs and the store purchase flow
│       ├── you/, settings/          your profile, edit, preview, settings, help, safety centre, account
│       ├── shell/                   the tab bar and member routes
│       └── debug/                   a gallery of every component (debug builds only)
├── android/                         app/build.gradle.kts (id, SDK levels, signing), src/main/AndroidManifest.xml
├── ios/                             Runner (Info.plist, entitlements, icons), Runner.xcworkspace
├── assets/fonts/                    Fraunces and Outfit, with their licences
├── test/                            unit, widget and flow tests on a fake server; test/live/ against a real one
├── pubspec.yaml                     packages, fonts and the app version
└── .env.example                     every app setting

Long lists (Discover, chats, messages, likes, notifications) are built lazily with .builder lists and grids, and screens read their data through providers rather than passing it down widget by widget.

16Make the app yours

Decide the id before the first upload

Google Play and the App Store know an app by its application id (Android) and bundle id (iOS). Once the app is published, its id can never change; a new id is a new app. Pick an id on a domain you own, for example com.yourbrand.app. Heartfold ships with com.heartfold.app, which is not yours to publish.

The quick way: one command

tools/rename.mjs renames and rebrands the app, the web app's defaults and the server's default texts in one go. Commit or back up your copy first, then run it from the kit folder (the one that holds heartfold_mobile_flutter and apps). It needs Node.js and, when you give it an icon, Flutter. It is safe to run again later with new values.

node tools/rename.mjs --name "Lovebird" --id com.example.lovebird --dry       # only shows what would change
node tools/rename.mjs --name "Lovebird" --id com.example.lovebird --color "#7C3AED" --icon icon.png --icon-bg "#2A1430"
OptionWhat it does
--nameThe brand people see. Replaces "Heartfold" in the app's name on the phone (Android and iOS), the texts inside the app, the emails, the starter legal pages and the web app's default name. Up to 30 characters.
--idThe app's id in reverse-domain form and lower case: the Android applicationId and the iOS bundle id (the test target gets <id>.RunnerTests). Set it before the first store upload. The Android code namespace stays as it is; it is not the app's id.
--schemeOptional. The link scheme that opens the app from a notification or the website (lovebird://), on Android and iOS. Without it, --name in lower case without spaces is used.
--colorOptional. The brand colour (hex). The app's light and dark brand colours and their softer, darker and lighter tints are worked out from it, and the web app's stylesheet gets the same family.
--head-font, --body-fontOptional. A folder with one font family's files (.ttf or .otf, named the way Google Fonts names them: Lora-Regular.ttf, Lora-SemiBold.ttf, Lora-Italic.ttf): the headline font (Fraunces now) or the body font (Outfit now). The files and the licence text beside them are copied into assets/fonts and listed in pubspec.yaml. Add the new fonts' licence to LICENSE.txt.
--icon, --icon-bgOptional. A square PNG of at least 1024 px with no transparency for the app icon, and the colour behind it on Android 8 and newer. The script adds flutter_launcher_icons to the app's dev packages, writes flutter_launcher_icons.yaml and makes every Android and iOS icon size.
--dryShows what would change and writes nothing.

Folder, package and database names (heartfold_mobile_flutter, heartfold-server, POSTGRES_DB) stay as they are: nobody sees them. Afterwards, register the new id in Firebase and in Admin → Settings → Store keys (below). Everything the script does can also be done by hand, as below.

Rename the app (the name on the phone)

  • Android: android:label="Heartfold" in android/app/src/main/AndroidManifest.xml.
  • iOS: CFBundleDisplayName and CFBundleName in ios/Runner/Info.plist.
  • Inside the app: most screens show the community name your server sends (Admin → Settings → General → Community name), so they follow the admin without a rebuild. Two places are fixed in the code: the title in lib/app.dart and the wordmark on the welcome screen in lib/features/launch/welcome_pages.dart. Search lib/ for Heartfold to find any others.
  • Permission prompts (iOS) are in ios/Runner/Info.plist: NSCameraUsageDescription, NSMicrophoneUsageDescription, NSLocationWhenInUseUsageDescription and NSPhotoLibraryUsageDescription. Keep them true to what the app does; Apple reads them.

Rename the package and bundle id

  • Android: in android/app/build.gradle.kts, change applicationId = "com.heartfold.app" to your id. The namespace is the code's package name, not the app's id; it may stay. If you change it too, move android/app/src/main/kotlin/com/heartfold/app/MainActivity.kt to the matching folders and change its package line.
  • iOS: open ios/Runner.xcworkspace in Xcode, select the Runner target → Signing & Capabilities, and change the Bundle Identifier (it sets PRODUCT_BUNDLE_IDENTIFIER for Debug, Release and Profile). Change the RunnerTests target's id to match (com.example.yourapp.RunnerTests).
  • The link scheme heartfold:// opens the app from a notification or the website: change it in the <data android:scheme="heartfold"/> line of the AndroidManifest and under CFBundleURLSchemes in Info.plist.
  • Then: register the new id in Firebase and copy its new app ids into the app's .env (chapter 10), and set the same id as the bundle id and the package name in Admin → Settings → Store keys, or purchases will be refused as "another app".

Change the logo and the app icon

  • App icon, the easy way: add flutter_launcher_icons to dev_dependencies in pubspec.yaml, put a square 1024 px PNG with no transparency in assets/icon/icon.png, add
    flutter_launcher_icons:
      android: true
      ios: true
      image_path: assets/icon/icon.png
      adaptive_icon_background: "#2A1430"     # your icon's background colour
      adaptive_icon_foreground: assets/icon/icon.png
      remove_alpha_ios: true
    to pubspec.yaml, and run dart run flutter_launcher_icons. Keep the artwork inside the middle 60% so Android's round and shaped masks don't cut it.
  • App icon, by hand: Android's icons are android/app/src/main/res/mipmap-*/ic_launcher.png (Android Studio → New → Image Asset makes them); iOS's are the AppIcon set in ios/Runner/Assets.xcassets (drag a 1024 px image into it in Xcode).
  • The mark inside the app (the welcome screen) is drawn in code: HfLogo in lib/components/hf_photo.dart. The launch screens are android/app/src/main/res/drawable/launch_background.xml and ios/Runner/Base.lproj/LaunchScreen.storyboard.
  • The web admin's and the website's logo: Admin → Settings → Branding → Logo (PNG, SVG or WebP, up to 1 MB; also the favicon). No rebuild.

Change the colours and fonts

The app's whole look is three files in lib/core/theme/; every screen reads its colours and type from there, never a fixed value.

  • Colours: hf_colors.dart holds HfColors.light and HfColors.dark. The brand colour is brand (heart rose #E5446D, #FF5C83 in dark), with brandSoft, brandInk and brandHover beside it; apricot marks super likes, gifts and coins; premiumA and premiumB make the Plus gradient (plum to rose).
  • Fonts: the app uses Fraunces for headlines and names and Outfit for everything else, bundled in assets/fonts/ (SIL Open Font License; the licence files are beside them). To use other fonts, add their files there, list them under fonts: in pubspec.yaml and change the two family names at the top of hf_type.dart.
  • The web app has its own colours in apps/frontend/src/styles.css; its brand colour follows Admin → Settings → Branding without a rebuild.

Basic edits

  • Texts on a screen: each screen is in lib/features/<area>/; search for the words you see.
  • Prompts, interests, areas, gifts, plans and prices, the free likes a day, the boost length, km or miles: all in the admin (Part 04), no rebuild.
  • The safety centre and help texts: lib/features/settings/help_pages.dart. The promised first look at reports and support messages comes from Settings → Moderation (24 hours by default), and the photo sentence follows Photo review, so neither needs a rebuild.
  • The app version shown in the stores: version: 1.0.0+1 in pubspec.yaml (the number after + is the build number, which must go up with every upload).

17Build release files

Use a .env with API_BASE_URL on your live https:// server and your Firebase ids. Raise the build number in pubspec.yaml for every upload (or pass --build-number=2).

Android: sign, then build (APK and AAB)

  1. Make an upload key once (keep the file and its passwords safe and backed up):
    keytool -genkey -v -keystore upload-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias upload
  2. Create heartfold_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
    Use the full path of the file on your own computer (on Windows with forward slashes, for example C:/keys/upload-keystore.jks). Without this file, release builds are signed with the debug key, which Google Play refuses.
  3. Build an App Bundle for Google Play, or an APK to install by hand:
    flutter build appbundle --dart-define-from-file=.env
    flutter build apk --dart-define-from-file=.env
    The files land in build/app/outputs/bundle/release/app-release.aab and build/app/outputs/flutter-apk/app-release.apk.

iOS: choose your Apple team, then archive (IPA)

  1. Open ios/Runner.xcworkspace in Xcode, select the Runner target → Signing & Capabilities. The project ships with Automatically manage signing on and no team: choose your own team in the Team menu (sign in to Xcode with your Apple ID under Xcode → Settings → Accounts first). Xcode makes the certificates and profiles for you. Do the same for the RunnerTests target.
  2. Keep the capabilities the app needs: Push Notifications and Background Modes → Remote notifications (already there), and add In-App Purchase if you sell Plus or packs.
  3. In App Store Connect, create the app (Apps → + → New App) with your bundle id.
  4. Build the archive and the IPA:
    flutter build ipa --dart-define-from-file=.env
    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.

18Publish under your own name

You publish the app under your own developer accounts, name, icon and screenshots. Dating apps get a closer look in review than most apps; Heartfold has the parts the stores ask for built in, and this chapter shows where each one is.

What both stores ask of a dating app

The store asks forWhere it is in Heartfold
Adults onlyThe date of birth at sign-up, checked on the server: under 18 is refused, the email can't try again for 30 days, and the birth date can't be changed later (chapter 28).
Terms the member accepts before posting anythingThe community promise at sign-up (terms, privacy policy, community rules), with the time it was accepted stored. Write the three pages in Admin → Settings → Legal pages.
A way to report offensive people and contentReport on every profile, Discover card, chat and call; the report copies the evidence (chapter 21).
A way to block abusive peopleBlock on every profile, card, chat and call; it hides both people from each other everywhere.
Filtering of objectionable content, and timely action on reportsPhoto review before others see a photo, banned words in chat, the reports queue with under-18 reports first, and actions from warn to ban. You must staff it.
Published contact informationThe support email (Settings → General and Branding), the website's support form and the app's Help page.
Account deletion in the appSettings → Account → Delete account: everything is deleted at once (chapter 29).
Account deletion on the web (Google Play)The website's https://app.example.com/delete-account page: email, emailed code, deleted.

App Store

  1. Guideline 1.2 (user-generated content): in the review notes, say where report, block, the community rules and moderation are: "Report and Block are in the ⋯ menu of every profile, card, chat and call. New photos are reviewed before others see them. Banned words are refused in chat. Reports are reviewed by our moderators in our web admin."
  2. Age rating: answer the age rating questions in App Store Connect truthfully for a dating app; Apple sets dating apps to its highest age rating (18+).
  3. A review account: Apple needs a working sign-in. Make a test member with a complete profile, approve its photos, and make two or three more test members it can see (pick the same area for all of them in the app's location step, so they are near each other) and one match with a few messages. Give the sign-in under App Review Information.
  4. Privacy: the privacy policy URL is your https://app.example.com/legal/privacy. In App Privacy, declare what the app collects: contact info (email, name), user content (photos, messages, prompt answers), date of birth, approximate location, purchases, and a device identifier for push. None of it is used for tracking or advertising.
  5. Guideline 4.3 (spam): dating is a crowded category, and Apple rejects apps that look like another app or a template. Make yours distinct: your own name, icon, colours, screenshots and words, a clear idea of who your community is for (a city, an age group, an interest), your own prompts and interests, and never several copies of the same app under different names.
  6. Submit the build for review.

Google Play

  1. In the Play Console, choose Create app, pick the Dating category and fill in the store listing (name, descriptions, icon, screenshots).
  2. Target audience: 18 and over only. Content rating: answer the questionnaire as a dating app with user-to-user communication.
  3. User-generated content policy: Google requires terms accepted before members post, in-app reporting and blocking, and ongoing moderation; Heartfold has each (table above). Describe them when the Console asks.
  4. Data safety form: the app collects name, email, date of birth, photos, messages, approximate location (the app asks Android for coarse location only), purchase history and a device id for push; all sent over HTTPS. For account deletion, give the in-app path and the web address https://app.example.com/delete-account.
  5. 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.
  6. Let Google Play sign the release (Play App Signing, the default).

Links to your app

Once the app is live, paste its store addresses in Admin → Settings → App links: the App Store address (https://apps.apple.com/app/id…) and the Google Play address (https://play.google.com/store/apps/details?id=…). The public home page then shows the App Store and Google Play badges. An empty address shows no badge, so leave them empty until the app is published.

Part 04

Run the community

Who uses what: members use the member app only; you and your staff use the web admin at /admin (sign in at /signin); visitors see the public website. The rules below are checked by the server, so neither the app nor the admin can get around them.

19How Heartfold works

  1. Sign up. Email, password (at least 10 characters) and date of birth. The server works out the age in your time zone and refuses anyone under 18 (or your higher minimum age). The member accepts the terms, privacy policy and community rules. While Settings → Sign-ups is closed, no new accounts are made.
  2. Profile setup. First name, gender (woman, man, non-binary) and who to see (women, men, everyone); 2 to 6 photos; 3 prompts with answers of up to 150 characters; up to 8 interests; the basics (height, work, school, looking for, drinking, smoking); a location (the phone's, rounded to about 1 km) or an area picked from your list; then notifications. The member sees their own card as others will.
  3. Discover. One card at a time: people whose gender is in the member's "show me" and the other way round, whose age is in the member's range, within the member's distance, active, not paused, with a complete profile and at least one photo others may see, never anyone they swiped, matched or blocked (or who blocked them). Boosted members come first; people who already liked the member are mixed in one card in four; then people with more interests in common first, then recent activity and distance. Cards show a rough distance only ("about 3 km away").
  4. Like, pass, super like. Free members have 30 likes a day (Settings → Discovery and limits), back at 08:00 in your time zone; Plus members have no limit. A super like spends one super like credit. Plus members can undo their last swipe within 10 minutes if it made no match.
  5. A match happens only when both liked each other, at once, even if they like each other at the same moment. The match moment offers openers from the other person's prompts.
  6. Chat. Only between matches who can see each other. Messages of 1 to 1,000 characters, at most 20 a minute; a banned word holds the message back and says which word. Read receipts show only while the reader shares them; typing shows live. Gifts cost coins and appear in the chat with a small animation.
  7. Video calls between matches (chapter 11).
  8. Unmatch, block, report. Unmatching closes the chat and calls for both. Blocking hides both people from each other everywhere. Reporting sends the evidence to your moderators and also blocks, unless the member unticks it.
  9. Plus and packs are bought in the app (chapter 12). Plus gives unlimited likes, the faces of who liked you (free members see a blurred grid and a count), undo, 5 super likes a week, 1 boost a month and the advanced filters (height, looking for, drinking and smoking).
  10. Pause and delete. A paused profile leaves Discover, while matches and chats go on. Deleting the account erases it at once (chapter 29).

20The admin and the staff roles

Sign in at https://app.example.com/signin with your owner account. The sidebar shows badges for open reports, photos waiting for review, messages held back today and staff invitations not yet accepted. On a phone the admin has a bottom bar with Overview, Members, Reports, Photos and More (the rest of the menu).

Overview

Members, matches and messages today, Plus members and store sales this month (gross, before the stores' commission, demo purchases left out); sign-ups and matches over 30 days; what needs attention; the latest reports; members by area; this week; and the services from the setup check. Analytics shows the last 7, 30 or 90 days: new members, matches, messages, gifts and store sales, sign-ups and matches a day, sales by product, and members by gender and area, with Export CSV. Staff accounts and demo purchases are left out of the counts.

Staff and roles

RoleWhat they can do
ModeratorMembers (look, warn, suspend for up to 30 days, lift a suspension, remove a photo), Reports, Photo review and Chat safety. Nothing else.
AdminEverything a moderator does, plus ban and delete members, plans and prices, gifts, purchases, analytics, settings, the setup check, and inviting moderators and admins.
OwnerEverything. Made by the install wizard; there is one. The owner's account can't be deleted or demoted by anyone.

Admin → Staff → Invite staff: an email and a role (moderator or admin). The invitation email carries a link that works once, for 7 days. Staff can't act on themselves or on someone with a higher role, and every staff action is written to the audit log with who and when (shown as the staff history on each member). Taking someone off the staff keeps their account as a member's and ends their admin sessions at once.

Staff: the owner, admins and moderators, and the invitations waiting
Staff: the owner, admins and moderators, and the invitations waiting
Analytics over 7, 30 or 90 days
Analytics over 7, 30 or 90 days

21Moderation: reports, photos and chat safety

The reports queue

Admin → Reports has three tabs, Open, Closed and All. Open reports about someone under 18 come first, then the oldest. Each report shows when its first look is due: when it came in plus the first-look hours in Settings → Moderation (24 by default, 1 to 168). The app gives members the same promise ("a moderator looks within 24 hours"), read from that setting, so set it to what your team can keep. Open next report takes you through the queue one by one.

  1. Open a report (for example R-1042). The sheet shows who reported whom and why, the reporter's own words, and the evidence in three tabs: Messages and Photos (the last 20 messages between them and the reported member's photos as they were when the report was made, so an unmatch or a deletion can't hide them) and Profile (the member as they are now). Below are their other reports and the staff history.
  2. Read the evidence and write a note for the log (only staff see it).
  3. Pick the action: Dismiss (nothing wrong), Warn (the member gets a warning in your words, in the app and as a push), Remove photos (tick the photos to take down), Suspend for 1 to 30 days (signed out everywhere at once and refused until the end date; it lifts by itself), or Ban (admins only: closed for good, and the email can't sign up again, even after the account is deleted).
  4. The reporter gets a notification that the report was reviewed (never what was done to whom). The next open report opens.

Photo review

Admin → Photo review shows new photos oldest first. Approve one, approve several ticked ones together, or reject one with a reason the member reads; a rejected photo leaves the profile and its file is deleted. The Approved tab lists shown photos, each with Remove. Settings → Moderation decides when other members see a new photo:

  • Before (the default and the safe choice): new photos stay hidden from others until a moderator approves them. A profile with no approved photo doesn't show in Discover.
  • After: new photos show at once and still wait in the queue for a look.

Chat safety

Admin → Chat safety holds the banned words: words and phrases chat refuses (scam and abuse terms). Add one, remove one, import a pasted list or download the list (up to 1,000, each 2 to 40 characters). The check matches whole words and phrases in any case and also catches look-alike spellings such as c4sh 4pp. A refused message is never delivered; the sender sees which word and can edit it. The page lists the messages held back in the last 30 days with their senders, and the repeat senders, so you can open their member sheet.

The reports queue: under-18 reports first, then the oldest
The reports queue: under-18 reports first, then the oldest
Chat safety: banned words and the messages held back
Chat safety: banned words and the messages held back

22Members

Admin → Members lists every member, newest first, with tabs (All, Plus, Suspended, Banned), a gender filter, a search by name or email, and Export CSV (the ticked rows, or every row of the current filter). Each row's menu warns, suspends or lifts a suspension, and for admins bans or deletes.

A row opens the member sheet: their photos (each with Remove), profile, prompts, interests, balances and counts (likes sent, matches), the reports about them and by them, their purchases (admins only) and the staff history. The footer has the same actions: Warn, Suspend or Lift suspension, Ban, Export data and Delete account (the last three for admins). Export data downloads everything kept about the member for an access request (chapter 29). Deleting from here erases the account exactly as the member's own deletion does. A member's exact location is never shown, not even to staff in the admin; only the area name, when they picked one.

Members, with tabs, search and Export CSV
Members, with tabs, search and Export CSV
The member sheet with photos, reports, purchases and actions
The member sheet with photos, reports, purchases and actions

23Plans, prices and gifts

Plans and prices

Admin → Plans and prices lists the Heartfold Plus plans and the packs with their App Store and Google Play product ids, the sample price, how many were sold and whether each is on sale. Add a product or open one to edit it:

  1. Pick the kind (Plus, super likes, boosts or coins; it can't change later), the title on the paywall, the length in days (Plus, 1 to 400) or how many are in the pack.
  2. Type the App Store product id and the Google Play product id exactly as you created them in the stores (chapter 12).
  3. The sample price is only what the admin shows; the app always shows each store's own price. Set the order on the paywall and whether it is on sale.

A product never bought can be deleted; a bought one is switched off instead, so past purchases keep their product. Under the products, the page sums up what Plus gives and has a Free plan card: likes a day (1 to 1,000), the hour they come back and the boost length (5 to 1,440 minutes), the same values as Settings → Discovery and limits.

Gifts

Admin → Gifts shows the gifts members send in chat, with their icon, name, price in coins (1 to 100,000), how many were sent and On sale. The starter set is Rose (10), Coffee (25), Cupcake (40), Sunflowers (80), Love letter (120) and Full moon (250). Members see a change at once. A gift never sent can be deleted; a sent one is taken off sale.

Purchases

Admin → Purchases lists every store purchase, newest first: the member, the product, the store, the price the store charged, the status (verified, refunded, revoked, expired) and the date, with tabs by status, a store filter, totals and Export CSV. Refunded and revoked purchases show in red with what was taken back. Re-check with the store in a purchase's menu asks Apple or Google about it again when a refund or renewal notification was missed (chapter 12).

Plans and prices with the App Store and Google Play product ids
Plans and prices with the App Store and Google Play product ids
Gifts and their price in coins
Gifts and their price in coins

24Prompts, interests, areas and limits

The choices members pick from are yours to edit in Admin → Settings → Profile options:

  • Prompts: the questions members answer three of ("A perfect Sunday looks like…"), 3 to 80 characters each, in your order. Switch one off to stop new members picking it; answers already given stay.
  • Interests: the chips members pick up to eight of, each under a heading (for example "Active", "Food and drink"), 2 to 30 characters.
  • Areas: the neighbourhoods a member can pick instead of sharing their location, each with a name, a one-line description and a centre point (latitude and longitude, used to work out rough distances). Members never see another member's area; it is only for their own distance.

The list shows how many members use each one. Settings → Discovery and limits holds the rest of the community's rules:

SettingWhat it doesDefault
CityThe city the community is for, shown on the app's welcome screens.Empty
Distance unitKilometres or miles, on every card and filter.km
Free likes a dayHow many likes a free member has each day. Plus has no limit.30
Reset hourWhen the likes come back, in your time zone (Settings → General).08:00
Boost lengthHow long a boost puts a member first in Discover.30 minutes
Settings → Profile options: prompts, interests and areas
Settings → Profile options: prompts, interests and areas
Settings → Discovery and limits
Settings → Discovery and limits

25Settings and legal pages

Admin → Settings (admins and the owner). The first nine sections are tabs; the rest are under More. Edits stay on the page while you move between sections, and one Save saves every changed section (Profile options and the legal pages save as you go). A dot next to a section shows its setup-check status.

SectionWhat it holds
GeneralCommunity name, support email, time zone, minimum age (18 or more) and the brand colour.
Discovery and limitsCity, km or miles, free likes a day, reset hour, boost length (chapter 24).
Profile optionsPrompts, interests and areas (chapter 24).
ModerationPhoto review before or after others see a photo, and the first-look hours: how soon your team promises to look at a report or answer a support message (24 by default, 1 to 168), shown in the app and as each report's due time (chapter 21).
PushThe Firebase service account, and Send a test push (chapter 10).
CallsThe LiveKit address, API key and secret, an optional room API address under Advanced, and Test the connection (chapter 11).
EmailThe mail server, a test email to any address, and the wording of the reset, delete-account and invitation emails (chapter 8).
Store keysApple's bundle id, environment, app Apple ID (optional) and In-App Purchase key; Google's package name, service account and notifications token; the two notification addresses to paste into App Store Connect and Pub/Sub, with Copy; and Test the keys (chapter 12).
Legal pagesTerms of service, privacy policy, community rules and cookies, in Markdown with a preview. Each page saves on its own; a page with no text is not published.
Demo modeWhether the server runs as a public demo, and how to turn it off (chapter 33).
BrandingProduct name, logo (also the favicon), brand colour, support email, documentation URL (a "Help and docs" link in the admin) and support URL (on the website).
StorageWhere files are kept, the room per person and Test storage (chapter 9).
Sign-upsOpen (anyone old enough can sign up in the app) or closed.
App linksThe App Store and Google Play addresses for the website's badges (chapter 18).
MaintenanceThe maintenance switch and its message: members see the message and can't use the app (sign-in still answers, sign-ups pause), while staff keep working. Also Remove demo data.

Legal pages

The stores ask for terms, a privacy policy and community rules before a dating app goes live, and the setup check warns while one is empty. Starter texts are in apps/backend/seed/legal/ (terms.md, privacy.md, community-rules.md, cookies.md); loading the sample city fills empty pages with them. They are a starting point, not legal advice: have them checked for your country before launch. The pages show on the website at /legal/terms, /legal/privacy, /legal/community-rules and /legal/cookies, and the app links to them.

Settings → Legal pages, written in Markdown
Settings → Legal pages, written in Markdown

26The member app, screen by screen

The tab bar has four tabs: Discover, Likes, Chats and You.

  • Discover: the card stack (swipe right to like, left to pass, or use the buttons; the star is a super like), the profile page behind each card, filters (age, distance, show me, "only people with a shared interest", and the Plus filters), boost, undo (Plus), and the states: out of people with "widen to …" the next distance, daily likes used up with the reset time, no super likes left, profile paused, offline.
  • Likes: who liked you (Plus: their faces; free: a blurred grid and the count) and who you liked.
  • Chats: new matches without a message yet, then the conversations with unread dots. A chat has gifts, the video call button and the ⋯ menu (view profile, video call, unmatch, block, report). Messages held back for a banned word, the 20-a-minute limit and "this conversation has ended" each have their own message.
  • You: your photo and profile strength, the Plus card, your balances of coins, super likes and boosts, Edit profile, Preview (as others see you), photos not approved with their reason, notifications, and Settings.
  • Settings: Discovery, Notifications (which kinds of push), Privacy (read receipts, video calls from matches, show me in Discover), Appearance (light, dark or the phone's), Blocked members (with unblock), the Safety centre, Help and contact (write to support), Legal, Account (email, password, pause profile, delete account), Restore purchases and Sign out.
A profile: photos, prompts, interests, basics
A profile: photos, prompts, interests, basics
Who liked you: blurred for free members
Who liked you: blurred for free members
New matches and conversations
New matches and conversations
The gift tray, paid in coins
The gift tray, paid in coins
You: profile, Plus and balances
You: profile, Plus and balances
Settings
Settings
The safety centre
The safety centre
Report: pick a reason; blocking is ticked
Report: pick a reason; blocking is ticked

27The website

PageAddressWhat it is
Home/Your community's home page with the App Store and Google Play badges (Settings → App links).
Safety/safetyHow members stay safe, and how to report and block.
Legal pages/legal/terms, /legal/privacy, /legal/community-rules, /legal/cookiesThe texts from Settings → Legal pages.
Delete your account/delete-accountFor people who no longer have the app (Google Play asks for this page): they type their email, get a 6-digit code (it works for 15 minutes and 5 tries), type it, and the account is deleted at once. The page answers the same whether or not the email has an account.
Support/supportA contact form (email, topic, message, 3 an hour): kept on the server and emailed to the support address in Settings → Branding (or, without one, to the email sender). The app's Help page writes to the same place.
Sign in/signinStaff sign-in for the admin. Members use the app.

Your app's screens on the website

The home and safety pages draw phones in your brand colour. To show your own app in them, put portrait screenshots of your app (about 9 by 19.5, for example 860 pixels high) in apps/frontend/public/images/app/ with these names: discover.jpg, mutual.jpg (the match moment), chat.jpg, safety.jpg (the safety centre) and report.jpg. Then rebuild the image (docker compose up -d --build). A missing file keeps the drawn phone, so you can add them one at a time.

The website's safety page
The website's safety page
Delete your account: email, code, done
Delete your account: email, code, done
The support form
The support form
Part 05

Safety and privacy

28Safety rules the server keeps

  • 18 and over, on the server. The age is worked out from the date of birth in your time zone at sign-up; under 18 (or your higher minimum) is refused and nothing is stored except a keyed hash of the email, which can't try again with another date for 30 days. Members can't change their birth date afterwards; the app tells them to contact support if it is wrong. The minimum age can't be set below 18.
  • Rough distance only. A location is rounded to two decimals (about 1 km) before it is stored. No answer ever carries another member's coordinates or area; cards say "less than 1 km away", "about 3 km away" (whole numbers up to 10) or the nearest 5 above that.
  • Blocks work both ways, everywhere. A block hides the two people from each other in Discover, both likes lists, matches, chats, profile pages (they answer "not found"), photos and calls, unmatches them and ends a live call. Suspended, banned and deleted accounts are hidden the same way. Unblocking lifts the hiding but never brings the match back.
  • Chat and calls only between matches who can still see each other.
  • Evidence snapshots. A report copies the last 20 messages and the reported member's photo ids at that moment, so an unmatch, a deleted photo or a deleted account can't erase it. Under-18 reports go to the top of the queue.
  • Banned words in chat, in any case and in look-alike spellings; the message is never delivered.
  • Photo review before others see a new photo (the default).
  • Rate limits on likes (the daily quota), messages (20 a minute), reports (5 an hour), video calls (10 an hour), photo uploads (20 an hour), sign-ups, sign-ins, password resets and the support form (chapter 30).
  • Suspended and banned members are signed out everywhere at once and refused at sign-in with the reason; their live calls end.
  • Nothing earns credit by itself. Plus, super likes, boosts and coins come only from a purchase the store confirmed, a store notification, Plus's own weekly and monthly credits, or the demo; every spend is one guarded update, so two taps at once can never spend the same coin twice or take a balance below zero.

29Personal data and deletion

You are the controller of your members' data: you decide your privacy policy and answer their requests. This chapter lists what Heartfold keeps, what deletion removes, what stays and why, and how to answer an access request.

Where personal data lives

TablePersonal data in it
usersEmail, name, password hash, date of birth, role and status, push choices, when the terms were accepted, last seen.
profilesFirst name, gender, who they want to see, bio, height, work, school, looking for, drinking, smoking, the rounded location or area, discovery settings, Plus and boost end times.
photos, uploadsProfile photos (the files in storage) and their review status.
profile_prompts, profile_interestsPrompt answers and picked interests.
swipes, like_quota, matchesLikes, passes and super likes given; likes used per day; matches.
messages, gift_sends, callsChat messages, gifts sent and call records (who, when, how long; never the video or sound).
blocks, reports, flagged_messagesWho blocked whom; reports with their evidence snapshot; messages held back for a banned word.
purchases, balances, ledgerStore purchases, the coins, super likes and boosts left, and every change to them.
sessions, push_devices, notifications, password_resetsSigned-in apps and browsers (with the device's user agent), push tokens, the in-app notifications, reset and delete codes (stored as keyed hashes).
support_messagesMessages sent through the website's support form and the app's Help page, with the sender's email.
audit_logWhat staff did, to whom and when.

What deleting an account does, at once

A member deletes their account in the app (Settings → Account → Delete account, typing DELETE), on the website's /delete-account page with an emailed code, or an admin deletes it from the member sheet. In one database transaction, the account row goes, and with it: sessions, push devices, the profile, prompts, interests, photos (rows and files in storage), likes and passes, matches with all their messages, gifts sent and received, calls, blocks, notifications, balances, the ledger and the support messages sent with their email. Their matches see "This conversation has ended", and a live call ends.

Three kinds of rows outlive the account, on purpose:

  • Purchases keep the product, the store, the store's transaction id, the price and the date, with the member's id removed: you need them for tax records and store disputes.
  • Reports keep their evidence snapshot (the member's id inside it scrubbed), so a person who harassed someone can't erase the proof by deleting their account.
  • Hashed emails: a banned member's email stays as a keyed hash, so a ban survives deletion; an under-18 refusal stays as a hash for its 30 days.

The audit log keeps staff actions with the member's id replaced by "erased". Support messages sent with the account's email go with the account. Backups you make keep old data until you delete them, so keep backups no longer than your privacy policy says.

Answering an access request (data export)

When a member asks for a copy of their data (GDPR, CCPA and similar laws), an admin opens them in Admin → Members and picks Export data in the member sheet. The browser downloads one JSON file, member-<id>-<date>.json, with everything Heartfold keeps about them: the account, profile, photos (with their addresses in the admin), prompts, interests, likes and passes, likes used per day, matches, the messages they sent, gifts sent and received, calls, the blocks they made, the reports they made and the reports about them, purchases, balances and every change to them, notifications, signed-in devices, the support messages sent with their email, and the audit lines about them. The export is written to the audit log; moderators can't make one, and the public demo refuses it.

The file leaves out what belongs to other people: other members appear only as the first names of the people in the member's own matches and chats, messages other members wrote are not in it, and reports about the member leave out who made them and what they wrote (that could identify the reporter). Check the file, add copies of their photos if they ask (the member sheet shows them; right-click to save), send it to the member over a safe channel, then delete your copy.

30Security notes

Accounts and sessions

  • Passwords (at least 10 characters) are hashed with Argon2id. A password change or reset signs the person out on every other device. Sign-in attempts are limited per account and per address (the table below).
  • On the web, the hf_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-heartfold, which other sites can't add, so they can't act for a signed-in person.
  • The app signs in with a token sent as Authorization: Bearer. It lasts 90 days, is renewed while the app is used, and is kept in the phone's secure storage (the iOS Keychain, the Android Keystore).
  • Session tokens are stored only as SHA-256 hashes; reset codes, delete codes and invitations only as hashes too. A code works for 15 minutes and 5 tries.
  • The secrets you save in the admin (SMTP, storage, the Firebase service account, the LiveKit secret, Apple's key, Google's service account and token) 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.
  • Roles are checked by the server on every request; the admin only hides what a role can't use.

Rate limits

These limits are kept in PostgreSQL, so they hold across restarts and several copies of the server. They are keyed by a keyed hash of the account or the visitor address (taken only from trusted proxies, chapter 5), never by a plain address:

LimitAllowedWhat it protects
Sign-in, per address20 per 15 minutesSign-in attempts from one address
Sign-in, per account10 per 15 minutesWrong passwords for one account; after ten 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
Staff invitations, per admin50 per hourStaff invitations sent by one admin
Chat messages and gifts, per member20 per minuteChat messages and gifts sent by one member; over it the app hears 429 slow_down
Reports, per member5 per hourReports made by one member
Video calls started, per member10 per hourVideo calls started by one member
Support messages, per address and per email3 per hourMessages from the website's support page, per address (behind a trusted proxy) and per email

Photo uploads are limited to 20 an hour per member, and free members' likes by the daily quota. 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 store notification addresses are never limited. A refused call answers 429 with a Retry-After header.

Uploads and files

  • Uploads are checked by their content, not their name (chapter 9), and count against each person's room. The logo may be PNG, WebP or SVG; an SVG with scripts is refused.
  • Profile photos are private files, served only to their owner, staff and members allowed to see them; never across a block, and waiting photos only to their owner and staff while review comes first. The logo is public.

What loads from other servers

The web app's fonts and icons are part of the build; the website loads nothing from other servers. Video calls connect the app to your LiveKit server, which sees the members' network addresses like any call service. Purchases open Apple's and Google's own payment sheets. Push notifications go through Firebase and carry the person's first name and, for a message, its first 80 characters.

Keep it safe

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

Operations

31Background jobs

Work that runs on a clock, or retries an outside service, goes through a job queue that lives in PostgreSQL, inside the same heartfold program: there is no separate worker or Redis to run. JOB_WORKERS (default 4) sets how many jobs run at once in each server copy.

JobHow oftenWhat it does
housekeepingEvery hourClears expired sessions, rate-limit windows, used reset codes, staff invitations unanswered for 30 days, and finished job rows older than 14 days.
members.hourlyEvery hourLifts suspensions whose end date has passed, gives Plus members this week's 5 super likes and this month's boost (once each, however often it runs), clears expired under-18 refusals, and on the public demo removes visitors' copies older than 24 hours.
purgeEvery dayRemoves messages held back for a banned word after 30 days and notifications a member has read after 90 days, closes any LiveKit room still open for a call that is over, and purges accounts left marked as deleted for 30 days (a safety net: normal deletions erase an account at once, chapter 29).
purchases.google_ackWhen neededAcknowledges or consumes a Google purchase again when Google couldn't be reached at the time, with a growing wait.
demo.reset03:00 UTC, demo onlyRemoves and reloads the sample city on a public demo.
sim.*Demo onlyThe sample members' likes back, typing and replies on a public demo.

Beside the queue, a loop every two seconds turns calls that rang 30 seconds unanswered into missed calls, and closes answered calls left open for 6 hours. Emails and push messages are sent straight away, not queued.

How to see that they run

  • Admin → Setup check: the Background jobs row is green when nothing failed in the last 24 hours and nothing waits over 10 minutes. See jobs lists the jobs by status and kind, each failed one with the reason and a Retry button.
  • A failed job is retried by itself: after 10 seconds, then twice as long each time, up to an hour, five tries in all. A job that runs longer than 5 minutes is stopped and retried; one whose worker stopped (a restart) goes back in the queue after 10 minutes.
  • docker compose logs app | grep -i job shows failures with their reason.

32Several servers

One server copy handles a large community. If you run several copies of the app behind a load balancer (for uptime or load), these are the rules:

  • No duplicate jobs. Each job is taken by one worker with FOR UPDATE SKIP LOCKED, so two copies never run the same job. The hourly and daily jobs carry a key for their hour or day that can be used once, so they run once per period however many copies are running. The demo's reset holds a database lock while it runs.
  • Live updates reach everyone. Changes go out through PostgreSQL's NOTIFY, and every copy forwards them to the screens connected to it, so a message sent through one copy reaches a phone connected to another. Saved settings reload in every copy the same way.
  • Shared storage. Use an S3 bucket (MinIO, AWS S3, R2…), not STORAGE_DRIVER=local: a local folder exists on one copy only. The setup check warns about it.
  • Database connections. Each copy opens up to 20 connections plus one that listens for live updates. Size PostgreSQL's max_connections for your copies, and connect directly or through a pooler in session mode: a transaction pooler (PgBouncer in transaction mode) breaks the live updates' LISTEN.
  • Proxy headers. Set TRUSTED_PROXY_HOPS to the number of proxies that add an address (the load balancer counts as one, chapter 5). The load balancer must pass WebSockets.
  • Rate limits. The sign-in, sign-up, reset, message, report and call limits live in PostgreSQL and hold across copies. The short-term allowances in memory are per copy.
  • One APP_SECRET and the same .env for every copy.
  • Deploys without downtime: DRAIN_SECS makes a stopping copy report itself unhealthy for a few seconds so the load balancer moves visitors before it exits.

33Demo mode and the sample city

Bellmare, the sample city

Bellmare is a made-up seaside city with six neighbourhoods, 67 sample members with complete profiles, matches, chats with gifts, calls, likes, reports with evidence, photos waiting for review, messages held back, purchases, prompts, interests, gifts, products and banned words, so you can try every screen before your first member signs up. Load it with:

docker compose exec app heartfold seed-demo --confirm

It answers seeded: {…} with what it added. Every row it adds is marked as demo data. --confirm is needed once your install has a real account (the owner the wizard made). Running it again changes nothing. It also fills empty legal pages with the starter texts.

On a live community

The sample accounts have passwords nobody knows, so nobody can sign in as them outside demo mode. Load the sample city on a test copy to explore, or remove it before you open to the public: Admin → Settings → Maintenance → Remove demo data deletes only rows marked as demo data and their files. It can't be undone.

Photos: the download comes without the sample members' photos, so they show a plain placeholder. To show pictures, put your own JPEG files in a folder named after the photo names in apps/backend/seed/bellmare.json and point DEMO_PHOTOS at it before loading the sample city.

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

  • The sample city is loaded at start and removed and loaded again every night at 03:00 UTC.
  • The sign-in pages show one-click sign-ins: on the web the admin and the moderator (look only: every change answers "read only" and member emails are masked); in the app Nora (free) and Theo (Plus), each a fresh private copy for that visitor, removed after 24 hours. One address can use them 60 times an hour.
  • Sample members like a visitor's copy back now and then, type and reply after a few seconds, and sometimes answer with a gift.
  • Purchases finish as demo purchases (no store, no money), no push messages are sent, the install wizard is off, and secrets show only as set or not set.

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

Seed commands

CommandWhat it does
docker compose exec app heartfold seed-demoAdds the sample city, every row marked as demo data. It refuses a database with any real account; --confirm adds it next to real data anyway.
docker compose exec app heartfold reset-demoRemoves the demo data and adds it again. It refuses to run when the database holds any real account, with no way round it.
Admin → Settings → Maintenance → Remove demo dataDeletes only rows marked as demo data.
docker compose exec app heartfold migrateApplies the database migrations and stops (the server also does this on every start).
The demo's admin sign-in with its one-click staff
The demo's admin sign-in with its one-click staff
The app's demo members, shown only by a demo server
The app's demo members, shown only by a demo server
Delete account in the app: type DELETE
Delete account in the app: type DELETE

34Updating 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 Heartfold folder. It reads the database user and name from the postgres container, so it works whatever you set as POSTGRES_USER and POSTGRES_DB; -T keeps a terminal out of the dump.

Also keep a copy of .env (above all APP_SECRET, without which the saved keys can't be read), of your files (the minio-data Docker volume, your own bucket or the app-storage volume), and of the app's signing key and .env. Restore a database backup into an empty database with docker compose exec -T postgres sh -c 'psql -U "$POSTGRES_USER" "$POSTGRES_DB"' < backup.sql. Backups hold personal data: keep them private and only as long as your privacy policy says.

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 heartfold/ (not inside it), run unzip -o heartfold-x.y.z.zip with the new version's file name. The zip has a top-level heartfold/ folder, so it unpacks over your install and replaces every shipped file, also ones you changed: keep your changes in Git (chapter 37) so you can see and re-apply them. Your .env, compose.override.yaml, prebuilt/ and the app's .env 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 heartfold
    for k in $(grep -oE '^#? ?[A-Z][A-Z0-9_]*=' .env.example | tr -d '# ='); do grep -q "^$k=" .env || echo "$k"; done
  4. Run docker compose up -d --build (with --profile https on your server). The new version applies any new migrations when it starts; your data stays.
  5. If disk is tight, run docker builder prune afterwards to free the build cache.

Update the app

Copy your changes (name, id, icon, theme) onto the new heartfold_mobile_flutter/, or compare with Git, then raise the build number in pubspec.yaml, build and upload as in chapter 17. Update the server first: a new app may need the new server, while older apps keep working with it.

Part 07

For developers

35Every 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 app's keys are in chapter 14.

KeyRequiredWhat it does
Required
APP_URLYesThe public address of the website and API, without a trailing slash, for example https://app.example.com. Links in emails, the app's server 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 heartfold.
POSTGRES_USERNoThe database user the stack creates. Default heartfold.
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 at every start until the install is finished (docker compose logs app | grep -i "install token").
File storage (members' photos, the 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 heartfold; 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).
Calls (LiveKit; empty = calls off)
LIVEKIT_URLFor callsThe LiveKit address the app connects to for video and voice calls: wss://your-project.livekit.cloud (LiveKit Cloud) or wss://calls.example.com (your own server from docker/livekit). Empty: calls are off and the app hides the call button. Admin → Settings → Calls takes precedence.
LIVEKIT_API_KEYFor callsThe LiveKit API key; the server signs each call's short token with it and the secret.
LIVEKIT_API_SECRETFor callsThe LiveKit API secret (on your own server at least 32 characters: openssl rand -hex 32). It never leaves this server; in Admin → Settings → Calls it is stored encrypted. LiveKit Cloud has its own pricing (a free plan for testing, then monthly plans by usage); your own LiveKit server is free software and costs only its server and traffic.
LIVEKIT_API_URLNoOnly when this server reaches LiveKit's room API at another address. Empty: LIVEKIT_URL over https.
LIVEKIT_DOMAINWith docker/livekitOnly for your own LiveKit server (docker/livekit): the domain it gets an HTTPS certificate for, for example calls.example.com.
Push messages (Firebase Cloud Messaging; empty = push off)
FCM_PROJECT_IDFor pushYour Firebase project id (Firebase console → Project settings → General), with FCM_SERVICE_ACCOUNT_JSON. Empty: no push messages; the app still shows new likes, matches and messages while it is open. Firebase is a Google service with its own pricing; Cloud Messaging itself has no charge per message.
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 → 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 Heartfold <hello@example.com>. Use an address on a domain your provider has verified.
In-app purchases (Apple and Google; empty = purchases off)
APPLE_ISSUER_IDFor iPhone purchasesThe issuer id of your In-App Purchase key (App Store Connect → Users and Access → Integrations → In-App Purchase). Without the key, iPhone purchases are checked by Apple's signature only. Apple keeps its commission of every sale (usually 15–30%).
APPLE_KEY_IDFor iPhone purchasesThe id of that In-App Purchase key.
APPLE_PRIVATE_KEYFor iPhone purchasesThe In-App Purchase key file (.p8) as one line, with \n for the line breaks. With it the server confirms every iPhone purchase with Apple before it unlocks anything.
APPLE_BUNDLE_IDFor iPhone purchasesThe app's bundle id, for example com.example.heartfold.
APPLE_ENVIRONMENTNoWhich Apple purchases to accept: both (default; App Review buys in the sandbox), production or sandbox.
APPLE_APP_IDNoThe app's numeric Apple ID (App Store Connect → the app → App Information), digits only. Optional: when set, an Apple store notification naming another app's Apple ID is refused (the sandbox leaves the Apple ID out, so the bundle id still decides there).
GOOGLE_PLAY_PACKAGE_NAMEFor Android purchasesThe app's package name in Google Play. Empty: purchases on Android are off. Google keeps its commission of every sale (usually 15–30%).
GOOGLE_PLAY_SERVICE_ACCOUNT_JSONFor Android purchasesA Google Cloud service account with access to the Play Developer API (Play Console → Users and permissions), as one line of JSON. The server checks and acknowledges every purchase with it.
GOOGLE_PLAY_RTDN_TOKENFor Android refunds and renewalsA long random word of your own (openssl rand -hex 24) in the push address of the Pub/Sub subscription for Google Play's real-time developer notifications: https://YOUR-DOMAIN/api/v1/webhooks/google?token=…. Empty: refunds and renewals from Google don't arrive (purchases still work).
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 app.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 Heartfold folder.
SEARCH_INDEXINGNoon (the default): search engines may index the public pages (home, legal, sign-in), never the app or the API. off, for a staging copy: /robots.txt closes every page and every answer carries X-Robots-Tag: noindex, nofollow.
JOB_WORKERSNoBackground job workers in this server, 1 to 32. Default 4.
DRAIN_SECSNoFor zero-downtime deploys: seconds a stopping server reports itself unhealthy, so a proxy moves visitors to the new copy, before it exits. Default 0.
DEMO_MODENoOnly for a public demo: "true" adds the sample members and one-click sign-ins (the staff read only), makes sign-ups demo accounts and resets the data every night. Keep "false" on a live site.
DEMO_PURCHASESNo"true" lets purchases finish without Apple or Google (labelled "Demo purchase", no money taken). Only for a private test copy; keep "false" on a live site.
DEMO_SEEDNoThe folder of the demo's sample texts (legal/<slug>.md and the sample city bellmare.json inside). The Docker image already points at its own copy (/app/seed); set it only to load your own texts with heartfold seed-demo --confirm.
DEMO_PHOTOSNoThe folder of the sample members' photos the demo seed reads (default demo/photos/members). A missing file becomes a plain placeholder.
DEMO_CALLBOT_URLNoDemo only (DEMO_MODE="true"): the address of the demo's call partner, which answers a visitor's call to a sample member with a short video clip. Leave it empty outside the live demo; without it those calls ring out as missed.
CALLBOT_TOKENNoDemo only: the shared secret the server sends to the demo's call partner. Leave it empty outside the live demo.
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/heartfold, 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.
WEB_DISTSet by DockerWhere the built web app is, when it is not packed into the program.

36File structure

Server and web app

heartfold/
├── apps/
│   ├── backend/                 the Rust server (Axum): crate heartfold-server, program "heartfold"
│   │   ├── src/main.rs          the commands: serve, migrate, health, seed-demo, reset-demo, pack
│   │   ├── src/lib.rs           the HTTP app: /api/health, /api/v1, the web app, middleware
│   │   ├── src/api/             one file per area: public, auth, me, profile, catalog, discover, matches,
│   │   │                        chat, calls, safety, store, media, events, webhooks, admin*
│   │   ├── src/profiles.rs      profiles, setup steps, rough distance, deleting an account
│   │   ├── src/discovery.rs     who shows in Discover, in what order
│   │   ├── src/matching.rs      likes, the daily quota, super likes, matches, undo, unmatch
│   │   ├── src/chat.rs          messages, banned words, read receipts, typing, gifts
│   │   ├── src/calls.rs         calls; calls_livekit.rs signs LiveKit tokens and closes rooms
│   │   ├── src/safety.rs        blocks, reports and their evidence, the support form
│   │   ├── src/photos.rs        photos and their review
│   │   ├── src/purchases.rs     purchases; purchases_verify.rs asks Apple and Google and applies their
│   │   │                        notifications; purchases_apple.rs checks Apple's signatures
│   │   ├── src/store.rs         balances, the ledger, Plus and boosts
│   │   ├── src/catalog.rs       prompts, interests, areas, gifts and products
│   │   ├── src/push.rs          push (Firebase Cloud Messaging) and the in-app list; notify_dating.rs what
│   │   │                        members are told; realtime.rs live updates; email.rs SMTP
│   │   ├── src/uploads.rs       uploads checked by content; storage.rs S3 or a local folder
│   │   ├── src/rate_limit.rs    the request limits; auth.rs sessions and roles; crypto.rs secrets at rest
│   │   ├── src/config.rs        the .env keys; settings.rs admin settings over them; setup_check.rs
│   │   ├── src/jobs.rs          the job queue; ops.rs the two-second loop; purge.rs
│   │   ├── src/demo.rs          the demo; demo_dating.rs the sample city; social_sim.rs the simulated members
│   │   ├── seed/                bellmare.json (the sample city) and legal/ (starter legal texts)
│   │   ├── tests/api/           API tests against a real PostgreSQL (chapter 37)
│   │   └── README.md            every module of the server, for developers
│   └── frontend/                the web app (React Router 7, Vite, Tailwind CSS 4)
│       ├── src/routes.ts        every page: URL → file (lists in src/routes/)
│       ├── src/pages/           admin/, public/, auth/, install/
│       ├── src/ui/, src/components/   shared parts and shadcn/ui components
│       ├── src/layout/          the app shell, sidebar and sign-in guards
│       ├── src/api/             the API client and types
│       ├── src/styles.css       colours, fonts and sizes (design tokens)
│       ├── e2e/                 browser tests (Playwright)
│       └── README.md            the web app's stack, scripts, folders and build
├── heartfold_mobile_flutter/    the member app (chapter 15)
├── migrations/                  the database schema (applied on start)
├── docker/                      Dockerfile, docker-compose.yml, Caddyfile, livekit/
├── compose.yaml                 "docker compose up" from this folder
├── tools/rename.mjs             renames and rebrands the app and the web defaults (chapter 16)
├── Cargo.toml, Cargo.lock       the Rust workspace
├── .env.example                 every server setting
└── docs/                        this guide (HTML and PDF) and the third-party licences

37Run the tests

Run it for development

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

Tests

PartCommandWhat it covers
Server, unitcargo test -p heartfold-server --libRough distances, the likes window, backoff, Apple's certificate chain, and the other rules that need no database.
Server, APITEST_DATABASE_URL=postgres://user:password@127.0.0.1:5432/postgres cargo test -p heartfold-serverThe whole app in process against a real PostgreSQL: sign-up and 18+, Discover, likes and matches, races that must let exactly one through, chat and banned words, calls, blocks and reports, purchases with a stand-in Apple and Google (no network), store notifications, refunds, deletion (no row names the member afterwards and the photo files are gone), moderation, staff roles and the demo. The login needs the right to create databases: each test makes its own fresh one. Without TEST_DATABASE_URL the API tests say so and pass.
Server lintscargo clippy --workspace --all-targets -- -D warningsKept clean; cargo deny check checks advisories and licences.
Web apppnpm testUnit tests (Vitest), run in apps/frontend. Also pnpm typecheck, pnpm lint (Biome) and pnpm e2e (Playwright browser tests; pnpm exec playwright install chromium once first).
Member appflutter testUnit, widget and flow tests on a fake server, in light and dark, run in heartfold_mobile_flutter. flutter analyze checks the code. LIVE_API=http://127.0.0.1:8080 flutter test test/live runs every repository call against a running server in demo mode with DEMO_PURCHASES="true" (a private test copy only).

Keep your copy in a Git repository, so you can compare it with each new Heartfold version and see what you changed.

38Extend it: a new API route with a test

As an example, add GET /api/v1/catalog/gift-count, which tells the app how many gifts are on sale. The same four steps add any route.

  1. The route. Each area of the API is one file in apps/backend/src/api/; its routes() function lists the addresses. Open apps/backend/src/api/catalog.rs and add a line to routes():
            .route("/catalog/gift-count", get(gift_count))
  2. The handler, in the same file. The /// comment is what the docs' API reference shows for it:
    /// `GET /api/v1/catalog/gift-count`: how many gifts members can send now (`{ count }`).
    async fn gift_count(State(state): State<AppState>) -> ApiResult<Json<Value>> {
        let count: i64 = sqlx::query_scalar("select count(*) from gifts where active")
            .fetch_one(&state.db)
            .await?;
        Ok(Json(serde_json::json!({ "count": count })))
    }
    A database error becomes a clean 500 through ?; to refuse a request, return one of the ApiError helpers in src/error.rs (each has a status, a stable code and a message the screens show as it is). A route that needs a signed-in member takes ctx: UserCtx; staff routes take Staff, Admin or Owner (see src/auth.rs), and the server refuses everyone else before your code runs.
  3. The test, in apps/backend/tests/api/catalog.rs. Each test gets the whole app with a fresh database holding the starter catalogue (six gifts):
    /// The app reads how many gifts are on sale.
    #[tokio::test]
    async fn the_app_reads_the_gift_count() {
        let Some(t) = app().await else { return };
        let mut c = t.client();
        let r = c.get("/catalog/gift-count").await;
        assert_eq!(r.status, StatusCode::OK, "{}", r.json);
        assert_eq!(r.json["count"], 6);
        t.finish().await;
    }
  4. Run it:
    TEST_DATABASE_URL=postgres://user:password@127.0.0.1:5432/postgres cargo test -p heartfold-server --test api catalog
    cargo clippy --workspace --all-targets -- -D warnings
    Run them in the Heartfold folder. The test run ends with test catalog::the_app_reads_the_gift_count ... ok. Then rebuild with docker compose up -d --build.

Other changes: 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); a web page goes in apps/frontend/src/pages/ with its address in src/routes/; an app call goes in the matching repository in lib/data/, with its model in lib/domain/models/ and a fake answer in test/support/fake_backend.dart so the app's tests cover it.

39API reference

The web admin, the website, the member app and your own integrations use the same /api/v1 API. These 145 addresses are generated from the server code when the release is built.

  • JSON in and out with camelCase keys; times in ISO 8601 UTC; money in whole cents (…Cents); coins, super likes and boosts as whole numbers; ids are UUIDs, and reports also have a number such as R-1042. Lists page by cursor and answer { items, nextCursor }.
  • Errors: {"error": {"code": "…", "message": "…", "details": {…}}} with the HTTP status, for example under_age (403), likes_used_up (429), no_super_likes, not_enough_coins (402), not_matched, calls_off, plus_required (403), banned_word (422), slow_down (429), busy (409), calls_not_configured (503), account_suspended, account_banned and demo_read_only (403). The message is written to be shown to people as it is.
  • The web admin signs in with the hf_session cookie and sends x-heartfold: 1 on every change. The app gets a token from /auth/register or /auth/login and sends Authorization: Bearer <token>.
  • Live updates: GET /api/v1/events is a WebSocket for the app (the token in Sec-WebSocket-Protocol or ?token=) and a Server-Sent Events stream for the admin: message, read, typing, match, like, gift, call, notification and account.
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
Files and live updates
GET/api/v1/eventsSigned in (cookie, Bearer token, ?token= or the WebSocket protocol)Live updates for the signed-in person: a WebSocket when the request upgrades, else Server-Sent Events; ready first, a ping every 25 seconds, notification, refetch when a screen fell behind, and account when the session was ended
POST/api/v1/mediaSigned inUploads a file of the signed-in person's own (multipart file; typed and measured by content, size limits per kind, the person's storage limit)
GET/api/v1/media/{id}Signed inA file, to the person it belongs to or to staff (public files to anyone signed in)
DELETE/api/v1/media/{id}Signed inRemoves one of the person's own files (its row first, then the file)
GET/api/v1/public/files/{id}AnyoneA public file (the brand logo, …), without sign-in; cached for a year (a new file gets a new id)
Public pages and install
GET/api/v1/public/configAnyoneWhat the website and the app need before sign-in: the brand, the sign-up mode and minimum age, the legal pages and links, the app store links, whether the install is done, and the app's settings (city, purchases mode, calls, photo review, first-look hours for reports and support messages, limits, distance unit, support email, welcome photos; on the demo the one-click member cards)
GET/api/v1/configAnyoneThe same answer as /public/config, at the address the app asks
GET/api/v1/public/legal/{slug}AnyoneOne legal page (Markdown) with when it was last saved; 404 while it has no text
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's account and the brand (runs once)
GET/api/v1/public/demo/{who}/photoAnyoneOn the public demo only, the main photo of the nora or theo sign-in card (404 elsewhere)
POST/api/v1/public/delete-account/startAnyone{email}; emails a 6-digit code (15 minutes, 5 tries) when a member account has that email
POST/api/v1/public/delete-account/confirmAnyone{email, code}; deletes the member's account at once with every personal row and photo (400 wrong_code {triesLeft} or code_expired otherwise)
POST/api/v1/public/supportAnyoneThe website's support form: kept and emailed to the support address; 3 an hour; the same answer whether or not the email has an account
Sign-in and account
POST/api/v1/auth/registerAnyoneCreates a member account from the app with the date of birth (18 or older in the server's time zone; a refusal is remembered 30 days) and acceptTerms: true while sign-ups are open, and answers the session token; banned emails are refused; staff join by invitation only
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 and what they may do
GET/api/v1/auth/sessionAnyoneThe signed-in person like /auth/me, or { me: null } when signed out (always 200)
POST/api/v1/auth/forgotAnyoneEmails a 6-digit code (15 minutes, 5 tries; the app) and a link (one hour; the web admin) when the email belongs to an account; 3 emails an hour per account
POST/api/v1/auth/resetAnyoneSets a new password and signs in, with the emailed code ({email, code, password}, the app: 400 wrong_code {triesLeft} or code_expired) or the emailed link ({token, password}, the web admin)
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 (role, email, who sent it)
POST/api/v1/auth/invites/acceptAnyoneAccepts a staff invitation (once), signing in or creating the account; the account gets the invited role (an owner keeps theirs)
PATCH/api/v1/auth/profileSigned inChanges the person's name or picture
POST/api/v1/auth/passwordSigned inChanges the password (the current one is asked for); other sessions end
POST/api/v1/auth/demoAnyone, public demo onlyOne-click demo sign-in (public demo only): admin or moderator on the web (read-only), or nora or theo in the app as a fresh private copy of that member for 24 hours; "client": "app" answers a session token
POST/api/v1/me/devicesSigned inSaves this device's push token (token, platform: android, ios or web), one per session
DELETE/api/v1/me/devicesSigned inStops push messages to this device (the person turned them off)
GET/api/v1/meSigned inThe signed-in person: account (email, status, date of birth, push choices), and for a member the dating profile, photos with their review status, prompts, interests, balances, Plus, today's likes, open matches and the next setupStep
PATCH/api/v1/meSigned inChanges any of name, avatarUrl and notifications (booleans per kind, merged into the saved ones); answers /me
DELETE/api/v1/meSigned inDeletes the person's own account at once: { password } (from the app, { confirm: "DELETE" }), with an optional leaving reason; every personal row and photo file goes in one go (the owner's account can't be deleted)
GET/api/v1/notificationsSigned inThe person's in-app notifications, newest first, 30 a page (nextCursor is the cursor of the next page), with how many are unread
POST/api/v1/notifications/readSigned inMarks the given notifications read (ids; all of them without it); answers the unread count left
POST/api/v1/notifications/read-allSigned inMarks every notification of the person read; answers the unread count (0)
PATCH/api/v1/me/profileSigned inChanges the sent profile fields (firstName, gender, showMe, bio, heightCm, work, school, lookingFor, drinking, smoking; the first call makes the profile and needs firstName); the birth date can't change (403 birth_date_locked)
PUT/api/v1/me/promptsSigned in[{promptId, answer}], exactly three different prompts (answers up to 150 characters)
PUT/api/v1/me/interestsSigned in[ids], up to 8 (422 too_many_interests)
PUT/api/v1/me/locationSigned in{lat, lng} (rounded to about 1 km before it is kept) or {areaId}
PATCH/api/v1/me/settingsSigned inAge range, distance, show me, read receipts, calls from matches, the share-an-interest filter and push choices
POST/api/v1/me/pauseSigned inHides the profile from Discover (matches and chats go on)
POST/api/v1/me/resumeSigned inShows the profile in Discover again
POST/api/v1/me/photosSigned inAdds a photo (multipart file: JPEG, PNG, WebP or HEIC by content, up to 10 MB; at most 6 photos, 409 too_many_photos; 20 uploads an hour)
PUT/api/v1/me/photos/orderSigned in[ids], every photo of the member once, in the new order
DELETE/api/v1/me/photos/{id}Signed inRemoves one of the member's photos and its file; a complete profile keeps at least one (409 last_photo)
GET/api/v1/me/purchasesSigned inThe member's purchases, newest first, with their status (verified, refunded, revoked, expired)
GET/api/v1/me/ledgerSigned inWhat came in and went out of one balance, newest first, 30 a page ({ items: [{asset, delta, reason, note, createdAt}], nextCursor }; a gift's note names the gift and who it went to, "Rose to Theo")
GET/api/v1/me/blocksSigned inThe members I blocked, newest first, 30 a page: {userId, firstName, blockedAt, context, reported, deleted} (deleted: their account is gone)
Member photos
GET/api/v1/photos/{id}Signed inA member photo, to its owner, staff, or a member allowed to see it (approved, or waiting when review comes after; never across a block)
Catalogue, store and purchases
GET/api/v1/catalog/promptsAnyoneThe profile prompts to pick from ({ items: [{id, text}] })
GET/api/v1/catalog/interestsAnyoneThe interests with their picker heading ({ items: [{id, label, group}] })
GET/api/v1/catalog/areasAnyoneThe areas a member may pick instead of sharing their location ({ items: [{id, name, description}] }; never coordinates)
GET/api/v1/catalog/giftsAnyoneThe gifts and their price in coins ({ items: [{id, name, icon, coins}] })
GET/api/v1/store/productsAnyonePlus plans and packs with their App Store and Google Play ids and the sample price (priceCents, currency; the store's own price wins in the app)
POST/api/v1/purchases/appleSigned in{signedTransaction} from StoreKit 2, verified (Apple's certificate chain and signature, bundle id, environment, and Apple's API when its key is set) and granted once
POST/api/v1/purchases/googleSigned in{productId, purchaseToken}, verified with the Play Developer API, granted once, then acknowledged (Plus) or consumed (packs)
POST/api/v1/purchases/demoSigned in{productId, idempotencyKey} grants a product with no store, only with DEMO_PURCHASES="true" or on the public demo (else 403 demo_purchases_disabled)
POST/api/v1/purchases/restoreSigned in{platform: "apple", signedTransactions} or {platform: "google", purchases: [{productId, purchaseToken}]}; each verified and recorded for this member (others' purchases are skipped)
POST/api/v1/boostsSigned inSpends one boost and puts the member first in Discover for the boost length (Settings, 30 minutes); 402 no_boosts, 409 boost_running
POST/api/v1/webhooks/appleAnyoneApp Store Server Notifications v2 ({signedPayload}, Apple's certificate chain checked): renewals, expiries, refunds and revocations, each applied once
POST/api/v1/webhooks/googleAnyoneGoogle Play real-time developer notifications through a Pub/Sub push subscription (the shared token from Settings → Store keys); the purchase is fetched again and applied once
Chat and calls
GET/api/v1/matches/{id}/messagesSigned inA page of the chat, oldest first (nextCursor = the page before it); 403 not_matched unless the match is open between two members who can see each other
POST/api/v1/matches/{id}/messagesSigned inSends a message of 1–1000 characters (422 banned_word {word}, 429 slow_down {retryAfter} over 20 a minute; the same clientId answers the message already sent)
POST/api/v1/matches/{id}/readSigned inMarks the other person's messages read (they see it only while I share read receipts)
POST/api/v1/matches/{id}/typingSigned inTells the other person's screens I am typing
POST/api/v1/matches/{id}/giftsSigned inSends a gift paid in coins (402 not_enough_coins {needed, balance}) as a gift message; answers the message and the coins left
POST/api/v1/matches/{id}/callsSigned inCalls my match: {call, livekit: {url, token}} (room call-<id>, 2-hour token); 409 busy while either of us is on a call, 403 calls_off, 503 calls_not_configured, 403 not_matched
GET/api/v1/calls/{id}Signed inA call I am part of
POST/api/v1/calls/{id}/answerSigned inThe person called answers a ringing call: {call, livekit: {url, token}} (409 call_over once it stopped ringing)
POST/api/v1/calls/{id}/declineSigned inThe person called declines a ringing call
POST/api/v1/calls/{id}/endSigned inHangs up (either side); the chat gets a call line with its length and the room closes
Discover, likes and matches
GET/api/v1/discoverSigned inThe next cards to swipe (boosted members first, people who liked me mixed in one card in four, then more interests in common first, then recent activity and distance), with total (people matching my filters) and widen (the next distance step and how many it adds); 409 profile_incomplete until the profile is complete
GET/api/v1/profiles/{id}Signed inAnother member's profile, only when they are in my Discover set, we are matched, or they liked me and I have Plus; otherwise (and always when either blocked the other) 404
POST/api/v1/swipesSigned inLike, pass or super like: free members have a daily likes quota (429 likes_used_up {resetsAt}), a super like spends a credit (402 no_super_likes), a mutual like makes the match
POST/api/v1/swipes/undoSigned inTakes back my last swipe of the last 10 minutes that made no match (Plus only, else 403 plus_required; 409 nothing_to_undo); a super like's credit comes back
GET/api/v1/likes/receivedSigned inThe people who liked me and wait for my answer: Plus sees them ({count, newCount, items[{member, isNew, kind}]}), a free member gets the count and blurred pictures ({count, newCount, blurred[]})
GET/api/v1/likes/sentSigned inThe people I liked who haven't matched me, newest first, 30 a page
GET/api/v1/likes/blurred/{n}Signed inOne of the soft, blurred-looking pictures a free member's likes grid shows (made on the server; never anyone's photo)
GET/api/v1/matchesSigned innewMatches (no message yet), conversations ({id, member, lastMessage{body, kind, mine, createdAt}, unread}, latest first, 30 a page) and likesCount; unmatched and blocked people never show
DELETE/api/v1/matches/{id}Signed inUnmatches (either person): the chat and calls close for both, a live call ends, and the match leaves both lists
Blocks and reports
POST/api/v1/blocksSigned inBlocks a member: both are hidden from each other everywhere, an open match is unmatched and a live call between them ends
DELETE/api/v1/blocks/{id}Signed inLifts my block (the match never comes back); 404 when there is none
POST/api/v1/reportsSigned inReports a member: the last 20 messages and their photos are copied as evidence, the member is blocked unless alsoBlock is false; 5 reports an hour
Admin
GET/api/v1/admin/overviewStaff (moderator, admin or owner)The dashboard: members (all, active, new this week, suspended, banned; never the demo's per-visitor copies), staff, sign-ups per month, what needs attention and the dating side (dating: matches and messages today, photos waiting, open reports, Plus members, store sales this month without demo purchases, members by area, 12 weeks)
GET/api/v1/admin/countsStaff (moderator, admin or owner)The badges in the admin's menu (open staff invitations, photos waiting for review, open reports, messages refused for banned words in the last 24 hours)
GET/api/v1/admin/usersStaff (moderator, admin or owner)Everyone who signs in (search by name or email, role: member / staff / a role, status: active / suspended / banned), with counts
PATCH/api/v1/admin/users/{id}Staff (moderator, admin or owner)Suspends, bans or restores a member (status with a reason), or renames them
GET/api/v1/admin/settingsAdmin or owner (the demo's staff read)Every settings section (secrets masked), the server facts and storage stats
POST/api/v1/admin/settings/branding/logoAdmin or ownerThe brand logo (a square PNG, SVG or WebP up to 1 MB, checked by content), kept as a public upload and shown as the logo and favicon; the old logo's file goes
PUT/api/v1/admin/settings/{section}Admin or ownerSaves one settings section (secrets are sealed; an empty secret keeps .env)
GET/api/v1/admin/legalAdmin or owner (the demo's staff read)Every legal page with its text (empty pages are hidden from the site and the app)
PUT/api/v1/admin/legal/{slug}Admin or ownerSaves one legal page's text (Markdown, up to 100,000 characters) and, when sent, its title
GET/api/v1/admin/emailsAdmin or owner (the demo's staff read)The emails the server sends, with their built-in and saved wording, for the email editor
GET/api/v1/admin/setup-checkAdmin or owner (the demo's staff read)The setup check rows
POST/api/v1/admin/setup-check/{id}/testAdmin or ownerTests one setup check row against the real service
GET/api/v1/admin/jobsAdmin or owner (the demo's staff read)Background jobs (status and kind filters) with counts per status
POST/api/v1/admin/jobs/{id}/retryAdmin or ownerQueues a failed job again
POST/api/v1/admin/demo-data/removeAdmin or ownerRemoves the demo data (demo-marked rows only)
GET/api/v1/admin/staffAdmin or owner (the demo's staff read)The staff, highest role first, and the open invitations
POST/api/v1/admin/staff/invitesAdmin or ownerInvites someone by email as a moderator or an admin; the email carries a link that works once, for 7 days
DELETE/api/v1/admin/staff/invites/{id}Admin or ownerCancels an invitation that has not been accepted yet
PATCH/api/v1/admin/staff/{id}Admin or ownerChanges a staff member's role (moderator or admin)
DELETE/api/v1/admin/staff/{id}Admin or ownerTakes someone off the staff: their account stays (as a member's) and their admin sessions end at once
GET/api/v1/admin/promptsAdmin or owner (the demo's staff read)Every profile prompt with how many members answer it
POST/api/v1/admin/promptsAdmin or ownerAdds a prompt (text 3–80 characters, sort, active)
PATCH/api/v1/admin/prompts/{id}Admin or ownerChanges a prompt's text, order or whether members can pick it
GET/api/v1/admin/interestsAdmin or owner (the demo's staff read)Every interest with its heading and how many members picked it
POST/api/v1/admin/interestsAdmin or ownerAdds an interest (label 2–30 characters, group, sort, active)
PATCH/api/v1/admin/interests/{id}Admin or ownerChanges an interest's label, heading, order or whether members can pick it
GET/api/v1/admin/areasAdmin or owner (the demo's staff read)Every area with its centre and how many members picked it
POST/api/v1/admin/areasAdmin or ownerAdds an area (name, description, centre lat/lng, sort, active)
PATCH/api/v1/admin/areas/{id}Admin or ownerChanges an area's name, description, centre, order or whether it is offered
GET/api/v1/admin/membersStaff (moderator, admin or owner)Members, newest first, 30 a page (cursor), searched by name or email (q) and filtered by status (active, suspended, banned), gender and plus (true/false)
GET/api/v1/admin/members/{id}Staff (moderator, admin or owner)The member sheet: account, profile, photos (every status), prompts, interests, balances, counts, reports about and by them, the staff's actions, and for admins their purchases and latest balance changes
DELETE/api/v1/admin/members/{id}Admin or ownerDeletes the member at once, as their own deletion does (every personal row and photo file; their matches see the conversation ended)
POST/api/v1/admin/members/{id}/warnStaff (moderator, admin or owner)Sends the member a warning in the staff's words (an in-app notification and a push)
POST/api/v1/admin/members/{id}/suspendStaff (moderator, admin or owner){days, reason}: suspends the member for 1 to 30 days: signed out everywhere at once, refused at sign-in (403 account_suspended {until, reason}) until the end date
POST/api/v1/admin/members/{id}/unsuspendStaff (moderator, admin or owner)Ends a suspension early (409 not_suspended when the member is not suspended)
POST/api/v1/admin/members/{id}/banAdmin or owner{reason}: closes the account for good: signed out everywhere, refused at sign-in (403 account_banned {reason}), and the email can't sign up again
GET/api/v1/admin/members/{id}/exportAdmin or owner (the demo's staff read)Answers an access request: everything kept about the member as a JSON file download (account, profile, photos, prompts, interests, likes and passes, matches, messages they sent, gifts, calls, blocks, reports they made and reports about them without the reporter, purchases, balances and their history, notifications, signed-in devices, support messages, audit lines); other members appear only as the first names in the member's own chats. Written to the audit log; refused on the public demo
GET/api/v1/admin/photosStaff (moderator, admin or owner)The photo review queue (status pending or approved), oldest first, 30 a page ({ items: [{photo, member}], nextCursor })
DELETE/api/v1/admin/photos/{id}Staff (moderator, admin or owner){reason}: removes a shown photo; the member is told why
POST/api/v1/admin/photos/{id}/approveStaff (moderator, admin or owner)Approves a waiting photo: other members can see it
POST/api/v1/admin/photos/{id}/rejectStaff (moderator, admin or owner){reason}: the waiting photo leaves the profile and the member is told why
GET/api/v1/admin/productsAdmin or owner (the demo's staff read)Every store product (Plus plans and packs) with its App Store and Google Play ids, sample price and how many were sold (demo purchases left out)
POST/api/v1/admin/productsAdmin or ownerAdds a product (kind plus / super_likes / boosts / coins, title, the store ids, quantity for packs, durationDays for Plus, samplePriceCents, sort, active)
PATCH/api/v1/admin/products/{id}Admin or ownerChanges a product (its kind stays)
DELETE/api/v1/admin/products/{id}Admin or ownerDeletes a product never bought, or switches a bought one off
GET/api/v1/admin/giftsAdmin or owner (the demo's staff read)Every gift with its icon, price in coins and how many were sent
POST/api/v1/admin/giftsAdmin or ownerAdds a gift (name, icon, coins 1–100,000, sort, active)
PATCH/api/v1/admin/gifts/{id}Admin or ownerChanges a gift
DELETE/api/v1/admin/gifts/{id}Admin or ownerDeletes a gift never sent, or switches a sent one off
GET/api/v1/admin/purchasesAdmin or owner (the demo's staff read)Purchases, newest first, 30 a page, with the member; status verified / refunded / revoked / expired, platform apple / google / demo
POST/api/v1/admin/purchases/{id}/recheckAdmin or ownerAsks Apple or Google about one purchase again (when a store notification was missed) and applies what changed, once, as the notification would: a refund takes Plus or the pack's unspent credit back, a renewal moves Plus on, an ended subscription ends Plus. Answers {outcome, changed, purchase} (outcome: refunded, renewed, expired or unchanged); 409 demo_purchase, 503 store_not_configured, apple_api_key_missing (Apple needs the In-App Purchase key) or store_unreachable, 422 purchase_not_verified when the store has no such purchase. Written to the audit log; refused on the public demo
GET/api/v1/admin/analyticsAdmin or owner (the demo's staff read)?range=7d|30d|90d (30 days by default): sign-ups, matches, messages, gifts and store sales per day (demo purchases left out), the totals, sales by product, members by gender and area, and the share of members who bought something
GET/api/v1/admin/reportsStaff (moderator, admin or owner)The reports queue (status open, closed, actioned, dismissed or all), 30 a page; open reports about someone under 18 come first, then the oldest; each with dueBy (when it came in plus the first-look hours in Settings → Moderation); with how many each tab holds
GET/api/v1/admin/reports/{id}Staff (moderator, admin or owner)One report (by id or number, R-1042) with its evidence, the reported member's profile, their other reports, the staff's actions and the next open report
POST/api/v1/admin/reports/{id}/resolveStaff (moderator, admin or owner){action, note, suspendDays?, reason?, photoIds?}: closes an open report with none (dismissed), warned, content_removed (the given photos removed), suspended (1 to 30 days) or banned (admins only), applied to the reported member; the reporter is told it was reviewed (409 already_resolved when it is closed)
GET/api/v1/admin/banned-wordsStaff (moderator, admin or owner)The words and phrases chat refuses ({ items: [{word, createdAt}], words })
PUT/api/v1/admin/banned-wordsStaff (moderator, admin or owner){words}: replaces the list (each 2 to 40 characters, kept in lower case, at most 1,000)
GET/api/v1/admin/flagged-messagesStaff (moderator, admin or owner)Messages refused for a banned word in the last 30 days, newest first, 30 a page, each with its sender and the word

40Database

PostgreSQL. The schema is in migrations/ and is applied by the server on start. Ids are UUIDs, times are UTC and money is in whole cents. Every table that names a member deletes its rows with the member, except purchases and reports (kept without the member's id, chapter 29). These 38 tables are generated from the migrations when the release is built.

TableWhat it holdsKeysPoints to
Accounts and sign-in
usersEveryone who signs in: members (the app) and the staff (moderators, admins and the owner, the web admin), with their status (active, suspended, banned or deleted)primary key id; unique email (any case), when deleted_at is null–
sessionsSigned-in browsers and apps (only a hash of the hf_session cookie or Bearer token is stored)primary key id; unique token_hashusers
push_devicesThe push token (FCM) of the device a session runs on: one per session, and a device's token belongs to the session signed in on it nowprimary key id; unique session_id; unique tokensessions, users
password_resetsA password reset link (or code) sent by email; it works once, for one hourprimary key id; unique token_hashusers
staff_invitesAn invitation to join the staff as a moderator or an admin (the link in the email works for 7 days, once)primary key id; unique token_hash; unique email (any case), when accepted_at is nullusers
rate_limitsFixed-window counters for sign-in, sign-up and reset limits (keys hold a keyed hash, never a plain address)primary key key–
notificationsWhat each person sees under Notifications in the app (every push is also kept here)primary key idusers
Files
uploadsEvery uploaded file: a person's own or the community's (the brand logo), private (owner and staff) or public, typed and measured by its contentprimary key id; unique storage_keyusers
Settings, legal pages and the server's own work
settingsSettings saved in the admin (they override .env)primary key keyusers
legal_pagesThe legal pages of the website and the app (Markdown, written in Admin → Settings → Legal)primary key slugusers
jobsThe durable background job queue: emails, the nightly housekeeping and purge, and the demo resetprimary key id; unique dedupe_key, when dedupe_key is not null and status in ('queued', 'running')–
audit_logWhat staff did (settings saved, people suspended, staff invited, …), with who and whenprimary key idusers
Profiles and the catalogues
profilesA member's dating profile: name, gender, who they want to see, basics, discovery settings, coarse location (rounded to about 1 km, never shown to others), Plus and boost end timesprimary key user_idusers, areas
photosA member's profile photos (up to six, in order) with their review status (pending, approved, rejected and why)primary key idusers
profile_promptsA member's three prompt answers, in orderprimary key user_id + position; unique user_id + prompt_idusers, prompts
profile_interestsThe interests a member pickedprimary key user_id + interest_idusers, interests
promptsThe profile questions members answer three of ("A perfect Sunday looks like…"), edited in the adminprimary key id; unique text–
interestsThe interest chips members pick up to eight of, with a group heading, edited in the adminprimary key id; unique label–
areasThe neighbourhoods a member can pick when they don't share their location (name, centre point, one-line description); only the member sees their ownprimary key id–
Discover, likes and matches
swipesEvery like, pass and super like one member gave another (one row per pair and direction)primary key from_id + to_idusers
like_quotaHow many likes a free member used each day (the daily limit resets at the configured hour)primary key user_id + dayusers
matchesTwo members who liked each other; unmatching closes the chat for bothprimary key id; unique user_lo + user_hiusers
Chat, gifts and calls
messagesChat messages between matched members: text, gifts, call summaries and system linesprimary key id; unique sender_id + client_idmatches, users, gift_sends, calls
giftsThe gift catalogue (name, icon, price in coins), edited in the adminprimary key id–
gift_sendsEvery gift one member sent another, with the coins it costprimary key idmatches, users, gifts
callsVideo calls between matched members (ringing, active, ended, missed or declined) and how long they lastedprimary key id; unique roommatches, users
Safety and moderation
blocksWho blocked whom; a block hides the two members from each other everywhereprimary key blocker_id + blocked_idusers
reportsMember reports with a numbered id, the reason, a snapshot of the evidence (messages and photos) and the moderator's decisionprimary key id; unique numberusers, matches
banned_wordsWords and phrases chat refuses (scam and abuse terms), edited in the adminprimary key wordusers
flagged_messagesMessages chat refused for a banned word, kept 30 days for the chat-safety pageprimary key idmatches, users
age_refusalsHashed emails refused for being under 18, so they cannot try again with another birth date for 30 daysprimary key email_hash–
banned_emailsHashed emails of banned members, so a ban survives account deletionprimary key email_hash–
support_messagesMessages sent through the website's support form and the app's Help pageprimary key id–
Plus, packs and purchases
productsWhat members can buy: Plus plans and packs of super likes, boosts and coins, with their Apple and Google product idsprimary key id; unique apple_product_id; unique google_product_id–
purchasesEvery verified store purchase (Apple, Google or demo) with its status; kept without the member's id after they delete their account (tax records)primary key id; unique platform + transaction_idusers, products
balancesA member's coins, super likes and boosts (never below zero)primary key user_idusers
ledgerEvery change to a member's balances with its reason, written once per reason and reference so nothing is granted or spent twiceprimary key id; unique user_id + asset + reason + refusers
store_eventsStore notifications received from Apple and Google (renewals, refunds, revocations), each applied onceprimary key id; unique platform + notification_idpurchases
Part 08

Help

41Troubleshooting

The app says "Can't reach Heartfold"

  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.

Discover is empty

Discover shows only people who fit both ways: their gender in your "show me" and yours in theirs, their age in your range, within your distance, with a complete profile and at least one photo others may see (approved, while photo review comes first), not paused, and never anyone you already swiped. On a new install, approve the test members' photos in Photo review (or set Settings → Moderation to "after"), and give test accounts locations near each other: pick the same area in the app's location step. "Widen to …" offers the next distance.

Photos stay "in review"

With Settings → Moderation on "before", a moderator approves each new photo in Admin → Photo review. The sidebar badge shows how many wait.

There is no call button, or "Calls aren't set up"

LiveKit isn't set up: Setup check → Video calls (chapter 11). The button also hides when the other person turned off video calls from matches.

A call connects but shows no video

On your own LiveKit server, ports 7881/tcp and 7882/udp must be open, including on any cloud firewall. LiveKit Cloud needs nothing open.

The app says "Purchases aren't set up"

No store keys are saved and demo purchases are off, which is right until you connect a store: Setup check → App Store purchases and Google Play purchases (chapter 12).

A purchase is refused as "not verified"

The store id in Plans and prices must match the product in App Store Connect or the Play Console exactly. The bundle id and package name in Store keys must be the app's own. For Apple, the environment must accept the purchase (both during testing and App Review). For Google, the service account needs access to the app in the Play Console (it can take a day after inviting it). The setup check's tests prove the keys.

Refunds or renewals don't arrive

Apple: the App Store Server Notifications URL must be https://app.example.com/api/v1/webhooks/apple, version 2, for Production and Sandbox. Google: the Pub/Sub push endpoint must end with ?token= and the same word as in Store keys, and Google's notification account needs the Publisher role on the topic; Play Console → Monetization setup → Send test notification checks the path. With an Apple ID in Store keys, it must be this app's own. Members get a missed renewal back with Restore purchases, and an admin can use Re-check with the store on the purchase.

No push notifications

  1. Setup check → Push messages must be green (the service account and project id are saved).
  2. The app was built with your FIREBASE_* keys (chapter 10). With any of the first three missing, the app quietly leaves push off.
  3. The phone is a real device, notifications are allowed for the app, the member is signed in and that kind is on in Settings → Notifications.
  4. For iOS, the APNs key is uploaded in Firebase.

Live updates don't arrive (new messages need a refresh)

A proxy isn't passing the WebSocket or is buffering the admin's stream. With the bundled Caddy or Traefik it works as is; with Nginx add the upgrade headers and proxy_buffering off; (chapter 5).

Sign-up says "Heartfold is for adults 18 and over"

The date of birth is under the minimum age. The email can't try again with another date for 30 days, by design.

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 34). 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 --dart-define-from-file=.env. After changing packages or ids, run flutter clean and flutter pub get; on iOS also cd ios && pod install --repo-update. "No signing team" on iOS: choose your team in Signing & Capabilities (chapter 17). flutter doctor shows missing tools.

Emails don't arrive

Without SMTP, emails are written to docker compose logs app. With SMTP, use the Email row of the setup check with your own address, and check that the sender's domain is verified with your provider.

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

42FAQ

Do I need to know Rust or Flutter?

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

Can members use Heartfold in a web browser?

No. Members use the app on Android and iOS. The website carries the home page, the safety and legal pages, support and account deletion; the web admin is for staff.

Does it work without purchases, calls or push?

Yes. Without store keys the app shows "Purchases aren't set up" and everything free works; without LiveKit the call button is hidden; without Firebase the app updates live while it is open.

Where does the money go?

Members pay Apple or Google, who keep their commission and pay you through your developer accounts. Heartfold never handles card details and never pays members anything.

Can I take payments by card or PayPal instead?

Not for Plus, packs or coins: Apple and Google require their own in-app purchase for digital goods used in the app (chapter 12).

Can I change the prompts, interests, gifts and prices?

Yes, all in the admin, without a rebuild: Settings → Profile options, Gifts, and Plans and prices (prices themselves are set in the stores).

Can I use miles?

Yes: Settings → Discovery and limits → Distance unit.

Does Heartfold check that members are who their photos say?

No. There is no photo or ID verification. Photo review, reports and blocks are the tools, and the safety centre suggests a short video call in the chat to see that someone is who their photos say.

Which languages?

The app, the admin and the website are in English. Translating means changing the texts in the screens' files.

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

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

Which licence do I need?

To sell Plus, packs or coins to your members, the Envato Extended Licence (chapter 45).

43Third-party services and licences

Third-party services

Heartfold connects to these services with your own accounts. Each one is a third-party service with its own pricing tiers and terms, and you, the buyer, are responsible for any costs. None of them is included in the price of Heartfold.

ServiceUsed forPricing
Apple App Store, Apple Developer ProgramPublishing the iOS app; selling Plus and packs; App Store Server API and notificationsdeveloper.apple.com/programs, commission
Google Play ConsolePublishing the Android app; selling Plus and packs; the Play Developer APIservice fees
Google Cloud (Pub/Sub, service accounts)Google Play's purchase notifications and the service account that checks purchasescloud.google.com/pubsub/pricing
Firebase Cloud Messaging (Google)Push notificationsfirebase.google.com/pricing
LiveKit Cloud (or your own LiveKit server)Video callslivekit.io/pricing
Your email provider (SMTP)Reset codes, delete codes, staff invitationsYour provider's page, for example Amazon SES
Your file storage (optional)Photos and the logo, if not on your own serverYour provider's page, for example Cloudflare R2
Your server and domainRunning HeartfoldYour hosting provider and registrar

Open-source software

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

Every server and web dependency

The Rust crates (from Cargo.lock) and the web app's npm packages, counted by licence when the release is built. docs/third-party-licenses.txt lists every package by name, version and licence; the Flutter packages and their versions are in heartfold_mobile_flutter/pubspec.lock.

LicenceRust cratesnpm packages
MIT55270
Apache-2.0 OR MIT2142
Unicode-3.018–
ISC210
Apache-2.0110
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-3-Clause12
MIT OR Unlicense3–
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–
BSD-2-Clause–2
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
MIT AND BSD-3-Clause1–
MIT-0–1
Unlicense–1
Total321307

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 stock photos. The logo and the in-app mark are original artwork drawn in code. The sample members in the download have no photos (a plain placeholder shows). The member photos in this guide's screenshots are AI-generated portraits of people who do not exist (see the AI disclosure below); they belong to the live demo and are not part of the download. Every image in this guide is a screenshot of the running apps.

AI disclosure

AI tools used to create this item: Yes

  • Source code: Yes. Written with Claude by Anthropic as an AI coding assistant, then reviewed, tested (server tests against a real PostgreSQL, web app tests in three browsers, Flutter unit and widget tests, and the app driven on a phone against a running server) and integrated by us.
  • Documentation: Yes. Drafted with Claude by Anthropic and checked against the code and the running apps.
  • Graphics: Yes. The screen designs, the app icon, the logo and the layouts of the preview images were made with Claude by Anthropic working in a design tool and in code. Every screenshot in this guide and the item's previews is a capture of the running apps.
  • Demo member photos: Yes, AI-generated. The portraits of the live demo's sample members were made with OpenAI's image generation. They show people who do not exist (no real person, stock photo or likeness of anyone). They are shown on the live demo, in this guide's screenshots and in the item's previews only, and are not in the download.
  • Demo text: Yes. The sample city, its members' profiles and messages, 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. Heartfold has no AI features and calls no AI service.

44Changelog

1.0.0 (first release)

The first release of Heartfold: a member app, a web admin, a public website and the server behind them.

Added

  • Member app (Flutter, Android and iOS): sign-up with email, password and date of birth (18 and over, checked on

the server), the community promise (terms, privacy policy, community rules), password reset by emailed code,

profile setup (2 to 6 photos, 3 prompts, up to 8 interests, basics, rough location or a chosen area,

notifications), Discover cards with like, pass and super like, filters, profile pages, matches only on a mutual

like, the match moment, likes lists, chats with read receipts, typing and gifts, video calls between matches,

report and block on every profile, card, chat and call, Plus and packs through the App Store and Google Play,

restore purchases, settings, the safety centre, pause and delete account. Light and dark themes.

  • Admin (web): overview, members (warn, suspend 1 to 30 days, ban, remove a photo, delete, export their data),

the reports queue with evidence and a first-look time, photo review, chat safety (banned words, messages held back),

plans and prices, gifts, purchases (re-check with the store), analytics, staff (owner, admins, moderators),

settings, the setup check with live tests, and an install wizard.

  • Website: home, safety, legal pages (terms, privacy, community rules, cookies), the delete-your-account page the

app stores ask for, and a support form.

  • Purchases: Apple and Google purchases verified on the server with your own keys (App Store Server API and

signed transactions, Google Play Developer API), App Store Server Notifications v2 and Google Play real-time

developer notifications for renewals, expiries and refunds; every purchase granted once, refunds take back what is

left.

  • Calls: video calls through your own LiveKit (LiveKit Cloud or the bundled docker/livekit).
  • Safety and privacy: rough distance only (locations rounded to about 1 km), blocks that hide both people

everywhere, report evidence kept as a snapshot, banned words in chat, photo review before others see a photo,

rate limits, account deletion at once with every personal row and photo file.

  • Install and hosting: one Docker Compose stack (PostgreSQL, MinIO, the server, optional Caddy HTTPS), any

S3-compatible storage or a local folder, push through your own Firebase project, SMTP email, a public demo mode

with one-click sign-ins and a nightly reset.

  • Security: Argon2id passwords, secrets encrypted at rest, rate limits kept in the database, uploads checked by

their content.

45Support and licence

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

Licence

The Regular Licence lets you use Heartfold for one end product whose users are not charged. To sell Plus, packs or coins to your members through the app, you need the Envato Extended Licence. One licence covers one community (one brand on one installation, with its app). The licences page at codecanyon.net/licenses/standard explains both licences in full.

Heartfold is not affiliated with, endorsed by or sponsored by Apple, Google, Firebase or LiveKit. App Store and Apple are trademarks of Apple Inc.; Google Play and Firebase are trademarks of Google LLC; LiveKit is a trademark of its owner.