Skip to content

Guide

A headless CMS on PostgreSQL

Run LyEve, a self-hosted headless CMS, on PostgreSQL. Create a role that owns its database, then start the engine with one connection string.

On this page

On PostgreSQL, LyEve needs one role and one database that the role owns. Create the two, start the engine with one connection string, and it waits for you to create your admin account.

You work in PostgreSQL and Docker for steps 1 and 2. Step 3 and the next step come in two versions, LyEve Console and the engine's API from a terminal. Choosing one switches every such step on the page to it.

Before you start on PostgreSQL

  • Docker, to run the engine image.
  • PostgreSQL reachable from the engine's container, with TLS turned on unless the two share a private network. We ran every step below on PostgreSQL 16, 17 and 18 on November 11, 2026, with the LyEve engine v0.62.0 and admin console v0.28.0.
  • A role that may create roles and databases, such as postgres. You use it once. The engine signs in as a role of its own.

For managed PostgreSQL, the docs have setup pages for Supabase and Neon. To run PostgreSQL in Docker beside the engine and the console instead, the VPS guide has one Compose file for all of them.

1. Create a role and a database it owns

Run these statements as your admin role:

SQL
CREATE USER lyeve WITH PASSWORD '<password>';
CREATE DATABASE lyeve OWNER lyeve;

The lyeve role has to own the database, because the engine creates its tables when it starts. A role that holds privileges on a database it does not own is refused, as the failures below show.

2. Start the engine

Shell
docker run -d --name lyeve-engine \
  -e APP_ENV=development \
  -e DATABASE_URL="postgres://lyeve:<password>@db.example.com:5432/lyeve?sslmode=require" \
  -e JWT_SECRET="$(openssl rand -hex 32)" \
  -e ENCRYPTION_KEY="$(openssl rand -hex 32)" \
  -p 3001:3001 -p 3002:3002 \
  ghcr.io/lyeve-labs/lyeve-core:latest

sslmode=require keeps the connection encrypted. A production engine started with sslmode=disable logs this line at every start:

JSON
{"time":"2026-11-06T06:26:43.204876627Z","level":"WARN","msg":"production config","warning":"DATABASE_URL sets sslmode=disable, so the connection can run without TLS - set sslmode=require or sslmode=verify-full unless the database is on a private network"}

With APP_ENV=development, as in the command above, the engine starts on sslmode=disable without that line.

Port 3001 serves the Admin API and port 3002 the Content API. APP_ENV=development lets a test install start without the production settings. Before you go live, remove it and work through the production checklist.

3. Check that it worked

Console v0.28.0

The console is a second image. A small proxy in front puts the console and the engine's two APIs on one address. Give the engine a network that the proxy and the console share:

Shell
docker network create lyeve-console
docker network connect lyeve-console lyeve-engine

Save this as Caddyfile in the current directory:

:8080 {
  handle /api/admin/* {
    reverse_proxy lyeve-engine:3001
  }
  handle /api/* {
    reverse_proxy lyeve-engine:3002
  }
  handle /.well-known/* {
    reverse_proxy lyeve-engine:3002
  }
  handle {
    reverse_proxy lyeve-console:3002
  }
}

Start the proxy and the console:

Shell
docker run -d --name lyeve-proxy --network lyeve-console \
  -p 8080:8080 -v "$PWD/Caddyfile:/etc/caddy/Caddyfile:ro" \
  caddy:2

docker run -d --name lyeve-console --network lyeve-console \
  -e ORIGIN=http://localhost:8080 \
  -e CORE_INTERNAL_URL=http://lyeve-proxy:8080 \
  -e CORE_API_INTERNAL_URL=http://lyeve-proxy:8080 \
  ghcr.io/lyeve-labs/lyeve-console:latest

ORIGIN is the address you open in the browser. The two CORE_ addresses are where the console's own server reaches the engine, through the proxy. Run the engine and the console together explains the rest of the wiring.

Open http://localhost:8080. A new install sends you to the setup page. Its form opens with The engine is configured and its database is reachable. The engine has created its tables in PostgreSQL and waits for its first administrator.

The console's setup page, with a note that the engine is configured and its database is reachable, and empty fields for the setup token, an email, a password and its confirmation. The setup page on a new install.

When this path fails:

The setup page says Could not reach the engine

The engine is still creating its tables, or the proxy cannot find it. The page checks again every few seconds and goes on once the engine answers. If the message stays, check that the engine is running, then run the docker network connect line above again:

Shell
docker ps --filter name=lyeve-engine
docker network connect lyeve-console lyeve-engine

When the engine is already on that network, Docker answers that the endpoint already exists, and the network is not the problem. docker logs lyeve-engine then shows what the engine is doing.

Setup answers Cross-site POST form submissions are forbidden

The address in the browser differs from ORIGIN. Open http://localhost:8080 exactly. 127.0.0.1 is a different address to the console, even on the same machine.

Engine API v0.62.0

Ask the engine whether it is ready for its admin account:

Shell
curl http://localhost:3001/api/admin/setup
JSON
{"setup_required":true,"token_source":"log"}

If curl cannot connect yet, the engine is still creating its tables. Wait and run it again.

When the engine cannot use the database

These happen when the engine starts, whichever way you check it.

permission denied for schema public, and the engine exits

The lyeve role does not own the database. As your admin role, run this and start the engine again:

SQL
ALTER DATABASE lyeve OWNER TO lyeve;
tls error: server refused TLS connection

The server does not offer TLS. Turn TLS on in PostgreSQL, or use sslmode=disable when the engine and the database share a private network.

hostname resolving error, and the engine exits

The engine stops when it cannot reach the database at start. Check the host name, and start the database before the engine.

A production engine refuses to start as postgres

Without APP_ENV=development, the engine refuses the server's default superuser, and the log says the URL uses default credentials. Use the role from step 1.

What you get

You get the same engine, API and the console that run on MySQL 8.0 or 8.4 and on SQL Server 2019 or later, Azure SQL included. The MySQL and SQL Server guides have the same steps for those databases. We sent the same requests to all three, from the setup check to writing and listing an entry, and got the same answers. 32 of the 52 plugins in the image start with no license key, and licensing and tiers lists what runs free.

The console dashboard on a new install, before any content type exists, with a button to create the first one. The dashboard you reach after creating your admin account.

One difference favors PostgreSQL. Full-text Search, an add-on at $8 a month that every plan from Pro includes, searches tags as well as titles and bodies here. On MySQL and SQL Server it matches titles and bodies.

Next: your admin account and first entry

Console v0.28.0

Create your admin account on the setup page from step 3. The engine prints the setup token to its standard error, outside its log, and docker logs shows it:

Shell
docker logs lyeve-engine 2>&1 | grep -oE 'setup_token=[0-9a-f]+' | tail -n 1

It prints setup_token= and the token. Paste the part after setup_token=, enter an email and a password, and select Create super admin account. The console opens its dashboard. Run the engine and the console together goes on from there to a first content type and entry.

Engine API v0.62.0

Create your admin account and write an entry with step 2 of the quickstart.