---
title: Deploy LobeHub with database on Dokploy
description: >-
  Learn how to deploy LobeHub with database on Dokploy with ease, including:
  database, authentication and S3 storage service.
tags:
  - Deploy LobeHub
  - Vercel Deployment
  - OpenAI API Key
  - Custom Domain Binding
---

# Deploying Server Database Version on Dokploy.

This article will detail how to deploy the server database version of LobeHub.

## 1. Preparation Work

### Deploy Dokploy and configure related settings.

```shell
curl -sSL https://dokploy.com/install.sh | sh
```

1. Connect your GitHub to Dokploy in the Settings / Git section according to the prompt.

![Connect GitHub to Dokploy](/blog/assets0f97d1dfccd5ba07172aff71ff9acd7b.webp)

2. Enter the Projects interface to create a Project.

![Create Project in Dokploy](/blog/assetsb26b68a4875a6510ddc202dd4b40d010.webp)

### Configure S3 Storage Service

In the server-side database, we need to configure the S3 storage service to store files. For detailed configuration instructions, please refer to the section [Configure S3 Storage Service](https://lobehub.com/docs/self-hosting/platform/vercel#3-configure-s-3-storage-service) in the Vercel deployment guide。After the configuration is complete, you will obtain the following environment variables:

```shell
S3_ACCESS_KEY_ID=
S3_SECRET_ACCESS_KEY=
S3_ENDPOINT=
S3_BUCKET=
S3_ENABLE_PATH_STYLE=
```

### Configure KEY\_VAULTS\_SECRET Environment Variable

`KEY_VAULTS_SECRET` is used to encrypt sensitive information such as API keys stored by users. Click the button below to generate:

<GenerateSecret envName="KEY_VAULTS_SECRET" />

### Configure authentication environment variables

Prepare the following authentication environment variables (powered by [Better Auth](https://www.better-auth.com)):

Click the button below to generate `AUTH_SECRET` (session encryption key):

<GenerateSecret envName="AUTH_SECRET" />

You also need to configure the `JWKS_KEY` environment variable for signing and verifying JWTs. Click the button below to generate:

<GenerateJWKSKey />

<Callout type={'info'}>
  For advanced features like SSO providers, magic link login, and email verification, see [Authentication Service](/docs/self-hosting/auth).
</Callout>

## 2. Deploying the database on Dokploy

Enter the previously created Project, click on Create Service, and select Database. In the Database interface, choose PostgreSQL, then set the database name, user, and password. In the Docker image field, enter `paradedb/paradedb:latest-pg17`, and finally click Create to create the database.

![Create PostgreSQL Database in Dokploy](/blog/assets7006b60baaf62aa0d95cd40456e24afe.webp)

Enter the created database and set an unused port in External Credentials to allow external access; otherwise, LobeHub will not be able to connect to the database. You can view the Postgres database connection URL in External Host, as shown below:

```shell
postgresql://postgres:wAbLxfXSwkxxxxxx@45.577.281.48:5432/postgres
```

Finally, click Deploy to deploy the database.

![Deploy Database in Dokploy](/blog/assets1b9283f9cc5fc5073ff9cffc24880e96.webp)

## Deploy LobeHub on Dokploy.

Click "Create Service", select "Application", and create the LobeHub application.

![Create LobeHub Application in Dokploy](/blog/assetsb33085e7553d2b7194005b102184553e.webp)

Enter the created LobeHub application, select the forked lobehub project and branch, and click Save to save.

![Select Repository and Branch in Dokploy](/blog/assetsf0ebf396dbe9559eb3478f48f648a6e2.webp)

Switch to the Environment section, fill in the environment variables, and click Save.

![Configure Environment Variables in Dokploy](/blog/assets6b67dabe7b9226cdff1bace5a3b8ab18.webp)

```shell
# Environment variables required for building
NIXPACKS_PKGS="bun"
NIXPACKS_INSTALL_CMD="pnpm install"
NIXPACKS_BUILD_CMD="NODE_OPTIONS='--max-old-space-size=8192' pnpm run build"
NIXPACKS_START_CMD="pnpm start"

APP_URL=

# Configuration related to Postgres database
DATABASE_DRIVER=node
DATABASE_URL=

# Use the values generated above
KEY_VAULTS_SECRET=
AUTH_SECRET=
JWKS_KEY=

# S3 related configuration
S3_ACCESS_KEY_ID=
S3_SECRET_ACCESS_KEY=
S3_ENDPOINT=
S3_BUCKET=
S3_ENABLE_PATH_STYLE=

```

After adding the environment variables and saving, click Deploy to initiate the deployment. You can check the deployment progress and log information under Deployments.

![Deploy LobeHub and View Progress](/blog/assets7c3eab218c0823fa353b1cd23afe21c3.webp)

After a successful deployment, bind your own domain to your LobeHub application and request a certificate on the Domains page.

![Bind Domain and Request Certificate](/blog/assetseebf66254337ce88357629c34e78c08d.webp)

## Check if LobeHub is working properly.

Go to your LobeHub website, and if you click on the login button in the upper left corner and the login pop-up appears normally, it means you have configured it successfully. Enjoy it to the fullest!

![LobeHub Login Success](/blog/assets11a8089b511aaa61e8982dea0a3665c5.webp)
