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.
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
| Path | What 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.yaml | The Dockerfile, the Docker Compose stack, the Caddy HTTPS config and docker/livekit (your own LiveKit server for calls, optional). |
.env.example | Every server setting, explained. Copy it to .env. The app has its own, heartfold_mobile_flutter/.env.example. |
tools/rename.mjs | A 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.txt | A 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.
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
includefeature). 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 prunegives 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.tomlpicks the stable channel and adds clippy and rustfmt) from rustup.rs. - Node.js 24 and pnpm 11 (
corepack enableinstalls the pnpm version the project asks for). - PostgreSQL 15 or newer (the Docker stack ships PostgreSQL 17).
- Optional: any S3-compatible storage (MinIO, AWS S3, Cloudflare R2, Backblaze B2…). Without it, files are kept in a local folder.
Accounts you need
| Account | What it is for | Needed |
|---|---|---|
| Apple Developer Program and Google Play Console | Publishing the member app under your own name, and selling Plus and the packs inside it. | To publish the app |
| An SMTP email provider | Password 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 storage | Member 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.
| Service | Price | What 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 year | Needed to publish on the App Store. |
| Google Play Console (sign up) | $25 once | Needed to publish on Google Play. |
| LiveKit Cloud (pricing) | Free plan, then from $50 a month | Billed 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) | Free | No charge per push message. Other Firebase products you turn on yourself may be billed. |
| Google Cloud Pub/Sub (pricing) | By data volume | Carries 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,000 | Per email sent. Other SMTP providers sell monthly plans with a free tier. |
| File storage | $0 to $0.015 per GB | The 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 month | One server with 2 cores and 4 GB of memory runs the whole Docker stack for a city. |
| Domain name | about $10 to $20 a year | The address of your community, for example app.example.com. |
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.
- Unzip the download and open a terminal in the
heartfold/folder (the one withcompose.yamlin it). - Create your settings file:
cp .env.example .env - Open
.envin any text editor and fill in these four values:
Change both passwords: the example values are public. KeepAPP_URL=http://localhost:8080 # your public https:// address on a server APP_SECRET=paste-a-random-string-here # make one with: openssl rand -hex 32 POSTGRES_PASSWORD=pick-a-long-password # letters and digits only S3_SECRET_ACCESS_KEY=pick-another-password # at least 8 charactersAPP_SECRETsafe and never change it after the install, because it encrypts the keys you save in the admin. LeaveDATABASE_URLempty: Docker builds the database address from the values above. LeaveDEMO_MODEandDEMO_PURCHASESat"false". - Start everything:
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, adddocker compose up -d--build(docker compose up -d --build). - Find the install token in the app's log (if the app has restarted, use the last line):
The line readsdocker compose logs app | grep -i "install token"Install token: hf-install-… (open /install and paste it). - 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.
- Optional: load the sample city to see everything with data in it (chapter 33):
docker compose exec app heartfold seed-demo --confirm
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.
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).
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)
| Size | Good for |
|---|---|
| 2 cores, 4 GB memory, 40 GB disk | Building on the server and running a community of thousands of members. |
| 1 to 2 cores, 1 to 2 GB memory | Running a build made on another computer (see "Build on another computer" below), or building with swap added. |
| 4+ cores, 8+ GB memory | A 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.
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 acompose.override.yamlfile next tocompose.yaml. Docker Compose reads it by itself on everydocker composecommand.docker network lsshows the proxy's network name; the examples call itproxy.
Traefik: the labels tell Traefik the address, the entrypoint and the certificate resolver. Use the entrypoint and resolver names from your own Traefik setup (websecure and letsencrypt are common). 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 setup | Setting |
|---|---|
The bundled Caddy (--profile https) | TRUSTED_PROXY_HOPS=1 (the Docker default). The app port is published on 127.0.0.1 only, so Caddy is the only way in, and Caddy replaces any X-Forwarded-For a visitor sends with the real address. |
| Your own Nginx, Apache or Traefik on the same server (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 throughDATABASE_URL, an S3 bucket through theS3_*keys (orSTORAGE_DRIVER=localwith a persistent volume at/app/storage), and setAPP_URL,APP_SECRETandTRUSTED_PROXY_HOPSfor 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.
- 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? SetINSTALL_TOKENin.envto a value of your choice and restart the app withdocker 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. - 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).
- 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.
- 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.
- 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.
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.
| Row | What it shows, and what the test does |
|---|---|
| Database | PostgreSQL is reachable and how many migrations are applied. The test reads the PostgreSQL version. |
| File storage | The 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 messages | Whether 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 purchases | Off, 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 purchases | Off, on without refunds and renewals (no notifications token), or fully on. The test asks Google for an access token with your Play service account. |
| Purchases | How 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 pages | Whether the terms, privacy policy and community rules have text. The app stores ask for them before a dating app goes live. |
| App address | Whether APP_URL is https. The test calls APP_URL/api/health from the server itself. |
| Visitor addresses | The TRUSTED_PROXY_HOPS setting (chapter 5). |
| Background jobs | Jobs 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). |
| Install | Whether the install wizard has finished. |
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.
- 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.
- Enter them in Admin → Settings → Email, or the
SMTP_*keys in.env. Usestarttlson port 587,tlson port 465. - 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 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_IDandS3_SECRET_ACCESS_KEYin.env, or enter them in Admin → Settings → Storage. Keep the bucket private. For AWS S3 leaveS3_ENDPOINTempty; for R2 use your account's S3 address and regionauto. - A local folder:
STORAGE_DRIVER=localkeeps files in theapp-storageDocker 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.
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 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).
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
- Open the Firebase console, choose Create a project, name it after your community and finish (Google Analytics is not needed).
- 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/.env | Where the value is |
|---|---|
FIREBASE_API_KEY | apiKey of the android options in firebase_options.dart (current_key in google-services.json). |
FIREBASE_PROJECT_ID | projectId |
FIREBASE_MESSAGING_SENDER_ID | messagingSenderId |
FIREBASE_ANDROID_APP_ID | appId of the android options (1:…:android:…) |
FIREBASE_IOS_APP_ID | appId of the ios options (1:…:ios:…) |
FIREBASE_IOS_BUNDLE_ID | iosBundleId |
FIREBASE_STORAGE_BUCKET | storageBucket (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
- 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.
- 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
.envinstead:FCM_PROJECT_IDandFCM_SERVICE_ACCOUNT_JSONas one line of JSON.) - 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.
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
- 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.
- 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). - The person called answers (and gets their own token) or declines. Nobody answering for 30 seconds makes it a missed call.
- 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.
- 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 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
- Sign up at cloud.livekit.io and create a project.
- 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. - Paste them into Admin → Settings → Calls (LiveKit address, API key, API secret) or into
LIVEKIT_URL,LIVEKIT_API_KEYandLIVEKIT_API_SECRETin.env. Leave the Room API address empty. - 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.
- Point a domain at the LiveKit server, for example
calls.example.com. - 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).
- Copy the
docker/livekitfolder to that server and put a.envnext 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 - Start it there:
docker compose up -d(on the Heartfold server itself,docker compose --env-file ../../.env up -dfromdocker/livekitreads the same keys from Heartfold's.env, but only if ports 80 and 443 are free). - In Heartfold (Admin → Settings → Calls, or
.env):LIVEKIT_URL=wss://calls.example.comand 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.
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.
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.
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.
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.
| Product | Sample store id (Apple and Google) | Kind in the store | What it gives |
|---|---|---|---|
| Plus · 1 week, 1 month, 6 months | heartfold.plus.week, heartfold.plus.month, heartfold.plus.halfyear | Auto-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 likes | heartfold.superlikes.5, heartfold.superlikes.15 | Consumable / One-time product | Super likes to spend in Discover. |
| 1 or 5 boosts | heartfold.boosts.1, heartfold.boosts.5 | Consumable / One-time product | A boost puts the member first in Discover for 30 minutes (Settings → Discovery and limits). |
| 100, 550 or 1,200 coins | heartfold.coins.100, heartfold.coins.550, heartfold.coins.1200 | Consumable / One-time product | Coins pay for gifts in chat. The person who receives a gift gets nothing they can spend or cash out. |
1. App Store (iPhone)
- 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.
- 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.
- 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
.p8file (Apple lets you download it once). - Enter them in Admin → Settings → Store keys: the bundle id, the issuer id, the key id and the contents of the
.p8file, 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.envinstead:APPLE_BUNDLE_ID,APPLE_ISSUER_ID,APPLE_KEY_ID,APPLE_PRIVATE_KEY(one line,\nfor the line breaks),APPLE_ENVIRONMENTandAPPLE_APP_ID. - 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/applewith Version 2. They need no token: each notification is signed by Apple and the server checks that signature. - 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)
- 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).
- 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.
- 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.
- Enter the package name and the JSON key's text in Admin → Settings → Store keys (
GOOGLE_PLAY_PACKAGE_NAMEandGOOGLE_PLAY_SERVICE_ACCOUNT_JSONin.env). - 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 givegoogle-play-developer-notifications@system.gserviceaccount.comthe 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.
- Make up a long random word for the push address:
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
- The member buys on the store's own sheet in the app. The app never takes a card.
- The store hands the app its proof: on iPhone a signed StoreKit 2 transaction, on Android a purchase token.
- The app sends that proof to your server, signed in as the member.
- 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.
- 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.
- 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.
- The app shows the result: "You're on Plus until…", or the new balance.
- 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.
- 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.
- 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.
- Refunds and revocations arrive the same way (Apple: refund or revoke; Google: a voided purchase or a revoked subscription).
- 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.
- 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="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.
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 doctortells 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
- Open a terminal in
heartfold_mobile_flutter/and create the settings file:cp .env.example .env - In
.env, setAPI_BASE_URLto your server, for examplehttps://app.example.com(the Android emulator reaches a server on your own computer ashttp://10.0.2.2:8080). - Fetch the packages and start an emulator, a simulator or a phone on USB:
flutter pub get flutter devices - Run the app:
The first iOS run installs the CocoaPods by itself.flutter run --dart-define-from-file=.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.
| Key | What it does |
|---|---|
API_BASE_URL | Your 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_BUCKET | Your Firebase project, for push notifications (chapter 10). Empty: the app runs without push. |
SUPPORT_EMAIL | The 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
| Key | Where you change it |
|---|---|
| The server address | API_BASE_URL in the app's .env, then build again. |
| Firebase (push), app side | The FIREBASE_* keys in the app's .env, then build again. |
| Firebase (push), server side | Admin → 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 purchases | Admin → Settings → Store keys, or APPLE_* and GOOGLE_PLAY_*. Product ids: Admin → Plans and prices. No app rebuild. |
| Email (SMTP) | Admin → Settings → Email, or SMTP_*. |
| Storage | Admin → Settings → Storage, or S3_*. |
| Every other server key | The server's .env (chapter 35), then docker compose up -d. |
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
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"
| Option | What it does |
|---|---|
--name | The 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. |
--id | The 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. |
--scheme | Optional. 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. |
--color | Optional. 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-font | Optional. 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-bg | Optional. 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. |
--dry | Shows 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"inandroid/app/src/main/AndroidManifest.xml. - iOS:
CFBundleDisplayNameandCFBundleNameinios/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
titleinlib/app.dartand the wordmark on the welcome screen inlib/features/launch/welcome_pages.dart. Searchlib/forHeartfoldto find any others. - Permission prompts (iOS) are in
ios/Runner/Info.plist:NSCameraUsageDescription,NSMicrophoneUsageDescription,NSLocationWhenInUseUsageDescriptionandNSPhotoLibraryUsageDescription. Keep them true to what the app does; Apple reads them.
Rename the package and bundle id
- Android: in
android/app/build.gradle.kts, changeapplicationId = "com.heartfold.app"to your id. Thenamespaceis the code's package name, not the app's id; it may stay. If you change it too, moveandroid/app/src/main/kotlin/com/heartfold/app/MainActivity.ktto the matching folders and change itspackageline. - iOS: open
ios/Runner.xcworkspacein Xcode, select the Runner target → Signing & Capabilities, and change the Bundle Identifier (it setsPRODUCT_BUNDLE_IDENTIFIERfor 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 underCFBundleURLSchemesin 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_dependenciesinpubspec.yaml, put a square 1024 px PNG with no transparency inassets/icon/icon.png, add
toflutter_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: truepubspec.yaml, and rundart 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 theAppIconset inios/Runner/Assets.xcassets(drag a 1024 px image into it in Xcode). - The mark inside the app (the welcome screen) is drawn in code:
HfLogoinlib/components/hf_photo.dart. The launch screens areandroid/app/src/main/res/drawable/launch_background.xmlandios/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.dartholdsHfColors.lightandHfColors.dark. The brand colour isbrand(heart rose#E5446D,#FF5C83in dark), withbrandSoft,brandInkandbrandHoverbeside it;apricotmarks super likes, gifts and coins;premiumAandpremiumBmake 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 underfonts:inpubspec.yamland change the two family names at the top ofhf_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+1inpubspec.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)
- 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 - Create
heartfold_mobile_flutter/android/key.properties(it is ignored by Git and never shipped):
Use the full path of the file on your own computer (on Windows with forward slashes, for examplestorePassword=the-store-password keyPassword=the-key-password keyAlias=upload storeFile=/full/path/to/upload-keystore.jksC:/keys/upload-keystore.jks). Without this file, release builds are signed with the debug key, which Google Play refuses. - Build an App Bundle for Google Play, or an APK to install by hand:
The files land influtter build appbundle --dart-define-from-file=.env flutter build apk --dart-define-from-file=.envbuild/app/outputs/bundle/release/app-release.aabandbuild/app/outputs/flutter-apk/app-release.apk.
iOS: choose your Apple team, then archive (IPA)
- Open
ios/Runner.xcworkspacein 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. - 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.
- In App Store Connect, create the app (Apps → + → New App) with your bundle id.
- Build the archive and the IPA:
The IPA lands influtter build ipa --dart-define-from-file=.envbuild/ios/ipa/. Upload it with Apple's Transporter app, or openbuild/ios/archive/Runner.xcarchivein 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 for | Where it is in Heartfold |
|---|---|
| Adults only | The 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 anything | The 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 content | Report on every profile, Discover card, chat and call; the report copies the evidence (chapter 21). |
| A way to block abusive people | Block on every profile, card, chat and call; it hides both people from each other everywhere. |
| Filtering of objectionable content, and timely action on reports | Photo 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 information | The support email (Settings → General and Branding), the website's support form and the app's Help page. |
| Account deletion in the app | Settings → 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
- 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."
- 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+).
- 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.
- 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. - 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.
- Submit the build for review.
Google Play
- In the Play Console, choose Create app, pick the Dating category and fill in the store listing (name, descriptions, icon, screenshots).
- Target audience: 18 and over only. Content rating: answer the questionnaire as a dating app with user-to-user communication.
- 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.
- 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. - Upload the
.aabto 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. - 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.
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
- 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.
- 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.
- 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").
- 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.
- 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.
- 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.
- Video calls between matches (chapter 11).
- 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.
- 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).
- 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
| Role | What they can do |
|---|---|
| Moderator | Members (look, warn, suspend for up to 30 days, lift a suspension, remove a photo), Reports, Photo review and Chat safety. Nothing else. |
| Admin | Everything a moderator does, plus ban and delete members, plans and prices, gifts, purchases, analytics, settings, the setup check, and inviting moderators and admins. |
| Owner | Everything. 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.
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.
- 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. - Read the evidence and write a note for the log (only staff see it).
- 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).
- 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.
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.
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:
- 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.
- Type the App Store product id and the Google Play product id exactly as you created them in the stores (chapter 12).
- 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).
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:
| Setting | What it does | Default |
|---|---|---|
| City | The city the community is for, shown on the app's welcome screens. | Empty |
| Distance unit | Kilometres or miles, on every card and filter. | km |
| Free likes a day | How many likes a free member has each day. Plus has no limit. | 30 |
| Reset hour | When the likes come back, in your time zone (Settings → General). | 08:00 |
| Boost length | How long a boost puts a member first in Discover. | 30 minutes |
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.
| Section | What it holds |
|---|---|
| General | Community name, support email, time zone, minimum age (18 or more) and the brand colour. |
| Discovery and limits | City, km or miles, free likes a day, reset hour, boost length (chapter 24). |
| Profile options | Prompts, interests and areas (chapter 24). |
| Moderation | Photo 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). |
| Push | The Firebase service account, and Send a test push (chapter 10). |
| Calls | The LiveKit address, API key and secret, an optional room API address under Advanced, and Test the connection (chapter 11). |
| The mail server, a test email to any address, and the wording of the reset, delete-account and invitation emails (chapter 8). | |
| Store keys | Apple'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 pages | Terms 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 mode | Whether the server runs as a public demo, and how to turn it off (chapter 33). |
| Branding | Product 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). |
| Storage | Where files are kept, the room per person and Test storage (chapter 9). |
| Sign-ups | Open (anyone old enough can sign up in the app) or closed. |
| App links | The App Store and Google Play addresses for the website's badges (chapter 18). |
| Maintenance | The 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.
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.
27The website
| Page | Address | What it is |
|---|---|---|
| Home | / | Your community's home page with the App Store and Google Play badges (Settings → App links). |
| Safety | /safety | How members stay safe, and how to report and block. |
| Legal pages | /legal/terms, /legal/privacy, /legal/community-rules, /legal/cookies | The texts from Settings → Legal pages. |
| Delete your account | /delete-account | For 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 | /support | A 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 | /signin | Staff 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.
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
| Table | Personal data in it |
|---|---|
users | Email, name, password hash, date of birth, role and status, push choices, when the terms were accepted, last seen. |
profiles | First 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, uploads | Profile photos (the files in storage) and their review status. |
profile_prompts, profile_interests | Prompt answers and picked interests. |
swipes, like_quota, matches | Likes, passes and super likes given; likes used per day; matches. |
messages, gift_sends, calls | Chat messages, gifts sent and call records (who, when, how long; never the video or sound). |
blocks, reports, flagged_messages | Who blocked whom; reports with their evidence snapshot; messages held back for a banned word. |
purchases, balances, ledger | Store purchases, the coins, super likes and boosts left, and every change to them. |
sessions, push_devices, notifications, password_resets | Signed-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_messages | Messages sent through the website's support form and the app's Help page, with the sender's email. |
audit_log | What 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_sessioncookie 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 headerx-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. KeepAPP_SECRETand 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:
| Limit | Allowed | What it protects |
|---|---|---|
| Sign-in, per address | 20 per 15 minutes | Sign-in attempts from one address |
| Sign-in, per account | 10 per 15 minutes | Wrong passwords for one account; after ten the account waits, even for the right password |
| Sign-up, per address | 5 per hour | New accounts from one address |
| Password reset, per address | 5 per hour | Password reset emails asked for from one address |
| Password reset, per account | 3 per hour | Password reset emails sent to one account |
| Reset and invite links, per address | 20 per hour | Tries at a reset or invite link from one address |
| Demo sign-in, per address | 60 per hour | Public demo sign-ins from one address |
| Staff invitations, per admin | 50 per hour | Staff invitations sent by one admin |
| Chat messages and gifts, per member | 20 per minute | Chat messages and gifts sent by one member; over it the app hears 429 slow_down |
| Reports, per member | 5 per hour | Reports made by one member |
| Video calls started, per member | 10 per hour | Video calls started by one member |
| Support messages, per address and per email | 3 per hour | Messages 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.p8key, the service account files and your backups private. - Install Heartfold updates; security fixes are marked as such in the changelog.
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.
| Job | How often | What it does |
|---|---|---|
housekeeping | Every hour | Clears expired sessions, rate-limit windows, used reset codes, staff invitations unanswered for 30 days, and finished job rows older than 14 days. |
members.hourly | Every hour | Lifts 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. |
purge | Every day | Removes 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_ack | When needed | Acknowledges or consumes a Google purchase again when Google couldn't be reached at the time, with a growing wait. |
demo.reset | 03:00 UTC, demo only | Removes and reloads the sample city on a public demo. |
sim.* | Demo only | The 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 jobshows 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_connectionsfor 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_HOPSto 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_SECRETand the same.envfor every copy. - Deploys without downtime:
DRAIN_SECSmakes 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.
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
| Command | What it does |
|---|---|
docker compose exec app heartfold seed-demo | Adds 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-demo | Removes 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 data | Deletes only rows marked as demo data. |
docker compose exec app heartfold migrate | Applies the database migrations and stops (the server also does this on every start). |
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
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.
- Back up as above.
- From the folder that holds
heartfold/(not inside it), rununzip -o heartfold-x.y.z.zipwith the new version's file name. The zip has a top-levelheartfold/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.envandkey.propertiesare kept, because the zip doesn't contain them. - Compare your
.envwith the new.env.example; new keys are listed there and inCHANGELOG.md. This lists the keys of.env.examplethat your.envdoesn't have yet:cd heartfold for k in $(grep -oE '^#? ?[A-Z][A-Z0-9_]*=' .env.example | tr -d '# ='); do grep -q "^$k=" .env || echo "$k"; done - Run
docker compose up -d --build(with--profile httpson your server). The new version applies any new migrations when it starts; your data stays. - If disk is tight, run
docker builder pruneafterwards to free the build cache.
Update 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.
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.
| Key | Required | What it does |
|---|---|---|
| Required | ||
APP_URL | Yes | The 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_SECRET | Yes | A 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_DB | No | The name of the database the stack creates. Default heartfold. |
POSTGRES_USER | No | The database user the stack creates. Default heartfold. |
POSTGRES_PASSWORD | Yes | The database password. Letters and digits only, because it goes into a connection address. |
DATABASE_URL | Outside Docker | The database address, only when you run the server without Docker. Leave it empty with Docker: the stack builds its own from the three keys above. |
INSTALL_TOKEN | No | The token the install wizard asks for. Empty: a new one is printed in the app's log at every start until the install is finished (docker compose logs app | grep -i "install token"). |
| File storage (members' photos, the logo) | ||
STORAGE_DRIVER | No | s3 (the bundled MinIO, AWS S3 or Cloudflare R2) or local (files in a Docker volume). Default in Docker s3. |
S3_ENDPOINT | With s3 | The storage address. The bundled MinIO is http://minio:9000; for R2 use your account's S3 address; for AWS S3 leave it empty. |
S3_REGION | No | The bucket's region. Default us-east-1; R2 uses auto. |
S3_BUCKET | No | The bucket name. Default heartfold; the stack creates it in MinIO. |
S3_ACCESS_KEY_ID | With s3 | The storage access key. With the bundled MinIO this is also its admin user. |
S3_SECRET_ACCESS_KEY | Yes | The storage secret, at least 8 characters. With the bundled MinIO this is also its admin password, so Docker refuses to start without it. |
LOCAL_STORAGE_DIR | Set by Docker | The folder for files with STORAGE_DRIVER=local (/app/storage in Docker, a volume). |
| Calls (LiveKit; empty = calls off) | ||
LIVEKIT_URL | For calls | The 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_KEY | For calls | The LiveKit API key; the server signs each call's short token with it and the secret. |
LIVEKIT_API_SECRET | For calls | The 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_URL | No | Only when this server reaches LiveKit's room API at another address. Empty: LIVEKIT_URL over https. |
LIVEKIT_DOMAIN | With docker/livekit | Only 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_ID | For push | Your 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_JSON | No | Your 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_HOST | For email | Your email provider's SMTP server. Empty: emails are written to the app's log instead of being sent. |
SMTP_PORT | No | The SMTP port. Default 587. |
SMTP_USERNAME | For email | The SMTP user name. |
SMTP_PASSWORD | For email | The SMTP password or API key. |
SMTP_SECURE | No | starttls (port 587, the default), tls (port 465) or none. |
SMTP_FROM | For email | The sender, for example 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_ID | For iPhone purchases | The 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_ID | For iPhone purchases | The id of that In-App Purchase key. |
APPLE_PRIVATE_KEY | For iPhone purchases | The 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_ID | For iPhone purchases | The app's bundle id, for example com.example.heartfold. |
APPLE_ENVIRONMENT | No | Which Apple purchases to accept: both (default; App Review buys in the sandbox), production or sandbox. |
APPLE_APP_ID | No | The 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_NAME | For Android purchases | The 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_JSON | For Android purchases | A 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_TOKEN | For Android refunds and renewals | A 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_PORT | No | The port on this server where the app answers. Default 8080. |
APP_BIND | No | Which address the port is open on. Default 127.0.0.1: this server only, so visitors come in through Caddy or your own proxy. Use 0.0.0.0 only with TRUSTED_PROXY_HOPS=0 or a firewall that lets only your proxy reach the port. |
APP_DOMAIN | With Caddy | The domain Caddy gets an HTTPS certificate for: the host of APP_URL, for example app.example.com. |
TRUSTED_PROXY_HOPS | No | How many reverse proxies in front of the app add the visitor's address to X-Forwarded-For. 1 = the bundled Caddy (the default in Docker); 0 = trust no proxy. Never set it higher than the proxies really in front of the app. |
| Advanced | ||
COMPOSE_PROJECT_NAME | No | Only for a second copy on the same server (for example staging): give each copy its own name, so their containers, database, files, network, image and build cache stay apart. Empty = the name of the Heartfold folder. |
SEARCH_INDEXING | No | on (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_WORKERS | No | Background job workers in this server, 1 to 32. Default 4. |
DRAIN_SECS | No | For 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_MODE | No | Only 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_PURCHASES | No | "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_SEED | No | The 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_PHOTOS | No | The folder of the sample members' photos the demo seed reads (default demo/photos/members). A missing file becomes a plain placeholder. |
DEMO_CALLBOT_URL | No | Demo 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_TOKEN | No | Demo only: the shared secret the server sends to the demo's call partner. Leave it empty outside the live demo. |
RUST_LOG | No | How much the server logs: info (the default), warn, error or debug. |
| Set by Docker, or for development | ||
ASSET_ARCHIVE | No | For your own zero-downtime deploys: a folder that keeps older builds' files, so pages still open in a browser keep working. |
BIND | No | The address the server listens on. Default 0.0.0.0: plus PORT. |
BUILD_TARGET | No | How Docker gets the program: built (the default, built on this server) or prebuilt (uses prebuilt/heartfold, built elsewhere). |
PORT | Set by Docker | The port the server listens on inside its container (8080). |
READY_FILE | No | For your own zero-downtime deploys: the health check passes only once this file exists. |
WEB_DIST | Set by Docker | Where 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
- Start a PostgreSQL (your own, or
docker compose up -d postgreswithports: ["127.0.0.1:5432:5432"]added to the postgres service in acompose.override.yaml) and setDATABASE_URLin.env. For development setSTORAGE_DRIVER=local. - Start the server from
apps/backend:cargo run -- serve(it reads.envfrom the folder or the ones above it and listens on port 8080). - Start the web app from
apps/frontend:pnpm install, thenpnpm dev, and openhttp://localhost:5173. Calls to/apigo to the server on port 8080. Screens reload as you save. - Run the app against it:
API_BASE_URL=http://10.0.2.2:8080in the app.envfor the Android emulator, thenflutter run --dart-define-from-file=.env. Flutter's hot reload works as usual.
Tests
| Part | Command | What it covers |
|---|---|---|
| Server, unit | cargo test -p heartfold-server --lib | Rough distances, the likes window, backoff, Apple's certificate chain, and the other rules that need no database. |
| Server, API | TEST_DATABASE_URL=postgres://user:password@127.0.0.1:5432/postgres cargo test -p heartfold-server | The 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 lints | cargo clippy --workspace --all-targets -- -D warnings | Kept clean; cargo deny check checks advisories and licences. |
| Web app | pnpm test | Unit 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 app | flutter test | Unit, 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.
- The route. Each area of the API is one file in
apps/backend/src/api/; itsroutes()function lists the addresses. Openapps/backend/src/api/catalog.rsand add a line toroutes():.route("/catalog/gift-count", get(gift_count)) - The handler, in the same file. The
///comment is what the docs' API reference shows for it:
A database error becomes a clean 500 through/// `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 }))) }?; to refuse a request, return one of theApiErrorhelpers insrc/error.rs(each has a status, a stablecodeand a message the screens show as it is). A route that needs a signed-in member takesctx: UserCtx; staff routes takeStaff,AdminorOwner(seesrc/auth.rs), and the server refuses everyone else before your code runs. - 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; } - Run it:
Run them in the Heartfold folder. The test run ends withTEST_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 warningstest catalog::the_app_reads_the_gift_count ... ok. Then rebuild withdocker 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 asR-1042. Lists page by cursor and answer{ items, nextCursor }. - Errors:
{"error": {"code": "…", "message": "…", "details": {…}}}with the HTTP status, for exampleunder_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_bannedanddemo_read_only(403). The message is written to be shown to people as it is. - The web admin signs in with the
hf_sessioncookie and sendsx-heartfold: 1on every change. The app gets a token from/auth/registeror/auth/loginand sendsAuthorization: Bearer <token>. - Live updates:
GET /api/v1/eventsis a WebSocket for the app (the token inSec-WebSocket-Protocolor?token=) and a Server-Sent Events stream for the admin:message,read,typing,match,like,gift,call,notificationandaccount.
| Method | Address | Who may call it | What it does |
|---|---|---|---|
| System | |||
GET | / | Anyone | 200 while the server runs, 503 while it hands over to a new copy during a deploy |
GET | / | Anyone | The running build's version; open pages compare it with their own to offer a reload after a deploy |
GET | / | Anyone | Tells search engines which pages they may index: the public pages, or none with SEARCH_INDEXING=off |
| Files and live updates | |||
GET | / | Signed 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 | / | Signed in | Uploads 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 | / | Signed in | A file, to the person it belongs to or to staff (public files to anyone signed in) |
DELETE | / | Signed in | Removes one of the person's own files (its row first, then the file) |
GET | / | Anyone | A public file (the brand logo, …), without sign-in; cached for a year (a new file gets a new id) |
| Public pages and install | |||
GET | / | Anyone | What 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 | / | Anyone | The same answer as /public/config, at the address the app asks |
GET | / | Anyone | One legal page (Markdown) with when it was last saved; 404 while it has no text |
GET | / | Anyone, until the install is done (install token) | Whether the install wizard has run |
POST | / | Anyone, until the install is done (install token) | Checks the install token and the setup before the wizard's last step |
POST | / | Anyone, until the install is done (install token) | Finishes the install: the owner's account and the brand (runs once) |
GET | / | Anyone | On the public demo only, the main photo of the nora or theo sign-in card (404 elsewhere) |
POST | / | Anyone | {email}; emails a 6-digit code (15 minutes, 5 tries) when a member account has that email |
POST | / | Anyone | {email, code}; deletes the member's account at once with every personal row and photo (400 wrong_code {triesLeft} or code_expired otherwise) |
POST | / | Anyone | The 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 | / | Anyone | Creates 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 | / | Anyone | Signs in with email and password (wrong passwords count down, then the account waits) |
POST | / | Signed in | Signs out of this browser or app (the session and its push token go) |
GET | / | Signed in | The signed-in person and what they may do |
GET | / | Anyone | The signed-in person like /auth/me, or { me: null } when signed out (always 200) |
POST | / | Anyone | Emails 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 | / | Anyone | Sets 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 | / | Anyone | Whose link this is (404 when it expired or was used) |
GET | / | Anyone | What a staff invitation is for (role, email, who sent it) |
POST | / | Anyone | Accepts a staff invitation (once), signing in or creating the account; the account gets the invited role (an owner keeps theirs) |
PATCH | / | Signed in | Changes the person's name or picture |
POST | / | Signed in | Changes the password (the current one is asked for); other sessions end |
POST | / | Anyone, public demo only | One-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 | / | Signed in | Saves this device's push token (token, platform: android, ios or web), one per session |
DELETE | / | Signed in | Stops push messages to this device (the person turned them off) |
GET | / | Signed in | The 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 | / | Signed in | Changes any of name, avatarUrl and notifications (booleans per kind, merged into the saved ones); answers /me |
DELETE | / | Signed in | Deletes 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 | / | Signed in | The person's in-app notifications, newest first, 30 a page (nextCursor is the cursor of the next page), with how many are unread |
POST | / | Signed in | Marks the given notifications read (ids; all of them without it); answers the unread count left |
POST | / | Signed in | Marks every notification of the person read; answers the unread count (0) |
PATCH | / | Signed in | Changes 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 | / | Signed in | [{promptId, answer}], exactly three different prompts (answers up to 150 characters) |
PUT | / | Signed in | [ids], up to 8 (422 too_many_interests) |
PUT | / | Signed in | {lat, lng} (rounded to about 1 km before it is kept) or {areaId} |
PATCH | / | Signed in | Age range, distance, show me, read receipts, calls from matches, the share-an-interest filter and push choices |
POST | / | Signed in | Hides the profile from Discover (matches and chats go on) |
POST | / | Signed in | Shows the profile in Discover again |
POST | / | Signed in | Adds 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 | / | Signed in | [ids], every photo of the member once, in the new order |
DELETE | / | Signed in | Removes one of the member's photos and its file; a complete profile keeps at least one (409 last_photo) |
GET | / | Signed in | The member's purchases, newest first, with their status (verified, refunded, revoked, expired) |
GET | / | Signed in | What 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 | / | Signed in | The members I blocked, newest first, 30 a page: {userId, firstName, blockedAt, context, reported, deleted} (deleted: their account is gone) |
| Member photos | |||
GET | / | Signed in | A 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 | / | Anyone | The profile prompts to pick from ({ items: [{id, text}] }) |
GET | / | Anyone | The interests with their picker heading ({ items: [{id, label, group}] }) |
GET | / | Anyone | The areas a member may pick instead of sharing their location ({ items: [{id, name, description}] }; never coordinates) |
GET | / | Anyone | The gifts and their price in coins ({ items: [{id, name, icon, coins}] }) |
GET | / | Anyone | Plus 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 | / | Signed 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 | / | Signed in | {productId, purchaseToken}, verified with the Play Developer API, granted once, then acknowledged (Plus) or consumed (packs) |
POST | / | Signed 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 | / | Signed in | {platform: "apple", signedTransactions} or {platform: "google", purchases: [{productId, purchaseToken}]}; each verified and recorded for this member (others' purchases are skipped) |
POST | / | Signed in | Spends one boost and puts the member first in Discover for the boost length (Settings, 30 minutes); 402 no_boosts, 409 boost_running |
POST | / | Anyone | App Store Server Notifications v2 ({signedPayload}, Apple's certificate chain checked): renewals, expiries, refunds and revocations, each applied once |
POST | / | Anyone | Google 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 | / | Signed in | A 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 | / | Signed in | Sends 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 | / | Signed in | Marks the other person's messages read (they see it only while I share read receipts) |
POST | / | Signed in | Tells the other person's screens I am typing |
POST | / | Signed in | Sends a gift paid in coins (402 not_enough_coins {needed, balance}) as a gift message; answers the message and the coins left |
POST | / | Signed in | Calls 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 | / | Signed in | A call I am part of |
POST | / | Signed in | The person called answers a ringing call: {call, livekit: {url, token}} (409 call_over once it stopped ringing) |
POST | / | Signed in | The person called declines a ringing call |
POST | / | Signed in | Hangs up (either side); the chat gets a call line with its length and the room closes |
| Discover, likes and matches | |||
GET | / | Signed in | The 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 | / | Signed in | Another 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 | / | Signed in | Like, 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 | / | Signed in | Takes 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 | / | Signed in | The 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 | / | Signed in | The people I liked who haven't matched me, newest first, 30 a page |
GET | / | Signed in | One of the soft, blurred-looking pictures a free member's likes grid shows (made on the server; never anyone's photo) |
GET | / | Signed in | newMatches (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 | / | Signed in | Unmatches (either person): the chat and calls close for both, a live call ends, and the match leaves both lists |
| Blocks and reports | |||
POST | / | Signed in | Blocks a member: both are hidden from each other everywhere, an open match is unmatched and a live call between them ends |
DELETE | / | Signed in | Lifts my block (the match never comes back); 404 when there is none |
POST | / | Signed in | Reports 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 | / | Staff (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 | / | Staff (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 | / | Staff (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 | / | Staff (moderator, admin or owner) | Suspends, bans or restores a member (status with a reason), or renames them |
GET | / | Admin or owner (the demo's staff read) | Every settings section (secrets masked), the server facts and storage stats |
POST | / | Admin or owner | The 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 | / | Admin or owner | Saves one settings section (secrets are sealed; an empty secret keeps .env) |
GET | / | Admin or owner (the demo's staff read) | Every legal page with its text (empty pages are hidden from the site and the app) |
PUT | / | Admin or owner | Saves one legal page's text (Markdown, up to 100,000 characters) and, when sent, its title |
GET | / | Admin or owner (the demo's staff read) | The emails the server sends, with their built-in and saved wording, for the email editor |
GET | / | Admin or owner (the demo's staff read) | The setup check rows |
POST | / | Admin or owner | Tests one setup check row against the real service |
GET | / | Admin or owner (the demo's staff read) | Background jobs (status and kind filters) with counts per status |
POST | / | Admin or owner | Queues a failed job again |
POST | / | Admin or owner | Removes the demo data (demo-marked rows only) |
GET | / | Admin or owner (the demo's staff read) | The staff, highest role first, and the open invitations |
POST | / | Admin or owner | Invites someone by email as a moderator or an admin; the email carries a link that works once, for 7 days |
DELETE | / | Admin or owner | Cancels an invitation that has not been accepted yet |
PATCH | / | Admin or owner | Changes a staff member's role (moderator or admin) |
DELETE | / | Admin or owner | Takes someone off the staff: their account stays (as a member's) and their admin sessions end at once |
GET | / | Admin or owner (the demo's staff read) | Every profile prompt with how many members answer it |
POST | / | Admin or owner | Adds a prompt (text 3–80 characters, sort, active) |
PATCH | / | Admin or owner | Changes a prompt's text, order or whether members can pick it |
GET | / | Admin or owner (the demo's staff read) | Every interest with its heading and how many members picked it |
POST | / | Admin or owner | Adds an interest (label 2–30 characters, group, sort, active) |
PATCH | / | Admin or owner | Changes an interest's label, heading, order or whether members can pick it |
GET | / | Admin or owner (the demo's staff read) | Every area with its centre and how many members picked it |
POST | / | Admin or owner | Adds an area (name, description, centre lat/lng, sort, active) |
PATCH | / | Admin or owner | Changes an area's name, description, centre, order or whether it is offered |
GET | / | Staff (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 | / | 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 | / | Admin or owner | Deletes the member at once, as their own deletion does (every personal row and photo file; their matches see the conversation ended) |
POST | / | Staff (moderator, admin or owner) | Sends the member a warning in the staff's words (an in-app notification and a push) |
POST | / | Staff (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 | / | Staff (moderator, admin or owner) | Ends a suspension early (409 not_suspended when the member is not suspended) |
POST | / | Admin 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 | / | Admin 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 | / | Staff (moderator, admin or owner) | The photo review queue (status pending or approved), oldest first, 30 a page ({ items: [{photo, member}], nextCursor }) |
DELETE | / | Staff (moderator, admin or owner) | {reason}: removes a shown photo; the member is told why |
POST | / | Staff (moderator, admin or owner) | Approves a waiting photo: other members can see it |
POST | / | Staff (moderator, admin or owner) | {reason}: the waiting photo leaves the profile and the member is told why |
GET | / | Admin 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 | / | Admin or owner | Adds a product (kind plus / super_likes / boosts / coins, title, the store ids, quantity for packs, durationDays for Plus, samplePriceCents, sort, active) |
PATCH | / | Admin or owner | Changes a product (its kind stays) |
DELETE | / | Admin or owner | Deletes a product never bought, or switches a bought one off |
GET | / | Admin or owner (the demo's staff read) | Every gift with its icon, price in coins and how many were sent |
POST | / | Admin or owner | Adds a gift (name, icon, coins 1–100,000, sort, active) |
PATCH | / | Admin or owner | Changes a gift |
DELETE | / | Admin or owner | Deletes a gift never sent, or switches a sent one off |
GET | / | Admin 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 | / | Admin or owner | Asks 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 | / | Admin 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 | / | Staff (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 | / | 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 | / | Staff (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 | / | Staff (moderator, admin or owner) | The words and phrases chat refuses ({ items: [{word, createdAt}], words }) |
PUT | / | Staff (moderator, admin or owner) | {words}: replaces the list (each 2 to 40 characters, kept in lower case, at most 1,000) |
GET | / | Staff (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.
| Table | What it holds | Keys | Points to |
|---|---|---|---|
| Accounts and sign-in | |||
users | Everyone 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 | – |
sessions | Signed-in browsers and apps (only a hash of the hf_session cookie or Bearer token is stored) | primary key id; unique token_hash | users |
push_devices | The 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 now | primary key id; unique session_id; unique token | sessions, users |
password_resets | A password reset link (or code) sent by email; it works once, for one hour | primary key id; unique token_hash | users |
staff_invites | An 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 null | users |
rate_limits | Fixed-window counters for sign-in, sign-up and reset limits (keys hold a keyed hash, never a plain address) | primary key key | – |
notifications | What each person sees under Notifications in the app (every push is also kept here) | primary key id | users |
| Files | |||
uploads | Every uploaded file: a person's own or the community's (the brand logo), private (owner and staff) or public, typed and measured by its content | primary key id; unique storage_key | users |
| Settings, legal pages and the server's own work | |||
settings | Settings saved in the admin (they override .env) | primary key key | users |
legal_pages | The legal pages of the website and the app (Markdown, written in Admin → Settings → Legal) | primary key slug | users |
jobs | The durable background job queue: emails, the nightly housekeeping and purge, and the demo reset | primary key id; unique dedupe_key, when dedupe_key is not null and status in ('queued', 'running') | – |
audit_log | What staff did (settings saved, people suspended, staff invited, …), with who and when | primary key id | users |
| Profiles and the catalogues | |||
profiles | A 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 times | primary key user_id | users, areas |
photos | A member's profile photos (up to six, in order) with their review status (pending, approved, rejected and why) | primary key id | users |
profile_prompts | A member's three prompt answers, in order | primary key user_id + position; unique user_id + prompt_id | users, prompts |
profile_interests | The interests a member picked | primary key user_id + interest_id | users, interests |
prompts | The profile questions members answer three of ("A perfect Sunday looks like…"), edited in the admin | primary key id; unique text | – |
interests | The interest chips members pick up to eight of, with a group heading, edited in the admin | primary key id; unique label | – |
areas | The neighbourhoods a member can pick when they don't share their location (name, centre point, one-line description); only the member sees their own | primary key id | – |
| Discover, likes and matches | |||
swipes | Every like, pass and super like one member gave another (one row per pair and direction) | primary key from_id + to_id | users |
like_quota | How many likes a free member used each day (the daily limit resets at the configured hour) | primary key user_id + day | users |
matches | Two members who liked each other; unmatching closes the chat for both | primary key id; unique user_lo + user_hi | users |
| Chat, gifts and calls | |||
messages | Chat messages between matched members: text, gifts, call summaries and system lines | primary key id; unique sender_id + client_id | matches, users, gift_sends, calls |
gifts | The gift catalogue (name, icon, price in coins), edited in the admin | primary key id | – |
gift_sends | Every gift one member sent another, with the coins it cost | primary key id | matches, users, gifts |
calls | Video calls between matched members (ringing, active, ended, missed or declined) and how long they lasted | primary key id; unique room | matches, users |
| Safety and moderation | |||
blocks | Who blocked whom; a block hides the two members from each other everywhere | primary key blocker_id + blocked_id | users |
reports | Member reports with a numbered id, the reason, a snapshot of the evidence (messages and photos) and the moderator's decision | primary key id; unique number | users, matches |
banned_words | Words and phrases chat refuses (scam and abuse terms), edited in the admin | primary key word | users |
flagged_messages | Messages chat refused for a banned word, kept 30 days for the chat-safety page | primary key id | matches, users |
age_refusals | Hashed emails refused for being under 18, so they cannot try again with another birth date for 30 days | primary key email_hash | – |
banned_emails | Hashed emails of banned members, so a ban survives account deletion | primary key email_hash | – |
support_messages | Messages sent through the website's support form and the app's Help page | primary key id | – |
| Plus, packs and purchases | |||
products | What members can buy: Plus plans and packs of super likes, boosts and coins, with their Apple and Google product ids | primary key id; unique apple_product_id; unique google_product_id | – |
purchases | Every 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_id | users, products |
balances | A member's coins, super likes and boosts (never below zero) | primary key user_id | users |
ledger | Every change to a member's balances with its reason, written once per reason and reference so nothing is granted or spent twice | primary key id; unique user_id + asset + reason + ref | users |
store_events | Store notifications received from Apple and Google (renewals, refunds, revocations), each applied once | primary key id; unique platform + notification_id | purchases |
Help
41Troubleshooting
The app says "Can't reach Heartfold"
- Open
API_BASE_URL/api/healthin the phone's browser: it must answer. On the Android emulator a server on your computer ishttp://10.0.2.2:8080, notlocalhost. API_BASE_URLis the server's root without/api/v1. The value is built into the app: after changing.env, run or build the app again.- 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
- Setup check → Push messages must be green (the service account and project id are saved).
- The app was built with your
FIREBASE_*keys (chapter 10). With any of the first three missing, the app quietly leaves push off. - 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.
- 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.
| Service | Used for | Pricing |
|---|---|---|
| Apple App Store, Apple Developer Program | Publishing the iOS app; selling Plus and packs; App Store Server API and notifications | developer.apple.com/programs, commission |
| Google Play Console | Publishing the Android app; selling Plus and packs; the Play Developer API | service fees |
| Google Cloud (Pub/Sub, service accounts) | Google Play's purchase notifications and the service account that checks purchases | cloud.google.com/pubsub/pricing |
| Firebase Cloud Messaging (Google) | Push notifications | firebase.google.com/pricing |
| LiveKit Cloud (or your own LiveKit server) | Video calls | livekit.io/pricing |
| Your email provider (SMTP) | Reset codes, delete codes, staff invitations | Your provider's page, for example Amazon SES |
| Your file storage (optional) | Photos and the logo, if not on your own server | Your provider's page, for example Cloudflare R2 |
| Your server and domain | Running Heartfold | Your hosting provider and registrar |
Open-source software
Heartfold is built with these open-source projects, each under its own licence:
- Server: Rust, Axum, Tokio, SQLx, reqwest, rustls and ring, Lettre, argon2, aes-gcm, chrono-tz and mimalloc, under permissive licences (MIT, Apache 2.0, ISC or BSD).
- Web app: React, React Router, Vite, Tailwind CSS, shadcn/ui, Base UI, Radix UI, TanStack Query and Table, Sonner and React DayPicker (MIT).
- Member app: Flutter (BSD 3-Clause) and these packages from pub.dev: livekit_client (Apache 2.0) for calls; in_app_purchase, firebase_core, firebase_messaging, go_router, flutter_secure_storage, image_picker, http, web_socket_channel, shared_preferences, url_launcher, share_plus, package_info_plus, connectivity_plus, wakelock_plus, intl and shimmer (BSD 3-Clause); flutter_riverpod, geolocator, permission_handler and lucide_icons_flutter (MIT).
- Icons: Lucide (ISC licence), in the web app and the app.
- Fonts: Fraunces and Outfit in the app (their licences are in
assets/fonts/) and the web app, Geist and JetBrains Mono in the web app (bundled through Fontsource), all under the SIL Open Font License 1.1. - Docker images: PostgreSQL (PostgreSQL Licence), MinIO (GNU AGPL 3.0, run unmodified as a separate service), Caddy (Apache 2.0), LiveKit server (Apache 2.0, only with
docker/livekit), and the official Rust, Node.js and Debian images used to build and run the app. - Apple Root CA - G3, Apple's public root certificate (bundled in
apps/backend/certs/), to check Apple's signatures.
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.
| Licence | Rust crates | npm packages |
|---|---|---|
| MIT | 55 | 270 |
| Apache-2.0 OR MIT | 214 | 2 |
| Unicode-3.0 | 18 | – |
| ISC | 2 | 10 |
| Apache-2.0 | 1 | 10 |
| OFL-1.1 | – | 4 |
| (MIT OR Apache-2.0) AND Unicode-3.0 | 3 | – |
| Apache-2.0 OR MIT OR Zlib | 3 | – |
| Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT | 3 | – |
| BSD-3-Clause | 1 | 2 |
| MIT OR Unlicense | 3 | – |
| 0BSD | 1 | 1 |
| Apache-2.0 OR BSD-2-Clause OR MIT | 2 | – |
| Apache-2.0 OR BSL-1.0 OR MIT | 2 | – |
| Apache-2.0 OR ISC OR MIT | 2 | – |
| Apache-2.0 OR LGPL-2.1-or-later OR MIT | 2 | – |
| BSD-2-Clause | – | 2 |
| CDLA-Permissive-2.0 | 2 | – |
| MPL-2.0 | – | 2 |
| Zlib | 2 | – |
| (Apache-2.0 OR MIT) AND BSD-3-Clause | 1 | – |
| 0BSD OR Apache-2.0 OR MIT | 1 | – |
| Apache-2.0 AND ISC | 1 | – |
| Apache-2.0 OR BSL-1.0 | 1 | – |
| BlueOak-1.0.0 | – | 1 |
| CC-BY-4.0 | – | 1 |
| MIT AND BSD-3-Clause | 1 | – |
| MIT-0 | – | 1 |
| Unlicense | – | 1 |
| Total | 321 | 307 |
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.
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.