A single-container API gateway for Home Assistant that allows limited, audited actions without exposing a long-lived access token.
- API key based public action calls
- Role-based access control (RBAC)
- Audit log storage and query
- Admin dashboard with session login
- Single-container deployment
Placeholder image. Replace this file with a real screenshot when ready.
- Install dependencies.
npm install- Configure environment variables for the server in
packages/server/.env.
PORT=8080
DATABASE_URL="file:./prisma/dev.db"
HA_BASE_URL="http://homeassistant.local:8123"
HA_TOKEN="YOUR_HA_LONG_LIVED_TOKEN"
ADMIN_PASSWORD="change-this-password"
ADMIN_SESSION_SECRET="base64-32bytes-minimum"
API_KEY_HASH_SECRET="change-this-secret"
CORS_ORIGIN="http://localhost:5173"- Initialize the database.
npm run prisma:generate
npm run prisma:migrate- Start the dev servers.
npm run devAdmin UI: http://localhost:5173 API: http://localhost:8080
ADMIN_SESSION_SECRETmust be a base64 string of at least 32 bytes. Example:openssl rand -base64 32.API_KEY_HASH_SECRETshould be a strong, random secret.HA_TOKENis a Home Assistant long-lived access token. Keep it private.
docker build -t ha-gatekeeper .
docker run -p 8080:8080 \
-e PORT=8080 \
-e DATABASE_URL="file:/data/dev.db" \
-e HA_BASE_URL="http://homeassistant.local:8123" \
-e HA_TOKEN="YOUR_HA_LONG_LIVED_TOKEN" \
-e ADMIN_PASSWORD="change-this-password" \
-e ADMIN_SESSION_SECRET="base64-32bytes-minimum" \
-e API_KEY_HASH_SECRET="change-this-secret" \
-v $(pwd)/data:/data \
ha-gatekeeperPOST /v1/actions/:actionId
- Header:
X-API-Key - Response: execution summary only (no internal Home Assistant data exposure)
POST /admin/loginPOST /admin/logoutGET /admin/rolesPOST /admin/rolesGET /admin/actionsPOST /admin/actionsGET /admin/clientsPOST /admin/clientsPOST /admin/clients/:id/rotate-keyGET /admin/audit-logs
Please read CONTRIBUTING.md for setup, workflow, and PR guidelines. By participating, you agree to the CODE_OF_CONDUCT.md.
See SECURITY.md for reporting vulnerabilities.
Licensed under the MIT License. See LICENSE.
