A minimal, production-ready setup to self-host Typesense behind Caddy with automatic HTTPS, plus the Typesense Dashboard.
Reference guide: Now You Know How to Self-Host Typesense Using Docker and Caddy — The Easy Way
- Typesense API (internal port 8108)
- Typesense Dashboard UI (internal port 80)
- Caddy reverse proxy with automatic TLS for both services
- A VPS or server with Docker and the Docker Compose plugin
- DNS A records for your domains pointing to the server IP
dashboard.yourdomain.com
typesense-api.yourdomain.com
compose.yml
— definestypesense
,dashboard
, andcaddy
servicesCaddyfile
— routes public domains to the correct containers.env
— environment variables (you create this)
Create a .env
file in the project root:
TYPESENSE_API_KEY=YOUR_KEY
PUBLIC_PATH=/dashboard
TYPESENSE_HOST=typesense
TYPESENSE_PORT=8108
TYPESENSE_PROTOCOL=http
Notes:
TYPESENSE_API_KEY
is the admin key used by Typesense and the dashboard.- You can generate a new admin key after startup via the Typesense API if desired.
Create A records for your domains:
dashboard.yourdomain.com
→ your server IPtypesense-api.yourdomain.com
→ your server IP
Edit Caddyfile
and replace the example domains with yours:
# Route traffic for the dashboard
dashboard.yourdomain.com {
reverse_proxy dashboard:80
}
# Route traffic for the Typesense API
typesense-api.yourdomain.com {
reverse_proxy typesense:8108
}
From the project root:
docker compose -f compose.yml up -d
Verify containers:
docker ps
You should see typesense
, dashboard
, and caddy
running.
- Dashboard:
https://dashboard.yourdomain.com
- Typesense health:
https://typesense-api.yourdomain.com/health
(expect{ "ok": true }
)
In the dashboard “Connect” screen, use:
- Host:
typesense-api.yourdomain.com
- Port:
443
- Protocol:
https
- API Key: value from
TYPESENSE_API_KEY
- Path: leave empty
If you want to rotate or create a new admin key after startup, run (from your host):
curl 'http://localhost:8108/keys' \
-X POST \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
-H 'Content-Type: application/json' \
-d '{"description":"Admin key.","actions":["*"],"collections":["*"]}'
- Typesense data is stored in
./typesense-data
(mounted to/data
in the container). - The dashboard uses the
dashboard_data
volume. - Caddy state/config uses
caddy_data
andcaddy_config
volumes.
- View logs:
docker logs typesense
docker logs caddy
docker logs typesense-self-hosted-example-dashboard-1
(container name may vary)
- Restart services:
docker compose -f compose.yml restart
- Update images:
docker compose -f compose.yml pull && docker compose -f compose.yml up -d
- Keep your admin
TYPESENSE_API_KEY
secret and rotate periodically. - Use firewall rules to only expose ports 80/443 publicly.
- Regularly back up
./typesense-data
.