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

# Server Commands

> Reference for the meepachat server binary

The `meepachat` binary manages the server lifecycle, infrastructure services, and self-updates.

<Note>
  These are commands for the **server binary** (`meepachat`). For the **client CLI** used to interact with a running instance, see [CLI Quickstart](/meepachat/cli/quickstart).
</Note>

## init

Set up MeepaChat infrastructure with Docker. Starts Postgres, Redis, and MinIO, bootstraps authentication, and writes a config to `~/.meepachat/config.yaml`.

```bash theme={null}
meepachat init
```

Run this once after installing. It requires Docker and Docker Compose v2.

### What it does

1. Checks that Docker and Docker Compose v2 are available
2. Writes a Docker Compose file to `~/.meepachat/`
3. Starts infrastructure services (Postgres, Redis, MinIO)
4. Bootstraps authentication
5. Writes a complete config to `~/.meepachat/config.yaml`

### Flags

| Flag           | Description                                  |
| -------------- | -------------------------------------------- |
| `--yes`, `-y`  | Skip prompts, use defaults (non-interactive) |
| `--help`, `-h` | Show help                                    |

### Use existing infrastructure

Set environment variables before running `init` to skip specific Docker containers:

| Variable        | Description                                        |
| --------------- | -------------------------------------------------- |
| `DATABASE_URL`  | Postgres connection string (skips Docker Postgres) |
| `REDIS_URL`     | Redis connection string (skips Docker Redis)       |
| `S3_ENDPOINT`   | S3-compatible endpoint (skips Docker MinIO)        |
| `S3_ACCESS_KEY` | S3 access key                                      |
| `S3_SECRET_KEY` | S3 secret key                                      |
| `S3_BUCKET`     | S3 bucket name                                     |

```bash theme={null}
# Use your own Postgres; Docker handles Redis and MinIO
DATABASE_URL=postgres://user:pass@myhost:5432/mydb meepachat init

# Use Cloudflare R2 for storage
S3_ENDPOINT=your-account.r2.cloudflarestorage.com \
S3_ACCESS_KEY=xxx S3_SECRET_KEY=yyy S3_BUCKET=meepachat \
meepachat init
```

### Port overrides

MeepaChat uses non-default ports for infrastructure to avoid conflicts with local services:

| Variable               | Default | Description   |
| ---------------------- | ------- | ------------- |
| `MEEPACHAT_DB_PORT`    | 5433    | Postgres port |
| `MEEPACHAT_REDIS_PORT` | 6380    | Redis port    |
| `MEEPACHAT_MINIO_PORT` | 9010    | MinIO port    |

### Data directory

Config and compose files are stored in `~/.meepachat/` by default:

```bash theme={null}
MEEPACHAT_DATA_DIR=/opt/meepachat meepachat init
```

***

## start

Start the MeepaChat server. Forks to the background by default.

```bash theme={null}
meepachat start
```

If infrastructure services are configured but not running, `start` brings them up first. The command polls the health endpoint and exits once the server is ready.

### Flags

| Flag                 | Description                               |
| -------------------- | ----------------------------------------- |
| `--foreground`, `-f` | Run in foreground (for systemd or Docker) |
| `--port N`           | Override the HTTP port                    |
| `--bind ADDR`        | Override the bind address                 |

```bash theme={null}
# Run in foreground (systemd unit)
meepachat start --foreground

# Custom port
meepachat start --port 9000

# Bind to localhost only
meepachat start --bind 127.0.0.1
```

Server logs are written to `~/.meepachat/server.log` when running in background mode.

***

## stop

Stop all services.

```bash theme={null}
meepachat stop
```

***

## restart

Restart the server process.

```bash theme={null}
meepachat restart
```

***

## status

Show server status and infrastructure service health.

```bash theme={null}
meepachat status
```

```
Server: running (PID 12345)
App:    http://localhost:8091
Logs:   /home/user/.meepachat/server.log

SERVICE                   STATE        STATUS
meepachat-db              running      Up 2 hours (healthy)
meepachat-redis           running      Up 2 hours
meepachat-minio           running      Up 2 hours (healthy)
```

***

## logs

Show logs for infrastructure services (Postgres, Redis, MinIO). Server application logs are written to `~/.meepachat/server.log`.

```bash theme={null}
meepachat logs           # all infrastructure services
meepachat logs db        # specific service
```

***

## reset

Stop all services and remove infrastructure. Prompts for confirmation unless `--yes` is passed.

```bash theme={null}
meepachat reset
meepachat reset --yes            # skip confirmation
meepachat reset --yes --hard     # full wipe including all data volumes
```

| Flag          | Description                                       |
| ------------- | ------------------------------------------------- |
| `--yes`, `-y` | Skip confirmation prompt                          |
| `--hard`      | Full wipe: remove all data volumes (irreversible) |

<Warning>
  `--hard` permanently deletes all data including the database. There is no undo.
</Warning>

***

## update

Check for updates and self-update the binary.

```bash theme={null}
meepachat update
```

* If installed via **Homebrew**, prints `brew upgrade bogpad/tap/meepachat` instructions instead of updating in place
* Otherwise, downloads the latest release from GitHub and replaces the binary in place
* Falls back to `sudo` if the binary is in a protected path (e.g. `/usr/local/bin`)

Auto-update can also be enabled in config to update automatically every 6 hours. See [Auto-Update](/meepachat/self-hosting/configuration#auto-update).

***

## version

Print version, commit hash, and build date.

```bash theme={null}
meepachat version
```

```
meepachat v0.1.1 (abc1234) built 2026-02-14T00:00:00Z
```

Also available as `meepachat --version` or `meepachat -v`.
