Installation
This guide covers deploying Lektr using Docker, the recommended method for self-hosting.
Prerequisites
- Docker and Docker Compose v2+
- At least 2GB RAM recommended
Quick Start with Docker
- Create a project directory
mkdir lektr && cd lektr
- Download the Docker Compose file
curl -O https://raw.githubusercontent.com/lektr/lektr/main/docker-compose.yml
Alternatively, clone the full repository if you want access to all configuration files:
git clone https://github.com/lektr/lektr.git
cd lektr
- Configure environment (optional but recommended for production)
Create a .env file in the same directory:
# Security - REQUIRED for production!
# Generate with: openssl rand -base64 32
JWT_SECRET=your-very-long-secret-key-at-least-32-chars
ADMIN_EMAIL=your@email.com
ADMIN_PASSWORD=your-secure-password
# Database (defaults are fine for most setups)
POSTGRES_PASSWORD=your-secure-db-password
# Optional
HARDCOVER_API_KEY=your-hardcover-api-key # For book metadata
LEKTR_PORT=80 # Change if port 80 is in use
- Start the services
docker compose up -d
- Access Lektr
- Web UI: http://localhost (or your configured port)
- Default admin:
admin@lektr.local/admin123
Change the default admin password immediately after first login!
Architecture
Lektr runs as two containers:
| Container | Description |
|---|---|
lektr_app | Combined app (API + UI + Nginx) from Docker Hub |
lektr_db | PostgreSQL with pgvector for vector search |
The database is not exposed externally for security. All communication happens over Docker's internal network.
Updating
To update to the latest version:
docker compose pull
docker compose up -d
Configuration
See Environment Variables for all available options.
Key Production Settings
| Variable | Purpose |
|---|---|
JWT_SECRET | Required - Session token encryption |
POSTGRES_PASSWORD | Database security |
ADMIN_EMAIL / ADMIN_PASSWORD | Initial admin account |
CORS_ORIGINS | Allowed origins for API access |
Reverse Proxy Setup
If you're running Lektr behind your own reverse proxy (Nginx, Traefik, Caddy), configure it to proxy to the Lektr container on port 80.
Nginx Example
server {
listen 80;
server_name lektr.example.com;
location / {
proxy_pass http://localhost:80; # Or your LEKTR_PORT
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Traefik Labels (Docker Compose)
labels:
- "traefik.enable=true"
- "traefik.http.routers.lektr.rule=Host(`lektr.example.com`)"
- "traefik.http.services.lektr.loadbalancer.server.port=80"
Set APP_URL in your .env to your public URL for correct email links.
Troubleshooting
Database connection issues
Check database logs:
docker compose logs db
API not responding
Check app logs:
docker compose logs app
Container won't start
View detailed startup logs:
docker compose up # Without -d to see live output