logo
icon

LobeChat Database Version

LobeChat with Server-Side Database.

template cover
Deployed325 times
PublisherMichaelYuhe
Created2024-08-06
Services
service icon
service icon
service icon
service icon
Tags
ChatGPTWebsiteAI

LobeChat Database Version

LobeChat is an open-source, high-performance chatbot framework that offers flexibility in its database setup.

By default, LobeChat utilizes a client-side database (IndexedDB) for data storage. However, for users requiring more robust data management or scalability, LobeChat also supports deploying a server-side database solution.

In this server-side configuration, LobeChat leverages PostgreSQL as its backend storage database. PostgreSQL is a powerful, open-source object-relational database system with over 30 years of active development. It has earned a strong reputation for reliability, feature robustness, and performance.

This comprehensive guide will walk you through the process and principles of deploying the server-side database version of LobeChat on Zeabur, a modern cloud platform designed for easy deployment and scaling of web applications.

Tech Stack

The template on Zeabur will automatically setup your object storage with MinIO, so that you do not have to do any configuration. Besides, this template use pgvector as the database to empower for the vector similarity search.

This template have included a self-hosted Logto as authentication provider, and you don't have to register anotehr account on Auth0 or Clerk for authentication. When deploying this template, you should be asked for filling the Logto Console and API domain. The Console one is for admin management, and the API one is for users to make authentication.

Post-Deployment Setup

Step 1: Wait Logto service to be started. After Logto has been started, create your administrator account by visiting the console domain.

Step 2: Register your Lobe Chat application in “Application”. Select “Next.js (App Router)” as the framework.

Step 3: Fill "Lobe Chat" in the Application Name field.

Step 4: Scroll down, and you will see the “Redirect URI” and “Post sign-out redirect URI” fields. For both fields, input the following:

  • Redirect URI: https://<your_lobechat_domain.zeabur.app>/api/auth/callback/logto
  • Post sign-out redirect URI: https://<your_lobechat_domain.zeabur.app>

Logto Application Setup

Step 5: After you have completed the setup, you will receive a Client ID and Client Secret. Create the following environment variables in your LobeChat service:

  • AUTH_LOGTO_ID: Your Logto client ID
  • AUTH_LOGTO_SECRET: Your Logto client secret

Logto client ID and secret retrieval

Step 6: Restart your LobeChat service. All done!i

Note that you might want to update the NEXT_AUTH_SECRET to improve the security of your application. You can generate one with:

openssl rand -base64 32