Self-Hosting
Run the full Apikee platform on your own server in minutes with a single setup script.
Self-Hosting
Run Postgres, MongoDB, MinIO, and the Apikee platform on any Linux server — no cloud account required.
The setup script handles Docker installation, secret generation, and first-run configuration automatically. On a fresh server it takes under 5 minutes.
One-liner install
curl -fsSL https://get.apikee.com/setup.sh | sudo bashThe script is idempotent — re-running it on an existing install is safe.
What the script does
Detect your OS
Supports Ubuntu 20.04+, Debian 11+, RHEL / Rocky / AlmaLinux 8+, and Fedora 38+. Exits early with a clear message on unsupported systems.
Install Docker and Docker Compose
Adds the official Docker apt/yum repository and installs:
docker-ce,docker-ce-cli,containerd.iodocker-buildx-plugin,docker-compose-plugin
Skipped silently if Docker is already present.
Configure the environment
Creates /opt/apikee/.env from the upstream template, then auto-generates:
| Variable | How it's set |
|---|---|
APIKEE_SECRET | openssl rand -hex 32 |
POSTGRES_PASSWORD | openssl rand -base64 18 |
MONGO_PASSWORD | openssl rand -base64 18 |
MINIO_SECRET_KEY | openssl rand -base64 18 |
You are prompted for your domain / IP and, optionally, an admin account to seed on first start.
Start the stack
docker compose -f /opt/apikee/docker-compose.yml --env-file /opt/apikee/.env up -dServices started: postgres, mongo, minio, api (Apikee).
Manual setup
If you prefer to configure everything yourself:
# 1. Create the install directory
mkdir -p /opt/apikee && cd /opt/apikee
# 2. Download the compose file and env template
curl -fsSL https://raw.githubusercontent.com/apikee-dev/apikee/main/docker-compose.yml -o docker-compose.yml
curl -fsSL https://raw.githubusercontent.com/apikee-dev/apikee/main/.env.example -o .env
# 3. Fill in the required values
# At minimum: APIKEE_SECRET, POSTGRES_PASSWORD, MONGO_PASSWORD, MINIO_SECRET_KEY, APP_URL
nano .env
# 4. Generate a signing secret (paste into .env)
openssl rand -hex 32
# 5. Start
docker compose up -dEnvironment reference
| Variable | Required | Description |
|---|---|---|
APP_URL | ✓ | Public URL, e.g. https://apikee.yourco.com |
APIKEE_SECRET | ✓ | HMAC signing key — keep this secret |
POSTGRES_PASSWORD | ✓ | Internal Postgres password |
MONGO_PASSWORD | ✓ | Internal MongoDB password |
MINIO_SECRET_KEY | ✓ | MinIO root password |
ADMIN_EMAIL | — | Seeds an admin account on first start |
ADMIN_PASSWORD | — | Password for the admin account above |
SETUP_COMPLETE | — | Set true to skip the setup wizard |
PORT | — | Host port (default 4321) |
SMTP_HOST | — | SMTP server for email notifications |
APIKEE_PREMIUM | — | License key for AI features |
Port
Apikee runs on port 4321 by default. To change it, set PORT in your .env:
PORT=8080The port mapping in docker-compose.yml reads this value automatically.
Updating
cd /opt/apikee
docker compose pull
docker compose up -dDatabase migrations run automatically on container startup — no manual steps needed.
Useful commands
# View logs (all services)
docker compose -C /opt/apikee logs -f
# View logs (Apikee only)
docker compose -C /opt/apikee logs -f api
# Stop the stack
docker compose -C /opt/apikee down
# Stop and remove all data (destructive)
docker compose -C /opt/apikee down -vdown -v removes all database volumes. Back up your data first.
Backups
Postgres and MongoDB data live in named Docker volumes (postgres_data, mongo_data).
Back them up with:
# Postgres
docker exec apikee-postgres-1 pg_dump -U apikee apikee | gzip > apikee-pg-$(date +%F).sql.gz
# MongoDB
docker exec apikee-mongo-1 mongodump --archive --gzip \
--username apikee --password "$MONGO_PASSWORD" \
| gzip > apikee-mongo-$(date +%F).archive.gzReverse proxy (nginx)
server {
listen 80;
server_name apikee.yourco.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name apikee.yourco.com;
ssl_certificate /etc/letsencrypt/live/apikee.yourco.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/apikee.yourco.com/privkey.pem;
location / {
proxy_pass http://127.0.0.1:4321;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
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;
}
}
