At home with Connect

Run the server at home with no domain and no certificate: the gate on UDP 4433, setup over localhost, listing on Flaq Connect, and invite links that decide who learns your address.

5 min read

A server at home needs no domain, no certificate and no reverse proxy. It lists itself on Flaq Connect, a directory that helps the apps find it, and you share an invite link. The apps then connect to the server directly, through a forwarded port, IPv6, or by punching through both sides' routers. No message passes through Connect. This guide assumes you have downloaded and configured the server as in Install the server.

How it works#

The server's image includes the gate, a small program that serves the apps over UDP port 4433. It does nothing until you turn on Flaq Connect in the admin console. Then it keeps a connection open to each Connect it is listed on, and publishes a record there signed with the server's own key. The record holds the server's id and name, never its address.

When someone opens an invite link, their app asks the server, through Connect, for the ways in, and proves with the link's secret that it may. The question and the answer are sealed between the app and the server, so Connect can't read them. The app then connects to the server, and checks that it holds the key it expects.

1. Edit the compose file#

Nothing goes in front of the server, and there is no HTTPS to set up: the apps reach it over the gate, which runs inside the same container. Make two edits to docker-compose.yml:

  1. Keep the admin pages off the network, since they are served over plain HTTP here: change "8105:8000" to "127.0.0.1:8105:8000".
  2. Let the apps in: uncomment the line - "4433:4433/udp".

Then start it:

docker compose up -d

2. Open the setup page over localhost#

Browsers only let the setup page work on HTTPS or localhost, so open it as localhost: on the server itself at http://localhost:8105, or from your own computer through an SSH tunnel:

ssh -L 8105:localhost:8105 you@home-server     # then open http://localhost:8105

Use the same tunnel whenever you open the admin console later. The setup wizard creates the admin account and the first channels; see Install the server.

3. Open the router#

On the router, forward UDP port 4433 to the server. It is the most reliable way in.

Without it, the apps punch through the router instead. That works with most home routers, but not when both sides are behind the strictest kind, which give every destination a different outside port. Phone networks often are. With a relay, nothing needs forwarding.

The gate can also ask a router to open the port by itself (UPnP), but only from the host's own network. In Docker's default network it can't reach the router, so forward UDP 4433 on the router, or run the container with network_mode: host.

4. List the server#

In the admin console, open Flaq Connect and tick List this server on Flaq Connect. Changes on this page save as you make them.

Within half a minute, Status shows connect.flaq.dev as Listed, and which ways in it could check. The invite link is then ready to share, with Copy beside it.

Setting What it does
Name A name on the Connect, which makes the link short enough to say aloud: https://connect.flaq.dev/anas-place#k=…. 3 to 32 lower-case letters, digits and single hyphens. First come, first served, and it belongs to your server's key, so nobody can take it from under you
Contact An optional contact for the Connect's operator
Who can find it People with an invite link, or Anyone who knows its name or id. A public server admits anyone who asks, so anyone who knows its name learns its address
Connects The Connects it is listed on, one per line. A new listing starts with connect.flaq.dev. Add your own Connect here, and its invite links lead there

A name also gives your server's accounts their handles, such as @ana@anas-place.connect.flaq.dev. Without a name, your accounts can't be used on other servers. See Accounts across servers.

People paste the invite link into the app, or open it in a browser, where it opens the app or offers the download. The part after # is the secret that admits them. A browser never sends it to Connect.

Reset makes a new link and stops every link given out so far. The link also changes by itself whenever someone is deactivated. People already signed in keep reaching the server: each signed-in app gets a secret of its own, which ends when that app signs out or the person is deactivated.

Who learns your address#

Who Learns the server's IP address?
Someone with only the server's name or id No, unless the server is public
Someone with a current invite link, and the server's members Yes, unless the server uses a relay
A removed member, or someone with a reset invite link Only what they learned before, not a new address
Connect Yes, while the server is connected to it, in memory only. The relay's address instead when the server uses one
A relay's operator Yes, for the servers using that relay

Connect never writes a server's address to its database or its logs. It does learn which server ids exist, when each server is online, and which app addresses ask for which server, and when.

Addresses on your own network are never published. An app on the same network finds the server there directly, so it opens at home without the internet.

To keep the address from members too, send everything through a relay: see Run a relay.

If it doesn't work#

  • Status stays at Connecting, or shows Failed. The server can't reach the Connect over UDP: an outgoing firewall that allows only TCP, or a mistyped host under Connects. Failed gives the reason beside the host.
  • "The gate isn't running". The container was started with FLAQ_GATE=0.
  • Listed, but no way in was checked. UDP 4433 isn't forwarded to the server, or a firewall on the machine drops it.
  • The invite link opens in the browser but the app can't join. The server is offline (the app says so), or no way in works from where the app is.

More in Troubleshooting.