> ## Documentation Index
> Fetch the complete documentation index at: https://docs.socketchat.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Host a server

> The ways to run a Socketchat server, and how to pick one.

> [!NOTE]
>
> New to this? Read [How Socketchat works](/how-it-works) first.

A Socketchat server is one program, `socketchat server`, with its data in one folder. It runs on a cloud server, a computer at home that stays on, or a small device such as a Raspberry Pi 4. The hard part is reachability: your friends' apps must be able to connect to it on TCP port 7444.

## Pick a way

| Way | Who can reach you | Cost | Effort | What your friends need |
| - | - | - | - | - |
| [Same Wi-Fi](/hosting/local-network) | People on your home or office network | Free | Lowest | To be on the same network |
| [Port forwarding](/hosting/port-forwarding) | Anyone on the internet | Free | Medium: router settings | Nothing extra |
| [Cloud server](/hosting/cloud-server) | Anyone on the internet | A small monthly fee | Medium: a Linux machine and a domain | Nothing extra |
| [Private network (VPN): Tailscale or WireGuard](/hosting/vpn/overview) | Only people you add to the private network | Tailscale: free for personal use. WireGuard: free, plus a cloud server if you use one | Tailscale: low. WireGuard: medium, config files | The Tailscale or WireGuard app |

Some quick guidance:

* **Trying it out with a friend nearby?** Use [Same Wi-Fi](/hosting/local-network).
* **Friends anywhere, and a computer at home that stays on?** Use [Port forwarding](/hosting/port-forwarding), if your internet provider allows it.
* **Friends anywhere, and you want it always on?** Use a [Cloud server](/hosting/cloud-server).
* **Friends anywhere, and nothing open to the internet?** Use a [private network](/hosting/vpn/overview): Tailscale for the quickest setup, WireGuard for no accounts and no outside service.
* **Your internet provider shares one public address among many homes (CGNAT)?** Port forwarding cannot work there. Use [Tailscale](/hosting/vpn/tailscale) or a cloud server.

A ready-made server you can buy from socketchat.org is planned. See [Hosted by Socketchat](/hosting/hosted-by-socketchat).

## What every way has in common

`--host` in `socketchat server init` is the name or IP address your friends will dial. Invite links carry it, so pick it before you invite anyone:

```bash theme={"dark"}
socketchat server init --host <address>
```

The address must be a host name or an IP address. A host name uses letters, digits, hyphens, underscores and dots. Write a name in another alphabet in its `xn--` form (punycode), as DNS stores it.

> [!WARNING]
>
> `init` makes the server's certificate, and every invite link and every member's app remembers its fingerprint. Back up the data folder once the server works. If you lose the certificate and run `init` again, everyone has to accept a new one. See [Server settings and backups](/hosting/server-settings#back-up).

Pick an address that stays the same. Each member's app keeps dialing the address from the link it joined with, and the links it makes for others carry that same address. `public_host` in the server's config file sets the address in new `socketchat server invite` links, but it does not move people who already joined. That is why the pages below show how to keep a fixed local address, a fixed name that follows a changing home IP, or a domain name.

## Running the server

```bash theme={"dark"}
socketchat server run
socketchat server invite
```

`run` keeps going until you press Ctrl-C. `invite` prints a one-time link that registers one new person, and works while the server runs. To keep a server running after you log out, run it as a service; the [cloud server page](/hosting/cloud-server#run-it-as-a-service) has a systemd unit for Linux.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.