# Self-host Tinyauth

> A small login screen and forward-auth server that protects other apps behind your reverse proxy with username and password or OAuth. Runs on SQLite in one container. Users are set with a bcrypt hash in the install form.

- Page: https://levelrail.com/templates/tinyauth/
- JSON: https://levelrail.com/templates/tinyauth.json
- Category: Security
- Licence: AGPL-3.0 (Network copyleft (AGPL) license)
- Source: https://github.com/tinyauthapp/tinyauth
- Upstream docs: https://tinyauth.app/docs/getting-started

## Requirements
- Memory: about 64 MiB
- amd64: published, arm64: published
- Needs configuration before start: yes
- Pinned image tag: v5.2.0

## Services

| Service | Image | Tag | Ports | Volumes |
| --- | --- | --- | --- | --- |
| tinyauth | ghcr.io/tinyauthapp/tinyauth | v5.2.0 | 3000 | data -> /data |

## Environment

| Service | Variable | Kind |
| --- | --- | --- |
| tinyauth | TINYAUTH_ANALYTICS_ENABLED | preset |
| tinyauth | TINYAUTH_APPURL | preset |
| tinyauth | TINYAUTH_AUTH_SECURECOOKIE | preset |
| tinyauth | TINYAUTH_AUTH_USERS | required |

## Deploy

### CLI

```bash
levelrail-cli templates install tinyauth --name my-tinyauth --env TINYAUTH_USERS=VALUE
```

Add --domain SERVICE=HOST to serve a service on your own domain, for example --domain tinyauth=app.example.com.

### API

```bash
curl -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  https://levelrail.example.com/api/v1/service-templates/tinyauth/install \
  -d '{
    "name": "my-tinyauth",
    "env": { "TINYAUTH_USERS": "VALUE" }
  }'
```

Create a token in the dashboard first. Name, env and domains are the request fields.

## First run
1. Open the app address and sign in with the user you set in the install form.

## Questions

### Can I deploy Tinyauth on Dokploy or Dokku?

The services and pinned images on this page can be run on any Docker host. The public Dokploy templates list we compared does not have an entry with the same id for Tinyauth, so on Dokploy you would use a Docker Compose application with the file from this page. Dokku deploys container images with its own commands, so the pinned image ghcr.io/tinyauthapp/tinyauth:v5.2.0 is what you deploy there.

Self-host Tinyauth, Tinyauth docker compose file, deploy Tinyauth on a VPS: this page lists the pinned image, ports, volumes and the commands for each.
