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

# Self-Hosting

> Deploy LifyGo on your own server

# Self-Hosting

LifyGo can be deployed on any Linux server capable of running Docker.

A small VPS (such as a DigitalOcean Droplet or Hetzner Cloud instance) is sufficient for most deployments.

***

## Prerequisites

* Ubuntu 22.04 or newer
* Docker
* Docker Compose
* A domain name pointing to your server
* An SMTP account (Gmail, Zoho, or another provider)

***

## 1. Clone the Repository

```bash theme={null}
git clone https://github.com/lifygo/lifygo.git
cd lifygo
```

***

## 2. Configure the Environment

```bash theme={null}
cp apps/api/.env.example apps/api/.env
```

Update the `.env` file with your configuration.

At minimum:

```env theme={null}
AUTH_PROVIDER=local
JWT_SECRET=a-long-random-string
DATABASE_URL=postgres://lifygo:yourpassword@localhost:5432/lifygo?sslmode=disable
REDIS_URL=redis://localhost:6379
ENCRYPTION_KEY=$(openssl rand -hex 32)
```

***

## 3. Start Infrastructure

```bash theme={null}
docker compose -f infra/docker/docker-compose.yml up -d
```

***

## 4. Run Database Migrations

```bash theme={null}
cd apps/api

migrate \
  -path migrations \
  -database "postgres://lifygo:yourpassword@localhost:5432/lifygo?sslmode=disable" \
  up
```

***

## 5. Configure Nginx

A sample Nginx configuration is available in:

```text theme={null}
infra/nginx/
```

The configuration:

* Proxies requests to the API
* Proxies requests to the dashboard
* Supports HTTPS with Let's Encrypt

***

## 6. Access the Dashboard

Open your browser and visit:

```text theme={null}
https://your-domain.com
```

Sign in and configure your SMTP settings.

***

## Maintenance

To keep your deployment healthy:

* Regularly back up your PostgreSQL database.
* Keep your `ENCRYPTION_KEY` safe. Without it, encrypted SMTP passwords cannot be recovered.
* Pull the latest repository changes and restart your Docker containers when updating LifyGo.
