Repository: steveiliop56/tinyauth Branch: main Commit: d71a8e03cc4a Files: 209 Total size: 657.9 KB Directory structure: gitextract_u5ucyfy8/ ├── .coderabbit.yaml ├── .github/ │ ├── ISSUE_TEMPLATE/ │ │ ├── bug_report.md │ │ └── feature_request.md │ ├── dependabot.yml │ └── workflows/ │ ├── ci.yml │ ├── nightly.yml │ ├── release.yml │ ├── sponsors.yml │ └── stale.yml ├── .gitignore ├── .gitmodules ├── .vscode/ │ └── launch.json ├── .zed/ │ └── debug.json ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Dockerfile ├── Dockerfile.dev ├── Dockerfile.distroless ├── FUNDING.yml ├── LICENSE ├── Makefile ├── README.md ├── SECURITY.md ├── air.toml ├── assets/ │ ├── discohook.json │ └── logo.xcf ├── cmd/ │ └── tinyauth/ │ ├── create_oidc_client.go │ ├── create_user.go │ ├── generate_totp.go │ ├── healthcheck.go │ ├── tinyauth.go │ ├── verify_user.go │ └── version.go ├── codecov.yml ├── crowdin.yml ├── docker-compose.dev.yml ├── docker-compose.example.yml ├── frontend/ │ ├── .gitignore │ ├── .prettierignore │ ├── .prettierrc │ ├── Dockerfile.dev │ ├── components.json │ ├── eslint.config.js │ ├── index.html │ ├── package.json │ ├── public/ │ │ └── site.webmanifest │ ├── src/ │ │ ├── App.tsx │ │ ├── components/ │ │ │ ├── auth/ │ │ │ │ ├── login-form.tsx │ │ │ │ └── totp-form.tsx │ │ │ ├── domain-warning/ │ │ │ │ └── domain-warning.tsx │ │ │ ├── icons/ │ │ │ │ ├── github.tsx │ │ │ │ ├── google.tsx │ │ │ │ ├── microsoft.tsx │ │ │ │ ├── oauth.tsx │ │ │ │ ├── pocket-id.tsx │ │ │ │ └── tailscale.tsx │ │ │ ├── language/ │ │ │ │ └── language.tsx │ │ │ ├── layout/ │ │ │ │ └── layout.tsx │ │ │ ├── providers/ │ │ │ │ └── theme-provider.tsx │ │ │ ├── theme-toggle/ │ │ │ │ └── theme-toggle.tsx │ │ │ └── ui/ │ │ │ ├── button.tsx │ │ │ ├── card.tsx │ │ │ ├── dropdown-menu.tsx │ │ │ ├── form.tsx │ │ │ ├── input-otp.tsx │ │ │ ├── input.tsx │ │ │ ├── label.tsx │ │ │ ├── oauth-button.tsx │ │ │ ├── select.tsx │ │ │ ├── separator.tsx │ │ │ ├── sonner.tsx │ │ │ └── tooltip.tsx │ │ ├── context/ │ │ │ ├── app-context.tsx │ │ │ └── user-context.tsx │ │ ├── index.css │ │ ├── lib/ │ │ │ ├── hooks/ │ │ │ │ ├── oidc.ts │ │ │ │ └── redirect-uri.ts │ │ │ ├── i18n/ │ │ │ │ ├── i18n.ts │ │ │ │ ├── locales/ │ │ │ │ │ ├── af-ZA.json │ │ │ │ │ ├── ar-SA.json │ │ │ │ │ ├── ca-ES.json │ │ │ │ │ ├── cs-CZ.json │ │ │ │ │ ├── da-DK.json │ │ │ │ │ ├── de-DE.json │ │ │ │ │ ├── el-GR.json │ │ │ │ │ ├── en-US.json │ │ │ │ │ ├── en.json │ │ │ │ │ ├── es-ES.json │ │ │ │ │ ├── fi-FI.json │ │ │ │ │ ├── fr-FR.json │ │ │ │ │ ├── he-IL.json │ │ │ │ │ ├── hu-HU.json │ │ │ │ │ ├── it-IT.json │ │ │ │ │ ├── ja-JP.json │ │ │ │ │ ├── ko-KR.json │ │ │ │ │ ├── nl-NL.json │ │ │ │ │ ├── no-NO.json │ │ │ │ │ ├── pl-PL.json │ │ │ │ │ ├── pt-BR.json │ │ │ │ │ ├── pt-PT.json │ │ │ │ │ ├── ro-RO.json │ │ │ │ │ ├── ru-RU.json │ │ │ │ │ ├── sr-SP.json │ │ │ │ │ ├── sv-SE.json │ │ │ │ │ ├── tr-TR.json │ │ │ │ │ ├── uk-UA.json │ │ │ │ │ ├── vi-VN.json │ │ │ │ │ ├── zh-CN.json │ │ │ │ │ └── zh-TW.json │ │ │ │ └── locales.ts │ │ │ └── utils.ts │ │ ├── main.tsx │ │ ├── pages/ │ │ │ ├── authorize-page.tsx │ │ │ ├── continue-page.tsx │ │ │ ├── error-page.tsx │ │ │ ├── forgot-password-page.tsx │ │ │ ├── login-page.tsx │ │ │ ├── logout-page.tsx │ │ │ ├── not-found-page.tsx │ │ │ ├── totp-page.tsx │ │ │ └── unauthorized-page.tsx │ │ ├── schemas/ │ │ │ ├── app-context-schema.ts │ │ │ ├── login-schema.ts │ │ │ ├── oidc-schemas.ts │ │ │ ├── totp-schema.ts │ │ │ └── user-context-schema.ts │ │ └── vite-env.d.ts │ ├── tsconfig.app.json │ ├── tsconfig.json │ ├── tsconfig.node.json │ └── vite.config.ts ├── gen/ │ ├── gen.go │ ├── gen_env.go │ └── gen_md.go ├── go.mod ├── go.sum ├── internal/ │ ├── assets/ │ │ ├── assets.go │ │ └── migrations/ │ │ ├── 000001_init_sqlite.down.sql │ │ ├── 000001_init_sqlite.up.sql │ │ ├── 000002_oauth_name.down.sql │ │ ├── 000002_oauth_name.up.sql │ │ ├── 000003_oauth_sub.down.sql │ │ ├── 000003_oauth_sub.up.sql │ │ ├── 000004_created_at.down.sql │ │ ├── 000004_created_at.up.sql │ │ ├── 000005_oidc_session.down.sql │ │ ├── 000005_oidc_session.up.sql │ │ ├── 000006_oidc_nonce.down.sql │ │ └── 000006_oidc_nonce.up.sql │ ├── bootstrap/ │ │ ├── app_bootstrap.go │ │ ├── db_bootstrap.go │ │ ├── router_bootstrap.go │ │ └── service_bootstrap.go │ ├── config/ │ │ └── config.go │ ├── controller/ │ │ ├── context_controller.go │ │ ├── context_controller_test.go │ │ ├── health_controller.go │ │ ├── oauth_controller.go │ │ ├── oidc_controller.go │ │ ├── oidc_controller_test.go │ │ ├── proxy_controller.go │ │ ├── proxy_controller_test.go │ │ ├── resources_controller.go │ │ ├── resources_controller_test.go │ │ ├── user_controller.go │ │ ├── user_controller_test.go │ │ └── well_known_controller.go │ ├── middleware/ │ │ ├── context_middleware.go │ │ ├── ui_middleware.go │ │ └── zerolog_middleware.go │ ├── repository/ │ │ ├── db.go │ │ ├── models.go │ │ ├── oidc_queries.sql.go │ │ └── session_queries.sql.go │ ├── service/ │ │ ├── access_controls_service.go │ │ ├── auth_service.go │ │ ├── docker_service.go │ │ ├── generic_oauth_service.go │ │ ├── github_oauth_service.go │ │ ├── google_oauth_service.go │ │ ├── ldap_service.go │ │ ├── oauth_broker_service.go │ │ └── oidc_service.go │ └── utils/ │ ├── app_utils.go │ ├── app_utils_test.go │ ├── decoders/ │ │ ├── label_decoder.go │ │ └── label_decoder_test.go │ ├── fs_utils.go │ ├── fs_utils_test.go │ ├── label_utils.go │ ├── label_utils_test.go │ ├── loaders/ │ │ ├── loader_env.go │ │ ├── loader_file.go │ │ └── loader_flag.go │ ├── security_utils.go │ ├── security_utils_test.go │ ├── string_utils.go │ ├── string_utils_test.go │ ├── tlog/ │ │ ├── log_audit.go │ │ ├── log_wrapper.go │ │ └── log_wrapper_test.go │ ├── user_utils.go │ └── user_utils_test.go ├── patches/ │ └── nested_maps.diff ├── sql/ │ ├── oidc_queries.sql │ ├── oidc_schemas.sql │ ├── session_queries.sql │ └── session_schemas.sql └── sqlc.yml ================================================ FILE CONTENTS ================================================ ================================================ FILE: .coderabbit.yaml ================================================ issue_enrichment: auto_enrich: enabled: false ================================================ FILE: .github/ISSUE_TEMPLATE/bug_report.md ================================================ --- name: Bug report about: Create a report to help improve Tinyauth title: "[BUG]" labels: bug assignees: steveiliop56 --- **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' 4. See error **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Logs** Please include the Tinyauth logs below, make sure to not include sensitive info. **Device (please complete the following information):** - OS: [e.g. iOS] - Browser [e.g. chrome, safari] - Tinyauth [e.g. v2.1.1] - Docker [e.g. 27.3.1] ** **Additional context** Add any other context about the problem here. ================================================ FILE: .github/ISSUE_TEMPLATE/feature_request.md ================================================ --- name: Feature request about: Suggest an idea for this project title: "[FEATURE]" labels: enhancement assignees: steveiliop56 --- **Is your feature request related to a problem? Please describe.** A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] **Describe the solution you'd like** A clear and concise description of what you want to happen. **Describe alternatives you've considered** A clear and concise description of any alternative solutions or features you've considered. **Additional context** Add any other context or screenshots about the feature request here. ================================================ FILE: .github/dependabot.yml ================================================ version: 2 updates: - package-ecosystem: "bun" directory: "/frontend" groups: minor-patch: update-types: - "patch" - "minor" schedule: interval: "daily" - package-ecosystem: "gomod" directory: "/" groups: minor-patch: update-types: - "patch" - "minor" schedule: interval: "daily" - package-ecosystem: "docker" directory: "/" schedule: interval: "daily" ================================================ FILE: .github/workflows/ci.yml ================================================ name: Tinyauth CI on: push: branches: - main pull_request: jobs: ci: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Setup bun uses: oven-sh/setup-bun@v2 - name: Setup go uses: actions/setup-go@v5 with: go-version: "^1.24.0" - name: Initialize submodules run: | git submodule init git submodule update - name: Apply patches run: | git apply --directory paerser/ patches/nested_maps.diff - name: Install frontend dependencies run: | cd frontend bun install --frozen-lockfile - name: Set version run: | echo testing > internal/assets/version - name: Lint frontend run: | cd frontend bun run lint - name: Build frontend run: | cd frontend bun run build - name: Copy frontend run: | cp -r frontend/dist internal/assets/dist - name: Run tests run: go test -coverprofile=coverage.txt -v ./... - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} ================================================ FILE: .github/workflows/nightly.yml ================================================ name: Nightly Release on: workflow_dispatch: schedule: - cron: "0 0 * * *" jobs: create-release: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Delete old release run: gh release delete --cleanup-tag --yes nightly || echo release not found env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} OWNER: ${{ github.repository_owner }} REPO: ${{ github.event.repository.name }} - name: Create release uses: softprops/action-gh-release@v2 with: prerelease: true tag_name: nightly generate-metadata: runs-on: ubuntu-latest needs: create-release outputs: VERSION: ${{ steps.metadata.outputs.VERSION }} COMMIT_HASH: ${{ steps.metadata.outputs.COMMIT_HASH }} BUILD_TIMESTAMP: ${{ steps.metadata.outputs.BUILD_TIMESTAMP }} steps: - name: Checkout uses: actions/checkout@v4 with: ref: nightly - name: Generate metadata id: metadata run: | echo "VERSION=nightly" >> "$GITHUB_OUTPUT" echo "COMMIT_HASH=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" echo "BUILD_TIMESTAMP=$(date '+%Y-%m-%dT%H:%M:%S')" >> "$GITHUB_OUTPUT" binary-build: runs-on: ubuntu-latest needs: - create-release - generate-metadata steps: - name: Checkout uses: actions/checkout@v4 with: ref: nightly - name: Install bun uses: oven-sh/setup-bun@v2 - name: Install go uses: actions/setup-go@v5 with: go-version: "^1.24.0" - name: Initialize submodules run: | git submodule init git submodule update - name: Apply patches run: | git apply --directory paerser/ patches/nested_maps.diff - name: Install frontend dependencies run: | cd frontend bun install --frozen-lockfile - name: Install backend dependencies run: | go mod download - name: Build frontend run: | cd frontend bun run build - name: Build run: | cp -r frontend/dist internal/assets/dist go build -ldflags "-s -w -X github.com/steveiliop56/tinyauth/internal/config.Version=${{ needs.generate-metadata.outputs.VERSION }} -X github.com/steveiliop56/tinyauth/internal/config.CommitHash=${{ needs.generate-metadata.outputs.COMMIT_HASH }} -X github.com/steveiliop56/tinyauth/internal/config.BuildTimestamp=${{ needs.generate-metadata.outputs.BUILD_TIMESTAMP }}" -o tinyauth-amd64 ./cmd/tinyauth env: CGO_ENABLED: 0 - name: Upload artifact uses: actions/upload-artifact@v4 with: name: tinyauth-amd64 path: tinyauth-amd64 binary-build-arm: runs-on: ubuntu-24.04-arm needs: - create-release - generate-metadata steps: - name: Checkout uses: actions/checkout@v4 with: ref: nightly - name: Install bun uses: oven-sh/setup-bun@v2 - name: Install go uses: actions/setup-go@v5 with: go-version: "^1.24.0" - name: Initialize submodules run: | git submodule init git submodule update - name: Apply patches run: | git apply --directory paerser/ patches/nested_maps.diff - name: Install frontend dependencies run: | cd frontend bun install --frozen-lockfile - name: Install backend dependencies run: | go mod download - name: Build frontend run: | cd frontend bun run build - name: Build run: | cp -r frontend/dist internal/assets/dist go build -ldflags "-s -w -X github.com/steveiliop56/tinyauth/internal/config.Version=${{ needs.generate-metadata.outputs.VERSION }} -X github.com/steveiliop56/tinyauth/internal/config.CommitHash=${{ needs.generate-metadata.outputs.COMMIT_HASH }} -X github.com/steveiliop56/tinyauth/internal/config.BuildTimestamp=${{ needs.generate-metadata.outputs.BUILD_TIMESTAMP }}" -o tinyauth-arm64 ./cmd/tinyauth env: CGO_ENABLED: 0 - name: Upload artifact uses: actions/upload-artifact@v4 with: name: tinyauth-arm64 path: tinyauth-arm64 image-build: runs-on: ubuntu-latest needs: - create-release - generate-metadata steps: - name: Checkout uses: actions/checkout@v4 with: ref: nightly - name: Initialize submodules run: | git submodule init git submodule update - name: Apply patches run: | git apply --directory paerser/ patches/nested_maps.diff - name: Docker meta id: meta uses: docker/metadata-action@v5 with: images: ghcr.io/${{ github.repository_owner }}/tinyauth - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Build and push uses: docker/build-push-action@v6 id: build with: platforms: linux/amd64 labels: ${{ steps.meta.outputs.labels }} tags: ghcr.io/${{ github.repository_owner }}/tinyauth outputs: type=image,push-by-digest=true,name-canonical=true,push=true cache-from: type=gha cache-to: type=gha,mode=max github-token: ${{ secrets.GITHUB_TOKEN }} build-args: | VERSION=${{ needs.generate-metadata.outputs.VERSION }} COMMIT_HASH=${{ needs.generate-metadata.outputs.COMMIT_HASH }} BUILD_TIMESTAMP=${{ needs.generate-metadata.outputs.BUILD_TIMESTAMP }} - name: Export digest run: | mkdir -p ${{ runner.temp }}/digests digest="${{ steps.build.outputs.digest }}" touch "${{ runner.temp }}/digests/${digest#sha256:}" - name: Upload digest uses: actions/upload-artifact@v4 with: name: digests-linux-amd64 path: ${{ runner.temp }}/digests/* if-no-files-found: error retention-days: 1 image-build-distroless: runs-on: ubuntu-latest needs: - create-release - generate-metadata - image-build steps: - name: Checkout uses: actions/checkout@v4 with: ref: nightly - name: Initialize submodules run: | git submodule init git submodule update - name: Apply patches run: | git apply --directory paerser/ patches/nested_maps.diff - name: Docker meta id: meta uses: docker/metadata-action@v5 with: images: ghcr.io/${{ github.repository_owner }}/tinyauth - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Build and push uses: docker/build-push-action@v6 id: build with: platforms: linux/amd64 labels: ${{ steps.meta.outputs.labels }} tags: ghcr.io/${{ github.repository_owner }}/tinyauth outputs: type=image,push-by-digest=true,name-canonical=true,push=true file: Dockerfile.distroless cache-from: type=gha cache-to: type=gha,mode=max github-token: ${{ secrets.GITHUB_TOKEN }} build-args: | VERSION=${{ needs.generate-metadata.outputs.VERSION }} COMMIT_HASH=${{ needs.generate-metadata.outputs.COMMIT_HASH }} BUILD_TIMESTAMP=${{ needs.generate-metadata.outputs.BUILD_TIMESTAMP }} - name: Export digest run: | mkdir -p ${{ runner.temp }}/digests digest="${{ steps.build.outputs.digest }}" touch "${{ runner.temp }}/digests/${digest#sha256:}" - name: Upload digest uses: actions/upload-artifact@v4 with: name: digests-distroless-linux-amd64 path: ${{ runner.temp }}/digests/* if-no-files-found: error retention-days: 1 image-build-arm: runs-on: ubuntu-24.04-arm needs: - create-release - generate-metadata steps: - name: Checkout uses: actions/checkout@v4 with: ref: nightly - name: Initialize submodules run: | git submodule init git submodule update - name: Apply patches run: | git apply --directory paerser/ patches/nested_maps.diff - name: Docker meta id: meta uses: docker/metadata-action@v5 with: images: ghcr.io/${{ github.repository_owner }}/tinyauth - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Build and push uses: docker/build-push-action@v6 id: build with: platforms: linux/arm64 labels: ${{ steps.meta.outputs.labels }} tags: ghcr.io/${{ github.repository_owner }}/tinyauth outputs: type=image,push-by-digest=true,name-canonical=true,push=true cache-from: type=gha cache-to: type=gha,mode=max github-token: ${{ secrets.GITHUB_TOKEN }} build-args: | VERSION=${{ needs.generate-metadata.outputs.VERSION }} COMMIT_HASH=${{ needs.generate-metadata.outputs.COMMIT_HASH }} BUILD_TIMESTAMP=${{ needs.generate-metadata.outputs.BUILD_TIMESTAMP }} - name: Export digest run: | mkdir -p ${{ runner.temp }}/digests digest="${{ steps.build.outputs.digest }}" touch "${{ runner.temp }}/digests/${digest#sha256:}" - name: Upload digest uses: actions/upload-artifact@v4 with: name: digests-linux-arm64 path: ${{ runner.temp }}/digests/* if-no-files-found: error retention-days: 1 image-build-arm-distroless: runs-on: ubuntu-24.04-arm needs: - create-release - generate-metadata - image-build-arm steps: - name: Checkout uses: actions/checkout@v4 with: ref: nightly - name: Initialize submodules run: | git submodule init git submodule update - name: Apply patches run: | git apply --directory paerser/ patches/nested_maps.diff - name: Docker meta id: meta uses: docker/metadata-action@v5 with: images: ghcr.io/${{ github.repository_owner }}/tinyauth - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Build and push uses: docker/build-push-action@v6 id: build with: platforms: linux/arm64 labels: ${{ steps.meta.outputs.labels }} tags: ghcr.io/${{ github.repository_owner }}/tinyauth outputs: type=image,push-by-digest=true,name-canonical=true,push=true file: Dockerfile.distroless cache-from: type=gha cache-to: type=gha,mode=max github-token: ${{ secrets.GITHUB_TOKEN }} build-args: | VERSION=${{ needs.generate-metadata.outputs.VERSION }} COMMIT_HASH=${{ needs.generate-metadata.outputs.COMMIT_HASH }} BUILD_TIMESTAMP=${{ needs.generate-metadata.outputs.BUILD_TIMESTAMP }} - name: Export digest run: | mkdir -p ${{ runner.temp }}/digests digest="${{ steps.build.outputs.digest }}" touch "${{ runner.temp }}/digests/${digest#sha256:}" - name: Upload digest uses: actions/upload-artifact@v4 with: name: digests-distroless-linux-arm64 path: ${{ runner.temp }}/digests/* if-no-files-found: error retention-days: 1 image-merge: runs-on: ubuntu-latest needs: - image-build - image-build-arm steps: - name: Download digests uses: actions/download-artifact@v4 with: path: ${{ runner.temp }}/digests pattern: digests-* merge-multiple: true - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Docker meta id: meta uses: docker/metadata-action@v5 with: images: ghcr.io/${{ github.repository_owner }}/tinyauth flavor: | latest=false tags: | type=raw,nightly - name: Create manifest list and push working-directory: ${{ runner.temp }}/digests run: | docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ $(printf 'ghcr.io/${{ github.repository_owner }}/tinyauth@sha256:%s ' *) image-merge-distroless: runs-on: ubuntu-latest needs: - image-build-distroless - image-build-arm-distroless steps: - name: Download digests uses: actions/download-artifact@v4 with: path: ${{ runner.temp }}/digests pattern: digests-distroless-* merge-multiple: true - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Docker meta id: meta uses: docker/metadata-action@v5 with: images: ghcr.io/${{ github.repository_owner }}/tinyauth flavor: | latest=false tags: | type=raw,nightly-distroless - name: Create manifest list and push working-directory: ${{ runner.temp }}/digests run: | docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ $(printf 'ghcr.io/${{ github.repository_owner }}/tinyauth@sha256:%s ' *) update-release: runs-on: ubuntu-latest needs: - binary-build - binary-build-arm steps: - uses: actions/download-artifact@v4 with: pattern: tinyauth-* path: binaries merge-multiple: true - name: Release uses: softprops/action-gh-release@v2 with: files: binaries/* tag_name: nightly ================================================ FILE: .github/workflows/release.yml ================================================ name: Release on: workflow_dispatch: push: tags: - "v*" jobs: generate-metadata: runs-on: ubuntu-latest outputs: VERSION: ${{ steps.metadata.outputs.VERSION }} COMMIT_HASH: ${{ steps.metadata.outputs.COMMIT_HASH }} BUILD_TIMESTAMP: ${{ steps.metadata.outputs.BUILD_TIMESTAMP }} steps: - name: Checkout uses: actions/checkout@v4 - name: Generate metadata id: metadata run: | echo "VERSION=${{ github.ref_name }}" >> "$GITHUB_OUTPUT" echo "COMMIT_HASH=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" echo "BUILD_TIMESTAMP=$(date '+%Y-%m-%dT%H:%M:%S')" >> "$GITHUB_OUTPUT" binary-build: runs-on: ubuntu-latest needs: - generate-metadata steps: - name: Checkout uses: actions/checkout@v4 - name: Install bun uses: oven-sh/setup-bun@v2 - name: Install go uses: actions/setup-go@v5 with: go-version: "^1.24.0" - name: Initialize submodules run: | git submodule init git submodule update - name: Apply patches run: | git apply --directory paerser/ patches/nested_maps.diff - name: Install frontend dependencies run: | cd frontend bun install --frozen-lockfile - name: Install backend dependencies run: | go mod download - name: Build frontend run: | cd frontend bun run build - name: Build run: | cp -r frontend/dist internal/assets/dist go build -ldflags "-s -w -X github.com/steveiliop56/tinyauth/internal/config.Version=${{ needs.generate-metadata.outputs.VERSION }} -X github.com/steveiliop56/tinyauth/internal/config.CommitHash=${{ needs.generate-metadata.outputs.COMMIT_HASH }} -X github.com/steveiliop56/tinyauth/internal/config.BuildTimestamp=${{ needs.generate-metadata.outputs.BUILD_TIMESTAMP }}" -o tinyauth-amd64 ./cmd/tinyauth env: CGO_ENABLED: 0 - name: Upload artifact uses: actions/upload-artifact@v4 with: name: tinyauth-amd64 path: tinyauth-amd64 binary-build-arm: runs-on: ubuntu-24.04-arm needs: - generate-metadata steps: - name: Checkout uses: actions/checkout@v4 - name: Install bun uses: oven-sh/setup-bun@v2 - name: Install go uses: actions/setup-go@v5 with: go-version: "^1.24.0" - name: Initialize submodules run: | git submodule init git submodule update - name: Apply patches run: | git apply --directory paerser/ patches/nested_maps.diff - name: Install frontend dependencies run: | cd frontend bun install --frozen-lockfile - name: Install backend dependencies run: | go mod download - name: Build frontend run: | cd frontend bun run build - name: Build run: | cp -r frontend/dist internal/assets/dist go build -ldflags "-s -w -X github.com/steveiliop56/tinyauth/internal/config.Version=${{ needs.generate-metadata.outputs.VERSION }} -X github.com/steveiliop56/tinyauth/internal/config.CommitHash=${{ needs.generate-metadata.outputs.COMMIT_HASH }} -X github.com/steveiliop56/tinyauth/internal/config.BuildTimestamp=${{ needs.generate-metadata.outputs.BUILD_TIMESTAMP }}" -o tinyauth-arm64 ./cmd/tinyauth env: CGO_ENABLED: 0 - name: Upload artifact uses: actions/upload-artifact@v4 with: name: tinyauth-arm64 path: tinyauth-arm64 image-build: runs-on: ubuntu-latest needs: - generate-metadata steps: - name: Checkout uses: actions/checkout@v4 - name: Initialize submodules run: | git submodule init git submodule update - name: Apply patches run: | git apply --directory paerser/ patches/nested_maps.diff - name: Docker meta id: meta uses: docker/metadata-action@v5 with: images: ghcr.io/${{ github.repository_owner }}/tinyauth - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Build and push uses: docker/build-push-action@v6 id: build with: platforms: linux/amd64 labels: ${{ steps.meta.outputs.labels }} tags: ghcr.io/${{ github.repository_owner }}/tinyauth outputs: type=image,push-by-digest=true,name-canonical=true,push=true cache-from: type=gha cache-to: type=gha,mode=max github-token: ${{ secrets.GITHUB_TOKEN }} build-args: | VERSION=${{ needs.generate-metadata.outputs.VERSION }} COMMIT_HASH=${{ needs.generate-metadata.outputs.COMMIT_HASH }} BUILD_TIMESTAMP=${{ needs.generate-metadata.outputs.BUILD_TIMESTAMP }} - name: Export digest run: | mkdir -p ${{ runner.temp }}/digests digest="${{ steps.build.outputs.digest }}" touch "${{ runner.temp }}/digests/${digest#sha256:}" - name: Upload digest uses: actions/upload-artifact@v4 with: name: digests-linux-amd64 path: ${{ runner.temp }}/digests/* if-no-files-found: error retention-days: 1 image-build-distroless: runs-on: ubuntu-latest needs: - generate-metadata - image-build steps: - name: Checkout uses: actions/checkout@v4 - name: Initialize submodules run: | git submodule init git submodule update - name: Apply patches run: | git apply --directory paerser/ patches/nested_maps.diff - name: Docker meta id: meta uses: docker/metadata-action@v5 with: images: ghcr.io/${{ github.repository_owner }}/tinyauth - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Build and push uses: docker/build-push-action@v6 id: build with: platforms: linux/amd64 labels: ${{ steps.meta.outputs.labels }} tags: ghcr.io/${{ github.repository_owner }}/tinyauth outputs: type=image,push-by-digest=true,name-canonical=true,push=true file: Dockerfile.distroless cache-from: type=gha cache-to: type=gha,mode=max github-token: ${{ secrets.GITHUB_TOKEN }} build-args: | VERSION=${{ needs.generate-metadata.outputs.VERSION }} COMMIT_HASH=${{ needs.generate-metadata.outputs.COMMIT_HASH }} BUILD_TIMESTAMP=${{ needs.generate-metadata.outputs.BUILD_TIMESTAMP }} - name: Export digest run: | mkdir -p ${{ runner.temp }}/digests digest="${{ steps.build.outputs.digest }}" touch "${{ runner.temp }}/digests/${digest#sha256:}" - name: Upload digest uses: actions/upload-artifact@v4 with: name: digests-distroless-linux-amd64 path: ${{ runner.temp }}/digests/* if-no-files-found: error retention-days: 1 image-build-arm: runs-on: ubuntu-24.04-arm needs: - generate-metadata steps: - name: Checkout uses: actions/checkout@v4 - name: Initialize submodules run: | git submodule init git submodule update - name: Apply patches run: | git apply --directory paerser/ patches/nested_maps.diff - name: Docker meta id: meta uses: docker/metadata-action@v5 with: images: ghcr.io/${{ github.repository_owner }}/tinyauth - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Build and push uses: docker/build-push-action@v6 id: build with: platforms: linux/arm64 labels: ${{ steps.meta.outputs.labels }} tags: ghcr.io/${{ github.repository_owner }}/tinyauth outputs: type=image,push-by-digest=true,name-canonical=true,push=true cache-from: type=gha cache-to: type=gha,mode=max github-token: ${{ secrets.GITHUB_TOKEN }} build-args: | VERSION=${{ needs.generate-metadata.outputs.VERSION }} COMMIT_HASH=${{ needs.generate-metadata.outputs.COMMIT_HASH }} BUILD_TIMESTAMP=${{ needs.generate-metadata.outputs.BUILD_TIMESTAMP }} - name: Export digest run: | mkdir -p ${{ runner.temp }}/digests digest="${{ steps.build.outputs.digest }}" touch "${{ runner.temp }}/digests/${digest#sha256:}" - name: Upload digest uses: actions/upload-artifact@v4 with: name: digests-linux-arm64 path: ${{ runner.temp }}/digests/* if-no-files-found: error retention-days: 1 image-build-arm-distroless: runs-on: ubuntu-24.04-arm needs: - generate-metadata - image-build-arm steps: - name: Checkout uses: actions/checkout@v4 - name: Initialize submodules run: | git submodule init git submodule update - name: Apply patches run: | git apply --directory paerser/ patches/nested_maps.diff - name: Docker meta id: meta uses: docker/metadata-action@v5 with: images: ghcr.io/${{ github.repository_owner }}/tinyauth - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Build and push uses: docker/build-push-action@v6 id: build with: platforms: linux/arm64 labels: ${{ steps.meta.outputs.labels }} tags: ghcr.io/${{ github.repository_owner }}/tinyauth outputs: type=image,push-by-digest=true,name-canonical=true,push=true file: Dockerfile.distroless cache-from: type=gha cache-to: type=gha,mode=max github-token: ${{ secrets.GITHUB_TOKEN }} build-args: | VERSION=${{ needs.generate-metadata.outputs.VERSION }} COMMIT_HASH=${{ needs.generate-metadata.outputs.COMMIT_HASH }} BUILD_TIMESTAMP=${{ needs.generate-metadata.outputs.BUILD_TIMESTAMP }} - name: Export digest run: | mkdir -p ${{ runner.temp }}/digests digest="${{ steps.build.outputs.digest }}" touch "${{ runner.temp }}/digests/${digest#sha256:}" - name: Upload digest uses: actions/upload-artifact@v4 with: name: digests-distroless-linux-arm64 path: ${{ runner.temp }}/digests/* if-no-files-found: error retention-days: 1 image-merge: runs-on: ubuntu-latest needs: - image-build - image-build-arm steps: - name: Download digests uses: actions/download-artifact@v4 with: path: ${{ runner.temp }}/digests pattern: digests-* merge-multiple: true - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Docker meta id: meta uses: docker/metadata-action@v5 with: images: ghcr.io/${{ github.repository_owner }}/tinyauth flavor: | prefix=v,onlatest=false tags: | type=semver,pattern={{version}} type=semver,pattern={{major}} type=semver,pattern={{major}}.{{minor}} - name: Create manifest list and push working-directory: ${{ runner.temp }}/digests run: | docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ $(printf 'ghcr.io/${{ github.repository_owner }}/tinyauth@sha256:%s ' *) image-merge-distroless: runs-on: ubuntu-latest needs: - image-build-distroless - image-build-arm-distroless steps: - name: Download digests uses: actions/download-artifact@v4 with: path: ${{ runner.temp }}/digests pattern: digests-distroless-* merge-multiple: true - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Docker meta id: meta uses: docker/metadata-action@v5 with: images: ghcr.io/${{ github.repository_owner }}/tinyauth flavor: | latest=false prefix=v suffix=-distroless tags: | type=semver,pattern={{version}} type=semver,pattern={{major}} type=semver,pattern={{major}}.{{minor}} - name: Create manifest list and push working-directory: ${{ runner.temp }}/digests run: | docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ $(printf 'ghcr.io/${{ github.repository_owner }}/tinyauth@sha256:%s ' *) update-release: runs-on: ubuntu-latest needs: - binary-build - binary-build-arm steps: - uses: actions/download-artifact@v4 with: pattern: tinyauth-* path: binaries merge-multiple: true - name: Release uses: softprops/action-gh-release@v2 with: files: binaries/* ================================================ FILE: .github/workflows/sponsors.yml ================================================ name: Generate Sponsors List on: workflow_dispatch: jobs: generate-sponsors: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Generate Sponsors uses: JamesIves/github-sponsors-readme-action@v1 with: token: ${{ secrets.SPONSORS_GENERATOR_PAT }} active-only: false file: "README.md" template: 'User avatar: {{{ login }}}  ' - name: Create Pull Request uses: peter-evans/create-pull-request@v7 with: token: ${{ secrets.GITHUB_TOKEN }} commit-message: | docs: regenerate readme sponsors list committer: GitHub author: GitHub branch: docs/update-readme title: | docs: regenerate readme sponsors list labels: bot ================================================ FILE: .github/workflows/stale.yml ================================================ name: Close stale issues and PRs on: schedule: - cron: 0 10 * * * jobs: stale: runs-on: ubuntu-latest steps: - uses: actions/stale@v9 with: days-before-stale: 30 stale-pr-message: This PR has been inactive for 30 days and will be marked as stale. stale-issue-message: This issue has been inactive for 30 days and will be marked as stale. close-issue-message: Closed for inactivity. close-pr-message: Closed for inactivity. stale-issue-label: stale stale-pr-label: stale exempt-issue-labels: pinned exempt-pr-labels: pinned ================================================ FILE: .gitignore ================================================ # dist /internal/assets/dist # binaries /tinyauth /tinyauth-arm64 /tinyauth-amd64 # test docker compose /docker-compose.test* # users file /users.txt # secret test file /secret* # apple stuff .DS_Store # env /.env # tmp directory /tmp # data directory /data # config file /config.yml # binary out /tinyauth.db /resources # debug files __debug_* # infisical /.infisical.json # traefik data /traefik # generated markdown (for docs) /config.gen.md # testing config config.certify.yml ================================================ FILE: .gitmodules ================================================ [submodule "paerser"] path = paerser url = https://github.com/traefik/paerser ignore = all ================================================ FILE: .vscode/launch.json ================================================ { "version": "0.2.0", "configurations": [ { "name": "Connect to server", "type": "go", "request": "attach", "mode": "remote", "remotePath": "/tinyauth", "port": 4000, "host": "127.0.0.1", "debugAdapter": "legacy" } ] } ================================================ FILE: .zed/debug.json ================================================ [ { "label": "Attach to remote Delve", "adapter": "Delve", "mode": "remote", "remotePath": "/tinyauth", "request": "attach", "tcp_connection": { "host": "127.0.0.1", "port": 4000, }, }, ] ================================================ FILE: CODE_OF_CONDUCT.md ================================================ # Contributor Covenant Code of Conduct ## Our Pledge We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. ## Our Standards Examples of behavior that contributes to a positive environment for our community include: * Demonstrating empathy and kindness toward other people * Being respectful of differing opinions, viewpoints, and experiences * Giving and gracefully accepting constructive feedback * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience * Focusing on what is best not just for us as individuals, but for the overall community Examples of unacceptable behavior include: * The use of sexualized language or imagery, and sexual attention or advances of any kind * Trolling, insulting or derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or email address, without their explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Enforcement Responsibilities Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. ## Scope This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at . All complaints will be reviewed and investigated promptly and fairly. All community leaders are obligated to respect the privacy and security of the reporter of any incident. ## Enforcement Guidelines Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: ### 1. Correction **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. ### 2. Warning **Community Impact**: A violation through a single incident or series of actions. **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. ### 3. Temporary Ban **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. ### 4. Permanent Ban **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. **Consequence**: A permanent ban from any sort of public interaction within the community. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity). [homepage]: https://www.contributor-covenant.org For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations. ================================================ FILE: CONTRIBUTING.md ================================================ # Contributing Contributing to Tinyauth is straightforward. Follow the steps below to set up a development server. ## Requirements - Bun - Golang v1.24.0 or later - Git - Docker - Make ## Cloning the Repository Start by cloning the repository: ```sh git clone https://github.com/steveiliop56/tinyauth cd tinyauth ``` ## Initialize Submodules The project uses Git submodules for some dependencies, so you need to initialize them with: ```sh git submodule init git submodule update ``` ## Apply patches Some of the dependencies must be patched in order to work correctly with the project, you can apply the patches by running: ```sh git apply --directory paerser/ patches/nested_maps.diff ``` ## Installing Requirements While development occurs within Docker, installing the requirements locally is recommended to avoid import errors. Install the Go dependencies: ```sh go mod tidy ``` Frontend dependencies can be installed as follows: ```sh cd frontend/ bun install ``` ## Create the `.env` file Configuration requires an environment file. Copy the `.env.example` file to `.env` and adjust the environment variables as needed. ## Development Workflow The development workflow is designed to run entirely within Docker, ensuring compatibility with Traefik and eliminating the need for local builds. A recommended setup involves pointing a subdomain to the local machine: ``` *.dev.example.com -> 127.0.0.1 dev.example.com -> 127.0.0.1 ``` > [!NOTE] > A domain from [sslip.io](https://sslip.io) can be used if a custom domain is unavailable. For example, set the Tinyauth domain to `tinyauth.127.0.0.1.sslip.io` and the whoami domain to `whoami.127.0.0.1.sslip.io`. Ensure the domains are correctly configured in the development Docker Compose file, then start the development environment: ```sh make dev ``` In case you need to build the binary locally, you can run: ```sh make binary ``` > [!NOTE] > Copying the example `docker-compose.dev.yml` file to `docker-compose.test.yml` is recommended to prevent accidental commits of sensitive information. The make recipe will automatically use `docker-compose.test.yml` as well as `docker-compose.test.prod.yml` (for the `make prod` recipe) if it exists. ================================================ FILE: Dockerfile ================================================ # Site builder FROM oven/bun:1.3.10-alpine AS frontend-builder WORKDIR /frontend COPY ./frontend/package.json ./ COPY ./frontend/bun.lock ./ RUN bun install --frozen-lockfile COPY ./frontend/public ./public COPY ./frontend/src ./src COPY ./frontend/eslint.config.js ./ COPY ./frontend/index.html ./ COPY ./frontend/tsconfig.json ./ COPY ./frontend/tsconfig.app.json ./ COPY ./frontend/tsconfig.node.json ./ COPY ./frontend/vite.config.ts ./ RUN bun run build # Builder FROM golang:1.25-alpine3.21 AS builder ARG VERSION ARG COMMIT_HASH ARG BUILD_TIMESTAMP WORKDIR /tinyauth COPY ./paerser ./paerser COPY go.mod ./ COPY go.sum ./ RUN go mod download COPY ./cmd ./cmd COPY ./internal ./internal COPY --from=frontend-builder /frontend/dist ./internal/assets/dist RUN CGO_ENABLED=0 go build -ldflags "-s -w \ -X github.com/steveiliop56/tinyauth/internal/config.Version=${VERSION} \ -X github.com/steveiliop56/tinyauth/internal/config.CommitHash=${COMMIT_HASH} \ -X github.com/steveiliop56/tinyauth/internal/config.BuildTimestamp=${BUILD_TIMESTAMP}" ./cmd/tinyauth # Runner FROM alpine:3.23 AS runner WORKDIR /tinyauth COPY --from=builder /tinyauth/tinyauth ./ RUN mkdir -p /data EXPOSE 3000 VOLUME ["/data"] ENV TINYAUTH_DATABASE_PATH=/data/tinyauth.db ENV TINYAUTH_RESOURCES_PATH=/data/resources ENV PATH=$PATH:/tinyauth HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 CMD ["tinyauth", "healthcheck"] ENTRYPOINT ["tinyauth"] ================================================ FILE: Dockerfile.dev ================================================ FROM golang:1.25-alpine3.21 WORKDIR /tinyauth COPY ./paerser ./paerser COPY go.mod ./ COPY go.sum ./ RUN go mod download RUN go install github.com/air-verse/air@v1.61.7 RUN go install github.com/go-delve/delve/cmd/dlv@latest COPY ./cmd ./cmd COPY ./internal ./internal COPY ./air.toml ./ EXPOSE 3000 ENV TINYAUTH_DATABASE_PATH=/data/tinyauth.db ENV TINYAUTH_RESOURCES_PATH=/data/resources ENTRYPOINT ["air", "-c", "air.toml"] ================================================ FILE: Dockerfile.distroless ================================================ # Site builder FROM oven/bun:1.3.10-alpine AS frontend-builder WORKDIR /frontend COPY ./frontend/package.json ./ COPY ./frontend/bun.lock ./ RUN bun install --frozen-lockfile COPY ./frontend/public ./public COPY ./frontend/src ./src COPY ./frontend/eslint.config.js ./ COPY ./frontend/index.html ./ COPY ./frontend/tsconfig.json ./ COPY ./frontend/tsconfig.app.json ./ COPY ./frontend/tsconfig.node.json ./ COPY ./frontend/vite.config.ts ./ RUN bun run build # Builder FROM golang:1.25-alpine3.21 AS builder ARG VERSION ARG COMMIT_HASH ARG BUILD_TIMESTAMP WORKDIR /tinyauth COPY ./paerser ./paerser COPY go.mod ./ COPY go.sum ./ RUN go mod download COPY ./cmd ./cmd COPY ./internal ./internal COPY --from=frontend-builder /frontend/dist ./internal/assets/dist RUN mkdir -p data RUN CGO_ENABLED=0 go build -ldflags "-s -w \ -X github.com/steveiliop56/tinyauth/internal/config.Version=${VERSION} \ -X github.com/steveiliop56/tinyauth/internal/config.CommitHash=${COMMIT_HASH} \ -X github.com/steveiliop56/tinyauth/internal/config.BuildTimestamp=${BUILD_TIMESTAMP}" ./cmd/tinyauth # Runner FROM gcr.io/distroless/static-debian12:latest AS runner WORKDIR /tinyauth COPY --from=builder /tinyauth/tinyauth ./ # Since it's distroless, we need to copy the data directory from the builder stage COPY --from=builder /tinyauth/data /data EXPOSE 3000 VOLUME ["/data"] ENV TINYAUTH_DATABASE_PATH=/data/tinyauth.db ENV TINYAUTH_RESOURCES_PATH=/data/resources ENV PATH=$PATH:/tinyauth HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 CMD ["tinyauth", "healthcheck"] ENTRYPOINT ["tinyauth"] ================================================ FILE: FUNDING.yml ================================================ github: steveiliop56 buy_me_a_coffee: steveiliop56 ================================================ FILE: LICENSE ================================================ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . ================================================ FILE: Makefile ================================================ # Go specific stuff CGO_ENABLED := 0 GOOS := $(shell go env GOOS) GOARCH := $(shell go env GOARCH) # Build out TAG_NAME := $(shell git describe --abbrev=0 --exact-match 2> /dev/null || echo "main") COMMIT_HASH := $(shell git rev-parse HEAD) BUILD_TIMESTAMP := $(shell date '+%Y-%m-%dT%H:%M:%S') BIN_NAME := tinyauth-$(GOARCH) # Development vars DEV_COMPOSE := $(shell test -f "docker-compose.test.yml" && echo "docker-compose.test.yml" || echo "docker-compose.dev.yml" ) PROD_COMPOSE := $(shell test -f "docker-compose.test.prod.yml" && echo "docker-compose.test.prod.yml" || echo "docker-compose.example.yml" ) # Deps deps: bun install --cwd frontend go mod download # Clean data clean-data: rm -rf data/ # Clean web UI build clean-webui: rm -rf internal/assets/dist rm -rf frontend/dist # Build the web UI webui: clean-webui bun run --cwd frontend build cp -r frontend/dist internal/assets # Build the binary binary: webui CGO_ENABLED=$(CGO_ENABLED) go build -ldflags "-s -w \ -X github.com/steveiliop56/tinyauth/internal/config.Version=${TAG_NAME} \ -X github.com/steveiliop56/tinyauth/internal/config.CommitHash=${COMMIT_HASH} \ -X github.com/steveiliop56/tinyauth/internal/config.BuildTimestamp=${BUILD_TIMESTAMP}" \ -o ${BIN_NAME} ./cmd/tinyauth # Build for amd64 binary-linux-amd64: export BIN_NAME=tinyauth-amd64 export GOARCH=amd64 export GOOS=linux $(MAKE) binary # Build for arm64 binary-linux-arm64: export BIN_NAME=tinyauth-arm64 export GOARCH=arm64 export GOOS=linux $(MAKE) binary # Go test .PHONY: test test: go test -v ./... # Development dev: docker compose -f $(DEV_COMPOSE) up --force-recreate --pull=always --remove-orphans --build # Development - Infisical dev-infisical: infisical run --env=dev -- docker compose -f $(DEV_COMPOSE) up --force-recreate --pull=always --remove-orphans --build # Production prod: docker compose -f $(PROD_COMPOSE) up --force-recreate --pull=always --remove-orphans # Production - Infisical prod-infisical: infisical run --env=dev -- docker compose -f $(PROD_COMPOSE) up --force-recreate --pull=always --remove-orphans # SQL .PHONY: sql sql: sqlc generate # Go gen generate: go run ./gen ================================================ FILE: README.md ================================================
Tinyauth

Tinyauth

The tiniest authentication and authorization server you have ever seen.

License Release Issues Tinyauth CI

Tinyauth is the simplest and tiniest authentication and authorization server you have ever seen. It is designed to both work as an authentication middleware for your apps, offering support for OAuth, LDAP and access-controls, and as a standalone authentication server. It supports all the popular proxies like Traefik, Nginx and Caddy. ![Screenshot](assets/screenshot.png) > [!WARNING] > Tinyauth is in active development and configuration may change often. Please make sure to carefully read the release notes before updating. > [!NOTE] > This is the main development branch. For the latest stable release, see the [documentation](https://tinyauth.app) or the latest stable tag. ## Getting Started You can get started with Tinyauth by following the guide in the [documentation](https://tinyauth.app/docs/getting-started). There is also an available [docker-compose](./docker-compose.example.yml) file that has Traefik, Whoami and Tinyauth to demonstrate its capabilities (keep in mind that this file lives in the development branch so it may have updates that are not yet released). ## Demo If you are still not sure if Tinyauth suits your needs you can try out the [demo](https://demo.tinyauth.app). The default username is `user` and the default password is `password`. ## Documentation You can find documentation and guides on all of the available configuration of Tinyauth in the [website](https://tinyauth.app). If you wish to contribute to the documentation head over to the [repository](https://github.com/steveiliop56/tinyauth-docs). ## Discord Tinyauth has a [Discord](https://discord.gg/eHzVaCzRRd) server. Feel free to hop in to chat about self-hosting, homelabs and of course Tinyauth. See you there! ## Contributing All contributions to the codebase are welcome! If you have any free time, feel free to pick up an [issue](https://github.com/steveiliop56/tinyauth/issues) or add your own missing features. Make sure to check out the [contributing guide](./CONTRIBUTING.md) for instructions on how to get the development server up and running. ## Localization If you like, you can help translate Tinyauth into more languages by visiting the [Crowdin](https://crowdin.com/project/tinyauth) page. ## License Tinyauth is licensed under the GNU General Public License v3.0. TL;DR — You may copy, distribute and modify the software as long as you track changes/dates in source files. Any modifications to or software including (via compiler) GPL-licensed code must also be made available under the GPL along with build & install instructions. For more information about the license check the [license](./LICENSE) file. ## Sponsors A big thank you to the following people for providing me with more coffee: User avatar: erwinkramer  User avatar: nicotsx  User avatar: SimpleHomelab  User avatar: jmadden91  User avatar: tribor  User avatar: eliasbenb  User avatar: afunworm  User avatar: chip-well  User avatar: Lancelot-Enguerrand  User avatar: allgoewer  User avatar: NEANC  User avatar: algorist-ahmad   ## Acknowledgements - **Freepik** for providing the police hat and badge. - **Renee French** for the original gopher logo. - **Coderabbit AI** for providing free AI code reviews. - **Syrhu** for providing the background image of the app. ## Star History [![Star History Chart](https://api.star-history.com/svg?repos=steveiliop56/tinyauth&type=Date)](https://www.star-history.com/#steveiliop56/tinyauth&Date) ================================================ FILE: SECURITY.md ================================================ # Security Policy ## Supported Versions It is recommended to use the [latest](https://github.com/steveiliop56/tinyauth/releases/latest) available version of tinyauth. This is because it includes security fixes, new features and dependency updates. Older versions, especially major ones, are not supported and won't receive security or patch updates. ## Reporting a Vulnerability Due to the nature of this app, it needs to be secure. If you discover any security issues or vulnerabilities in the app please contact me as soon as possible at . Please do not use the issues section to report security issues as I won't be able to patch them in time and they may get exploited by malicious actors. ================================================ FILE: air.toml ================================================ root = "/tinyauth" tmp_dir = "tmp" [build] pre_cmd = ["mkdir -p internal/assets/dist", "mkdir -p /data", "echo 'backend running' > internal/assets/dist/index.html"] cmd = "CGO_ENABLED=0 go build -gcflags=\"all=-N -l\" -o tmp/tinyauth ./cmd/tinyauth" bin = "tmp/tinyauth" full_bin = "dlv --listen :4000 --headless=true --api-version=2 --accept-multiclient --log=true exec tmp/tinyauth --continue --check-go-version=false" include_ext = ["go"] exclude_dir = ["internal/assets/dist"] exclude_regex = [".*_test\\.go"] stop_on_error = true [color] main = "magenta" watcher = "cyan" build = "yellow" runner = "green" [misc] clean_on_exit = true [screen] clear_on_rebuild = false keep_scroll = true ================================================ FILE: assets/discohook.json ================================================ { "content": null, "embeds": [ { "title": "Welcome to Tinyauth Discord!", "description": "Tinyauth is a simple authentication middleware that adds a simple login screen or OAuth with Google, Github and any provider to all of your docker apps. It supports all the popular proxies like Traefik, Nginx and Caddy.\n\n**Information**\n\n• Github: \n• Website: ", "url": "https://tinyauth.app", "color": 7002085, "author": { "name": "Tinyauth" }, "footer": { "text": "Updated at" }, "timestamp": "2025-06-06T12:25:27.629Z", "thumbnail": { "url": "https://github.com/steveiliop56/tinyauth/blob/main/assets/logo.png?raw=true" } } ], "attachments": [] } ================================================ FILE: cmd/tinyauth/create_oidc_client.go ================================================ package main import ( "errors" "fmt" "regexp" "strings" "github.com/google/uuid" "github.com/steveiliop56/tinyauth/internal/utils" "github.com/traefik/paerser/cli" ) func createOidcClientCmd() *cli.Command { return &cli.Command{ Name: "create", Description: "Create a new OIDC Client", Configuration: nil, Resources: nil, AllowArg: true, Run: func(args []string) error { if len(args) == 0 { return errors.New("client name is required. use tinyauth oidc create ") } clientName := args[0] match, err := regexp.MatchString("^[a-zA-Z0-9-]*$", clientName) if !match || err != nil { return errors.New("client name can only contain alphanumeric characters and hyphens") } uuid := uuid.New() clientId := uuid.String() clientSecret := "ta-" + utils.GenerateString(61) uclientName := strings.ToUpper(clientName) lclientName := strings.ToLower(clientName) builder := strings.Builder{} // header fmt.Fprintf(&builder, "Created credentials for client %s\n\n", clientName) // credentials fmt.Fprintf(&builder, "Client Name: %s\n", clientName) fmt.Fprintf(&builder, "Client ID: %s\n", clientId) fmt.Fprintf(&builder, "Client Secret: %s\n\n", clientSecret) // env variables fmt.Fprint(&builder, "Environment variables:\n\n") fmt.Fprintf(&builder, "TINYAUTH_OIDC_CLIENTS_%s_CLIENTID=%s\n", uclientName, clientId) fmt.Fprintf(&builder, "TINYAUTH_OIDC_CLIENTS_%s_CLIENTSECRET=%s\n", uclientName, clientSecret) fmt.Fprintf(&builder, "TINYAUTH_OIDC_CLIENTS_%s_NAME=%s\n\n", uclientName, utils.Capitalize(lclientName)) // cli flags fmt.Fprint(&builder, "CLI flags:\n\n") fmt.Fprintf(&builder, "--oidc.clients.%s.clientid=%s\n", lclientName, clientId) fmt.Fprintf(&builder, "--oidc.clients.%s.clientsecret=%s\n", lclientName, clientSecret) fmt.Fprintf(&builder, "--oidc.clients.%s.name=%s\n\n", lclientName, utils.Capitalize(lclientName)) // footer fmt.Fprintln(&builder, "You can use either option to configure your OIDC client. Make sure to save these credentials as there is no way to regenerate them.") // print out := builder.String() fmt.Print(out) return nil }, } } ================================================ FILE: cmd/tinyauth/create_user.go ================================================ package main import ( "errors" "fmt" "strings" "github.com/charmbracelet/huh" "github.com/steveiliop56/tinyauth/internal/utils/tlog" "github.com/traefik/paerser/cli" "golang.org/x/crypto/bcrypt" ) type CreateUserConfig struct { Interactive bool `description:"Create a user interactively."` Docker bool `description:"Format output for docker."` Username string `description:"Username."` Password string `description:"Password."` } func NewCreateUserConfig() *CreateUserConfig { return &CreateUserConfig{ Interactive: false, Docker: false, Username: "", Password: "", } } func createUserCmd() *cli.Command { tCfg := NewCreateUserConfig() loaders := []cli.ResourceLoader{ &cli.FlagLoader{}, } return &cli.Command{ Name: "create", Description: "Create a user", Configuration: tCfg, Resources: loaders, Run: func(_ []string) error { tlog.NewSimpleLogger().Init() if tCfg.Interactive { form := huh.NewForm( huh.NewGroup( huh.NewInput().Title("Username").Value(&tCfg.Username).Validate((func(s string) error { if s == "" { return errors.New("username cannot be empty") } return nil })), huh.NewInput().Title("Password").Value(&tCfg.Password).Validate((func(s string) error { if s == "" { return errors.New("password cannot be empty") } return nil })), huh.NewSelect[bool]().Title("Format the output for Docker?").Options(huh.NewOption("Yes", true), huh.NewOption("No", false)).Value(&tCfg.Docker), ), ) var baseTheme *huh.Theme = huh.ThemeBase() err := form.WithTheme(baseTheme).Run() if err != nil { return fmt.Errorf("failed to run interactive prompt: %w", err) } } if tCfg.Username == "" || tCfg.Password == "" { return errors.New("username and password cannot be empty") } tlog.App.Info().Str("username", tCfg.Username).Msg("Creating user") passwd, err := bcrypt.GenerateFromPassword([]byte(tCfg.Password), bcrypt.DefaultCost) if err != nil { return fmt.Errorf("failed to hash password: %w", err) } // If docker format is enabled, escape the dollar sign passwdStr := string(passwd) if tCfg.Docker { passwdStr = strings.ReplaceAll(passwdStr, "$", "$$") } tlog.App.Info().Str("user", fmt.Sprintf("%s:%s", tCfg.Username, passwdStr)).Msg("User created") return nil }, } } ================================================ FILE: cmd/tinyauth/generate_totp.go ================================================ package main import ( "errors" "fmt" "os" "strings" "github.com/steveiliop56/tinyauth/internal/utils" "github.com/steveiliop56/tinyauth/internal/utils/tlog" "github.com/charmbracelet/huh" "github.com/mdp/qrterminal/v3" "github.com/pquerna/otp/totp" "github.com/traefik/paerser/cli" ) type GenerateTotpConfig struct { Interactive bool `description:"Generate a TOTP secret interactively."` User string `description:"Your current user (username:hash)."` } func NewGenerateTotpConfig() *GenerateTotpConfig { return &GenerateTotpConfig{ Interactive: false, User: "", } } func generateTotpCmd() *cli.Command { tCfg := NewGenerateTotpConfig() loaders := []cli.ResourceLoader{ &cli.FlagLoader{}, } return &cli.Command{ Name: "generate", Description: "Generate a TOTP secret", Configuration: tCfg, Resources: loaders, Run: func(_ []string) error { tlog.NewSimpleLogger().Init() if tCfg.Interactive { form := huh.NewForm( huh.NewGroup( huh.NewInput().Title("Current user (username:hash)").Value(&tCfg.User).Validate((func(s string) error { if s == "" { return errors.New("user cannot be empty") } return nil })), ), ) var baseTheme *huh.Theme = huh.ThemeBase() err := form.WithTheme(baseTheme).Run() if err != nil { return fmt.Errorf("failed to run interactive prompt: %w", err) } } user, err := utils.ParseUser(tCfg.User) if err != nil { return fmt.Errorf("failed to parse user: %w", err) } docker := false if strings.Contains(tCfg.User, "$$") { docker = true } if user.TotpSecret != "" { return fmt.Errorf("user already has a TOTP secret") } key, err := totp.Generate(totp.GenerateOpts{ Issuer: "Tinyauth", AccountName: user.Username, }) if err != nil { return fmt.Errorf("failed to generate TOTP secret: %w", err) } secret := key.Secret() tlog.App.Info().Str("secret", secret).Msg("Generated TOTP secret") tlog.App.Info().Msg("Generated QR code") config := qrterminal.Config{ Level: qrterminal.L, Writer: os.Stdout, BlackChar: qrterminal.BLACK, WhiteChar: qrterminal.WHITE, QuietZone: 2, } qrterminal.GenerateWithConfig(key.URL(), config) user.TotpSecret = secret // If using docker escape re-escape it if docker { user.Password = strings.ReplaceAll(user.Password, "$", "$$") } tlog.App.Info().Str("user", fmt.Sprintf("%s:%s:%s", user.Username, user.Password, user.TotpSecret)).Msg("Add the totp secret to your authenticator app then use the verify command to ensure everything is working correctly.") return nil }, } } ================================================ FILE: cmd/tinyauth/healthcheck.go ================================================ package main import ( "encoding/json" "errors" "fmt" "io" "net/http" "os" "time" "github.com/steveiliop56/tinyauth/internal/utils/tlog" "github.com/traefik/paerser/cli" ) type healthzResponse struct { Status string `json:"status"` Message string `json:"message"` } func healthcheckCmd() *cli.Command { return &cli.Command{ Name: "healthcheck", Description: "Perform a health check", Configuration: nil, Resources: nil, AllowArg: true, Run: func(args []string) error { tlog.NewSimpleLogger().Init() srvAddr := os.Getenv("TINYAUTH_SERVER_ADDRESS") if srvAddr == "" { srvAddr = "127.0.0.1" } srvPort := os.Getenv("TINYAUTH_SERVER_PORT") if srvPort == "" { srvPort = "3000" } appUrl := fmt.Sprintf("http://%s:%s", srvAddr, srvPort) if len(args) > 0 { appUrl = args[0] } if appUrl == "" { return errors.New("Could not determine app URL") } tlog.App.Info().Str("app_url", appUrl).Msg("Performing health check") client := http.Client{ Timeout: 30 * time.Second, } req, err := http.NewRequest("GET", appUrl+"/api/healthz", nil) if err != nil { return fmt.Errorf("failed to create request: %w", err) } resp, err := client.Do(req) if err != nil { return fmt.Errorf("failed to perform request: %w", err) } if resp.StatusCode != http.StatusOK { return fmt.Errorf("service is not healthy, got: %s", resp.Status) } defer resp.Body.Close() var healthResp healthzResponse body, err := io.ReadAll(resp.Body) if err != nil { return fmt.Errorf("failed to read response: %w", err) } err = json.Unmarshal(body, &healthResp) if err != nil { return fmt.Errorf("failed to decode response: %w", err) } tlog.App.Info().Interface("response", healthResp).Msg("Tinyauth is healthy") return nil }, } } ================================================ FILE: cmd/tinyauth/tinyauth.go ================================================ package main import ( "fmt" "github.com/steveiliop56/tinyauth/internal/bootstrap" "github.com/steveiliop56/tinyauth/internal/config" "github.com/steveiliop56/tinyauth/internal/utils/loaders" "github.com/steveiliop56/tinyauth/internal/utils/tlog" "github.com/rs/zerolog/log" "github.com/traefik/paerser/cli" ) func main() { tConfig := config.NewDefaultConfiguration() loaders := []cli.ResourceLoader{ &loaders.FileLoader{}, &loaders.FlagLoader{}, &loaders.EnvLoader{}, } cmdTinyauth := &cli.Command{ Name: "tinyauth", Description: "The simplest way to protect your apps with a login screen", Configuration: tConfig, Resources: loaders, Run: func(_ []string) error { return runCmd(*tConfig) }, } cmdUser := &cli.Command{ Name: "user", Description: "Manage Tinyauth users", } cmdTotp := &cli.Command{ Name: "totp", Description: "Manage Tinyauth TOTP users", } cmdOidc := &cli.Command{ Name: "oidc", Description: "Manage Tinyauth OIDC clients", } err := cmdTinyauth.AddCommand(versionCmd()) if err != nil { log.Fatal().Err(err).Msg("Failed to add version command") } err = cmdUser.AddCommand(verifyUserCmd()) if err != nil { log.Fatal().Err(err).Msg("Failed to add verify command") } err = cmdTinyauth.AddCommand(healthcheckCmd()) if err != nil { log.Fatal().Err(err).Msg("Failed to add healthcheck command") } err = cmdTotp.AddCommand(generateTotpCmd()) if err != nil { log.Fatal().Err(err).Msg("Failed to add generate command") } err = cmdUser.AddCommand(createUserCmd()) if err != nil { log.Fatal().Err(err).Msg("Failed to add create command") } err = cmdOidc.AddCommand(createOidcClientCmd()) if err != nil { log.Fatal().Err(err).Msg("Failed to add create command") } err = cmdTinyauth.AddCommand(cmdUser) if err != nil { log.Fatal().Err(err).Msg("Failed to add user command") } err = cmdTinyauth.AddCommand(cmdTotp) if err != nil { log.Fatal().Err(err).Msg("Failed to add totp command") } err = cmdTinyauth.AddCommand(cmdOidc) if err != nil { log.Fatal().Err(err).Msg("Failed to add oidc command") } err = cli.Execute(cmdTinyauth) if err != nil { log.Fatal().Err(err).Msg("Failed to execute command") } } func runCmd(cfg config.Config) error { logger := tlog.NewLogger(cfg.Log) logger.Init() tlog.App.Info().Str("version", config.Version).Msg("Starting tinyauth") app := bootstrap.NewBootstrapApp(cfg) err := app.Setup() if err != nil { return fmt.Errorf("failed to bootstrap app: %w", err) } return nil } ================================================ FILE: cmd/tinyauth/verify_user.go ================================================ package main import ( "errors" "fmt" "github.com/steveiliop56/tinyauth/internal/utils" "github.com/steveiliop56/tinyauth/internal/utils/tlog" "github.com/charmbracelet/huh" "github.com/pquerna/otp/totp" "github.com/traefik/paerser/cli" "golang.org/x/crypto/bcrypt" ) type VerifyUserConfig struct { Interactive bool `description:"Validate a user interactively."` Username string `description:"Username."` Password string `description:"Password."` Totp string `description:"TOTP code."` User string `description:"Hash (username:hash:totp)."` } func NewVerifyUserConfig() *VerifyUserConfig { return &VerifyUserConfig{ Interactive: false, Username: "", Password: "", Totp: "", User: "", } } func verifyUserCmd() *cli.Command { tCfg := NewVerifyUserConfig() loaders := []cli.ResourceLoader{ &cli.FlagLoader{}, } return &cli.Command{ Name: "verify", Description: "Verify a user is set up correctly", Configuration: tCfg, Resources: loaders, Run: func(_ []string) error { tlog.NewSimpleLogger().Init() if tCfg.Interactive { form := huh.NewForm( huh.NewGroup( huh.NewInput().Title("User (username:hash:totp)").Value(&tCfg.User).Validate((func(s string) error { if s == "" { return errors.New("user cannot be empty") } return nil })), huh.NewInput().Title("Username").Value(&tCfg.Username).Validate((func(s string) error { if s == "" { return errors.New("username cannot be empty") } return nil })), huh.NewInput().Title("Password").Value(&tCfg.Password).Validate((func(s string) error { if s == "" { return errors.New("password cannot be empty") } return nil })), huh.NewInput().Title("TOTP Code (optional)").Value(&tCfg.Totp), ), ) var baseTheme *huh.Theme = huh.ThemeBase() err := form.WithTheme(baseTheme).Run() if err != nil { return fmt.Errorf("failed to run interactive prompt: %w", err) } } user, err := utils.ParseUser(tCfg.User) if err != nil { return fmt.Errorf("failed to parse user: %w", err) } if user.Username != tCfg.Username { return fmt.Errorf("username is incorrect") } err = bcrypt.CompareHashAndPassword([]byte(user.Password), []byte(tCfg.Password)) if err != nil { return fmt.Errorf("password is incorrect: %w", err) } if user.TotpSecret == "" { if tCfg.Totp != "" { tlog.App.Warn().Msg("User does not have TOTP secret") } tlog.App.Info().Msg("User verified") return nil } ok := totp.Validate(tCfg.Totp, user.TotpSecret) if !ok { return fmt.Errorf("TOTP code incorrect") } tlog.App.Info().Msg("User verified") return nil }, } } ================================================ FILE: cmd/tinyauth/version.go ================================================ package main import ( "fmt" "github.com/steveiliop56/tinyauth/internal/config" "github.com/traefik/paerser/cli" ) func versionCmd() *cli.Command { return &cli.Command{ Name: "version", Description: "Print the version number of Tinyauth", Configuration: nil, Resources: nil, Run: func(_ []string) error { fmt.Printf("Version: %s\n", config.Version) fmt.Printf("Commit Hash: %s\n", config.CommitHash) fmt.Printf("Build Timestamp: %s\n", config.BuildTimestamp) return nil }, } } ================================================ FILE: codecov.yml ================================================ coverage: status: project: default: informational: true patch: default: informational: true ================================================ FILE: crowdin.yml ================================================ "base_path": "." "base_url": "https://api.crowdin.com" "preserve_hierarchy": true files: [ { "source": "/frontend/src/lib/i18n/locales/en.json", "translation": "/frontend/src/lib/i18n/locales/%locale%.json", }, ] ================================================ FILE: docker-compose.dev.yml ================================================ services: traefik: image: traefik:v3.6 command: --api.insecure=true --providers.docker ports: - 80:80 volumes: - /var/run/docker.sock:/var/run/docker.sock whoami: image: traefik/whoami:latest labels: traefik.enable: true traefik.http.routers.whoami.rule: Host(`whoami.127.0.0.1.sslip.io`) traefik.http.routers.whoami.middlewares: tinyauth tinyauth-frontend: build: context: . dockerfile: frontend/Dockerfile.dev volumes: - ./frontend/src:/frontend/src ports: - 5173:5173 labels: traefik.enable: true traefik.http.routers.tinyauth.rule: Host(`tinyauth.127.0.0.1.sslip.io`) tinyauth-backend: build: context: . dockerfile: Dockerfile.dev args: - VERSION=development - COMMIT_HASH=development - BUILD_TIMESTAMP=000-00-00T00:00:00Z env_file: .env volumes: - ./internal:/tinyauth/internal - ./cmd:/tinyauth/cmd - /var/run/docker.sock:/var/run/docker.sock - ./data:/data ports: - 3000:3000 - 4000:4000 labels: traefik.enable: true traefik.http.middlewares.tinyauth.forwardauth.address: http://tinyauth-backend:3000/api/auth/traefik traefik.http.middlewares.tinyauth.forwardauth.authResponseHeaders: remote-user, remote-sub, remote-name, remote-email, remote-groups ================================================ FILE: docker-compose.example.yml ================================================ services: traefik: image: traefik:v3.6 command: --api.insecure=true --providers.docker ports: - 80:80 volumes: - /var/run/docker.sock:/var/run/docker.sock whoami: image: traefik/whoami:latest labels: traefik.enable: true traefik.http.routers.whoami.rule: Host(`whoami.example.com`) traefik.http.routers.whoami.middlewares: tinyauth tinyauth: image: ghcr.io/steveiliop56/tinyauth:v5 environment: - TINYAUTH_APPURL=https://tinyauth.example.com - TINYAUTH_AUTH_USERS=user:$$2a$$10$$UdLYoJ5lgPsC0RKqYH/jMua7zIn0g9kPqWmhYayJYLaZQ/FTmH2/u # user:password volumes: - ./data:/data labels: traefik.enable: true traefik.http.routers.tinyauth.rule: Host(`tinyauth.example.com`) traefik.http.middlewares.tinyauth.forwardauth.address: http://tinyauth:3000/api/auth/traefik ================================================ FILE: frontend/.gitignore ================================================ # Logs logs *.log npm-debug.log* yarn-debug.log* yarn-error.log* pnpm-debug.log* lerna-debug.log* node_modules dist dist-ssr *.local # Editor directories and files .vscode/* !.vscode/extensions.json .idea .DS_Store *.suo *.ntvs* *.njsproj *.sln *.sw? # Stats out stats.html ================================================ FILE: frontend/.prettierignore ================================================ # Ignore artifacts: dist node_modules bun.lock package.json src/lib/i18n/locales ================================================ FILE: frontend/.prettierrc ================================================ {} ================================================ FILE: frontend/Dockerfile.dev ================================================ FROM oven/bun:1.2.16-alpine WORKDIR /frontend COPY ./frontend/package.json ./ COPY ./frontend/bun.lock ./ RUN bun install COPY ./frontend/public ./public COPY ./frontend/src ./src COPY ./frontend/eslint.config.js ./ COPY ./frontend/index.html ./ COPY ./frontend/tsconfig.json ./ COPY ./frontend/tsconfig.app.json ./ COPY ./frontend/tsconfig.node.json ./ COPY ./frontend/vite.config.ts ./ EXPOSE 5173 ENTRYPOINT ["bun", "run", "dev"] ================================================ FILE: frontend/components.json ================================================ { "$schema": "https://ui.shadcn.com/schema.json", "style": "new-york", "rsc": false, "tsx": true, "tailwind": { "config": "", "css": "src/index.css", "baseColor": "neutral", "cssVariables": true, "prefix": "" }, "aliases": { "components": "@/components", "utils": "@/lib/utils", "ui": "@/components/ui", "lib": "@/lib", "hooks": "@/hooks" }, "iconLibrary": "lucide" } ================================================ FILE: frontend/eslint.config.js ================================================ import js from "@eslint/js"; import globals from "globals"; import reactHooks from "eslint-plugin-react-hooks"; import reactRefresh from "eslint-plugin-react-refresh"; import tseslint from "typescript-eslint"; import pluginQuery from "@tanstack/eslint-plugin-query"; export default tseslint.config( { ignores: ["dist"] }, { extends: [js.configs.recommended, ...tseslint.configs.recommended], files: ["**/*.{ts,tsx}"], languageOptions: { ecmaVersion: 2020, globals: globals.browser, }, plugins: { "react-hooks": reactHooks, "react-refresh": reactRefresh, "@tanstack/query": pluginQuery, }, rules: { ...reactHooks.configs.recommended.rules, "react-refresh/only-export-components": [ "warn", { allowConstantExport: true }, ], "@tanstack/query/exhaustive-deps": "error", }, }, ); ================================================ FILE: frontend/index.html ================================================ Tinyauth
================================================ FILE: frontend/package.json ================================================ { "name": "tinyauth", "private": true, "version": "0.0.0", "type": "module", "scripts": { "dev": "vite", "build": "tsc -b && vite build", "lint": "eslint .", "preview": "vite preview", "tsc": "tsc -b" }, "dependencies": { "@hookform/resolvers": "^5.2.2", "@radix-ui/react-dropdown-menu": "^2.1.16", "@radix-ui/react-label": "^2.1.8", "@radix-ui/react-select": "^2.2.6", "@radix-ui/react-separator": "^1.1.8", "@radix-ui/react-slot": "^1.2.4", "@tailwindcss/vite": "^4.2.1", "@tanstack/react-query": "^5.90.21", "axios": "^1.13.6", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "i18next": "^25.8.18", "i18next-browser-languagedetector": "^8.2.1", "i18next-resources-to-backend": "^1.2.1", "input-otp": "^1.4.2", "lucide-react": "^0.577.0", "next-themes": "^0.4.6", "radix-ui": "^1.4.3", "react": "^19.2.4", "react-dom": "^19.2.4", "react-hook-form": "^7.71.2", "react-i18next": "^16.5.8", "react-markdown": "^10.1.0", "react-router": "^7.13.1", "sonner": "^2.0.7", "tailwind-merge": "^3.5.0", "tailwindcss": "^4.2.1", "zod": "^4.3.6" }, "devDependencies": { "@eslint/js": "^10.0.1", "@tanstack/eslint-plugin-query": "^5.91.4", "@types/node": "^25.5.0", "@types/react": "^19.2.14", "@types/react-dom": "^19.2.3", "@vitejs/plugin-react": "^5.1.4", "eslint": "^10.0.3", "eslint-plugin-react-hooks": "^7.0.1", "eslint-plugin-react-refresh": "^0.5.2", "globals": "^17.4.0", "prettier": "3.8.1", "rollup-plugin-visualizer": "^7.0.1", "tw-animate-css": "^1.4.0", "typescript": "~5.9.3", "typescript-eslint": "^8.57.0", "vite": "^7.3.1" } } ================================================ FILE: frontend/public/site.webmanifest ================================================ { "name": "Tinyauth", "short_name": "Tinyauth", "icons": [ { "src": "/web-app-manifest-192x192.png", "sizes": "192x192", "type": "image/png", "purpose": "maskable" }, { "src": "/web-app-manifest-512x512.png", "sizes": "512x512", "type": "image/png", "purpose": "maskable" } ], "theme_color": "#171717", "background_color": "#171717", "display": "standalone" } ================================================ FILE: frontend/src/App.tsx ================================================ import { Navigate } from "react-router"; import { useUserContext } from "./context/user-context"; export const App = () => { const { isLoggedIn } = useUserContext(); if (isLoggedIn) { return ; } return ; }; ================================================ FILE: frontend/src/components/auth/login-form.tsx ================================================ import { useTranslation } from "react-i18next"; import { Input } from "../ui/input"; import { useForm } from "react-hook-form"; import { zodResolver } from "@hookform/resolvers/zod"; import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage, } from "../ui/form"; import { loginSchema, LoginSchema } from "@/schemas/login-schema"; import z from "zod"; interface Props { onSubmit: (data: LoginSchema) => void; loading?: boolean; formId?: string; } export const LoginForm = (props: Props) => { const { onSubmit, loading, formId } = props; const { t } = useTranslation(); z.config({ customError: (iss) => iss.input === undefined ? t("fieldRequired") : t("invalidInput"), }); const form = useForm({ resolver: zodResolver(loginSchema), }); return (
( {t("loginUsername")} )} /> (
{t("loginPassword")} {t("forgotPasswordTitle")}
)} /> ); }; ================================================ FILE: frontend/src/components/auth/totp-form.tsx ================================================ import { Form, FormControl, FormField, FormItem } from "../ui/form"; import { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, } from "../ui/input-otp"; import { zodResolver } from "@hookform/resolvers/zod"; import { useForm } from "react-hook-form"; import { totpSchema, TotpSchema } from "@/schemas/totp-schema"; import { useTranslation } from "react-i18next"; import z from "zod"; interface Props { formId: string; onSubmit: (code: TotpSchema) => void; } export const TotpForm = (props: Props) => { const { formId, onSubmit } = props; const { t } = useTranslation(); z.config({ customError: (iss) => iss.input === undefined ? t("fieldRequired") : t("invalidInput"), }); const form = useForm({ resolver: zodResolver(totpSchema), }); const handleChange = (value: string) => { form.setValue("code", value, { shouldDirty: true, shouldValidate: true }); if (value.length === 6) { onSubmit({ code: value }); } }; return (
( )} /> ); }; ================================================ FILE: frontend/src/components/domain-warning/domain-warning.tsx ================================================ import { Card, CardContent, CardFooter, CardHeader, CardTitle, } from "../ui/card"; import { Button } from "../ui/button"; import { useTranslation } from "react-i18next"; import { useLocation } from "react-router"; interface Props { onClick: () => void; appUrl: string; currentUrl: string; } export const DomainWarning = (props: Props) => { const { onClick, appUrl, currentUrl } = props; const { t } = useTranslation(); const { search } = useLocation(); const searchParams = new URLSearchParams(search); return ( {t("domainWarningTitle")}

{t("domainWarningSubtitle")}

          
            {t("domainWarningExpected")} 
            {appUrl}
          
        
          
            {t("domainWarningCurrent")} 
            {currentUrl}
          
        
); }; ================================================ FILE: frontend/src/components/icons/github.tsx ================================================ import type { SVGProps } from "react"; export function GithubIcon(props: SVGProps) { return ( ); } ================================================ FILE: frontend/src/components/icons/google.tsx ================================================ import type { SVGProps } from "react"; export function GoogleIcon(props: SVGProps) { return ( ); } ================================================ FILE: frontend/src/components/icons/microsoft.tsx ================================================ import type { SVGProps } from "react"; export function MicrosoftIcon(props: SVGProps) { return ( ); } ================================================ FILE: frontend/src/components/icons/oauth.tsx ================================================ import type { SVGProps } from "react"; export function OAuthIcon(props: SVGProps) { return ( ); } ================================================ FILE: frontend/src/components/icons/pocket-id.tsx ================================================ import type { SVGProps } from "react"; export function PocketIDIcon(props: SVGProps) { return ( ); } ================================================ FILE: frontend/src/components/icons/tailscale.tsx ================================================ import type { SVGProps } from "react"; export function TailscaleIcon(props: SVGProps) { return ( ); } ================================================ FILE: frontend/src/components/language/language.tsx ================================================ import { languages, SupportedLanguage } from "@/lib/i18n/locales"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "../ui/select"; import { useState } from "react"; import i18n from "@/lib/i18n/i18n"; export const LanguageSelector = () => { const [language, setLanguage] = useState( i18n.language as SupportedLanguage, ); const handleSelect = (option: string) => { setLanguage(option as SupportedLanguage); i18n.changeLanguage(option as SupportedLanguage); }; return ( ); }; ================================================ FILE: frontend/src/components/layout/layout.tsx ================================================ import { useAppContext } from "@/context/app-context"; import { LanguageSelector } from "../language/language"; import { Outlet } from "react-router"; import { useCallback, useEffect, useState } from "react"; import { DomainWarning } from "../domain-warning/domain-warning"; import { ThemeToggle } from "../theme-toggle/theme-toggle"; const BaseLayout = ({ children }: { children: React.ReactNode }) => { const { backgroundImage, title } = useAppContext(); useEffect(() => { document.title = title; }, [title]); return (
{children}
); }; export const Layout = () => { const { appUrl, warningsEnabled } = useAppContext(); const [ignoreDomainWarning, setIgnoreDomainWarning] = useState(() => { return window.sessionStorage.getItem("ignoreDomainWarning") === "true"; }); const currentUrl = window.location.origin; const handleIgnore = useCallback(() => { window.sessionStorage.setItem("ignoreDomainWarning", "true"); setIgnoreDomainWarning(true); }, [setIgnoreDomainWarning]); if (!ignoreDomainWarning && warningsEnabled && appUrl !== currentUrl) { return ( handleIgnore()} /> ); } return ( ); }; ================================================ FILE: frontend/src/components/providers/theme-provider.tsx ================================================ import { createContext, useContext, useEffect, useState } from "react"; type Theme = "dark" | "light" | "system"; type ThemeProviderProps = { children: React.ReactNode; defaultTheme?: Theme; storageKey?: string; }; type ThemeProviderState = { theme: Theme; setTheme: (theme: Theme) => void; }; const initialState: ThemeProviderState = { theme: "system", setTheme: () => null, }; const ThemeProviderContext = createContext(initialState); export function ThemeProvider({ children, defaultTheme = "system", storageKey = "vite-ui-theme", ...props }: ThemeProviderProps) { const [theme, setTheme] = useState( () => (localStorage.getItem(storageKey) as Theme) || defaultTheme, ); useEffect(() => { const root = window.document.documentElement; root.classList.remove("light", "dark"); if (theme === "system") { const systemTheme = window.matchMedia("(prefers-color-scheme: dark)") .matches ? "dark" : "light"; root.classList.add(systemTheme); return; } root.classList.add(theme); }, [theme]); const value = { theme, setTheme: (theme: Theme) => { localStorage.setItem(storageKey, theme); setTheme(theme); }, }; return ( {children} ); } export const useTheme = () => { const context = useContext(ThemeProviderContext); if (context === undefined) throw new Error("useTheme must be used within a ThemeProvider"); return context; }; ================================================ FILE: frontend/src/components/theme-toggle/theme-toggle.tsx ================================================ import { Moon, Sun } from "lucide-react"; import { Button } from "@/components/ui/button"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; import { useTheme } from "@/components/providers/theme-provider"; export function ThemeToggle() { const { setTheme } = useTheme(); return ( setTheme("light")}> Light setTheme("dark")}> Dark setTheme("system")}> System ); } ================================================ FILE: frontend/src/components/ui/button.tsx ================================================ import * as React from "react"; import { Slot } from "@radix-ui/react-slot"; import { cva, type VariantProps } from "class-variance-authority"; import { cn } from "@/lib/utils"; import { Loader2 } from "lucide-react"; const buttonVariants = cva( "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive hover:cursor-pointer", { variants: { variant: { default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90", destructive: "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60", outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50", secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80", ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50", link: "text-primary underline-offset-4 hover:underline", warning: "bg-amber-500 text-white shadow-xs hover:bg-amber-400 focus-visible:ring-amber-200/20 dark:focus-visible:ring-amber-400/40", }, size: { default: "h-9 px-4 py-2 has-[>svg]:px-3", sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5", lg: "h-10 rounded-md px-6 has-[>svg]:px-4", icon: "size-9", }, }, defaultVariants: { variant: "default", size: "default", }, }, ); function Button({ className, variant, size, asChild = false, loading = false, ...props }: React.ComponentProps<"button"> & VariantProps & { asChild?: boolean; loading?: boolean; }) { const Comp = asChild ? Slot : "button"; if (loading) { return ( ); } return ( ); } export { Button, buttonVariants }; ================================================ FILE: frontend/src/components/ui/card.tsx ================================================ import * as React from "react"; import { cn } from "@/lib/utils"; function Card({ className, ...props }: React.ComponentProps<"div">) { return (
); } function CardHeader({ className, ...props }: React.ComponentProps<"div">) { return (
); } function CardTitle({ className, ...props }: React.ComponentProps<"div">) { return (
); } function CardDescription({ className, ...props }: React.ComponentProps<"div">) { return (
); } function CardAction({ className, ...props }: React.ComponentProps<"div">) { return (
); } function CardContent({ className, ...props }: React.ComponentProps<"div">) { return (
); } function CardFooter({ className, ...props }: React.ComponentProps<"div">) { return (
); } export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent, }; ================================================ FILE: frontend/src/components/ui/dropdown-menu.tsx ================================================ import * as React from "react" import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu" import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react" import { cn } from "@/lib/utils" function DropdownMenu({ ...props }: React.ComponentProps) { return } function DropdownMenuPortal({ ...props }: React.ComponentProps) { return ( ) } function DropdownMenuTrigger({ ...props }: React.ComponentProps) { return ( ) } function DropdownMenuContent({ className, sideOffset = 4, ...props }: React.ComponentProps) { return ( ) } function DropdownMenuGroup({ ...props }: React.ComponentProps) { return ( ) } function DropdownMenuItem({ className, inset, variant = "default", ...props }: React.ComponentProps & { inset?: boolean variant?: "default" | "destructive" }) { return ( ) } function DropdownMenuCheckboxItem({ className, children, checked, ...props }: React.ComponentProps) { return ( {children} ) } function DropdownMenuRadioGroup({ ...props }: React.ComponentProps) { return ( ) } function DropdownMenuRadioItem({ className, children, ...props }: React.ComponentProps) { return ( {children} ) } function DropdownMenuLabel({ className, inset, ...props }: React.ComponentProps & { inset?: boolean }) { return ( ) } function DropdownMenuSeparator({ className, ...props }: React.ComponentProps) { return ( ) } function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<"span">) { return ( ) } function DropdownMenuSub({ ...props }: React.ComponentProps) { return } function DropdownMenuSubTrigger({ className, inset, children, ...props }: React.ComponentProps & { inset?: boolean }) { return ( {children} ) } function DropdownMenuSubContent({ className, ...props }: React.ComponentProps) { return ( ) } export { DropdownMenu, DropdownMenuPortal, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, } ================================================ FILE: frontend/src/components/ui/form.tsx ================================================ import * as React from "react"; import * as LabelPrimitive from "@radix-ui/react-label"; import { Slot } from "@radix-ui/react-slot"; import { Controller, FormProvider, useFormContext, useFormState, type ControllerProps, type FieldPath, type FieldValues, } from "react-hook-form"; import { cn } from "@/lib/utils"; import { Label } from "@/components/ui/label"; const Form = FormProvider; type FormFieldContextValue< TFieldValues extends FieldValues = FieldValues, TName extends FieldPath = FieldPath, > = { name: TName; }; const FormFieldContext = React.createContext( {} as FormFieldContextValue, ); const FormField = < TFieldValues extends FieldValues = FieldValues, TName extends FieldPath = FieldPath, >({ ...props }: ControllerProps) => { return ( ); }; const useFormField = () => { const fieldContext = React.useContext(FormFieldContext); const itemContext = React.useContext(FormItemContext); const { getFieldState } = useFormContext(); const formState = useFormState({ name: fieldContext.name }); const fieldState = getFieldState(fieldContext.name, formState); if (!fieldContext) { throw new Error("useFormField should be used within "); } const { id } = itemContext; return { id, name: fieldContext.name, formItemId: `${id}-form-item`, formDescriptionId: `${id}-form-item-description`, formMessageId: `${id}-form-item-message`, ...fieldState, }; }; type FormItemContextValue = { id: string; }; const FormItemContext = React.createContext( {} as FormItemContextValue, ); function FormItem({ className, ...props }: React.ComponentProps<"div">) { const id = React.useId(); return (
); } function FormLabel({ className, ...props }: React.ComponentProps) { const { error, formItemId } = useFormField(); return (