Skip to content

Commit 09f3269

Browse files
committed
refactor: make getting started guide easier to follow
1 parent ca4af6c commit 09f3269

20 files changed

Lines changed: 208 additions & 111 deletions

‎.github/workflows/deploy.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Install dependencies
2727
run: bun install
2828
- name: Build with VitePress
29-
run: bun run docs:build
29+
run: bun run build
3030
- name: Upload artifact
3131
uses: actions/upload-pages-artifact@v3
3232
with:

‎.vitepress/config.mts‎

Lines changed: 90 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,89 @@
11
import { defineConfig } from "vitepress";
2+
import { withMermaid } from "vitepress-plugin-mermaid";
23

3-
export default defineConfig({
4-
title: "Tinyauth",
5-
description: "Login screen for your apps",
6-
themeConfig: {
7-
logo: "/logo.png",
8-
nav: [
9-
{ text: "Home", link: "/" },
10-
{ text: "Docs", link: "/docs/getting-started" },
11-
{ text: "Screenshots", link: "/docs/screenshots" },
12-
],
4+
export default withMermaid(
5+
defineConfig({
6+
title: "Tinyauth",
7+
description: "Login screen for your apps",
8+
themeConfig: {
9+
logo: "/logo.png",
10+
nav: [
11+
{ text: "Home", link: "/" },
12+
{ text: "Docs", link: "/docs/getting-started" },
13+
{ text: "Screenshots", link: "/docs/screenshots" },
14+
],
1315

14-
sidebar: [
15-
{
16-
text: "Get Started",
17-
items: [{ text: "Getting started", link: "/docs/getting-started" }],
18-
},
19-
{
20-
text: "Reference",
21-
items: [
22-
{ text: "Configuration", link: "/docs/reference/configuration" },
23-
{ text: "API", link: "/docs/reference/api" },
24-
{ text: "Flow", link: "/docs/reference/flow" },
25-
{ text: "CLI", link: "/docs/reference/cli" },
26-
{ text: "Headers", link: "/docs/reference/headers" },
27-
],
28-
},
29-
{
30-
text: "Guides",
31-
items: [
32-
{ text: "Github OAuth", link: "/docs/guides/github-oauth" },
33-
{ text: "Google OAuth", link: "/docs/guides/google-oauth" },
34-
{ text: "Tailscale OAuth", link: "/docs/guides/tailscale-oauth" },
35-
{ text: "Github App OAuth", link: "/docs/guides/github-app-oauth" },
36-
{ text: "Access controls", link: "/docs/guides/access-controls" },
37-
{ text: "Tinyauth with Runtipi", link: "/docs/guides/runtipi" },
38-
{ text: "Tinyauth with Nginx Proxy Manager", link: "/docs/guides/nginx-proxy-manager" },
39-
]
40-
},
41-
{
42-
text: "Contributing",
43-
items: [{ text: "Contributing", link: "/docs/contributing" }],
44-
},
45-
{
46-
text: "Advanced configs",
47-
items: [{ text: "Advanced configs", link: "/docs/advanced" }],
48-
},
49-
{
50-
text: "Community",
51-
items: [{ text: "Caddy", link: "/docs/community/caddy" }],
52-
},
53-
{
54-
text: "Changelog",
55-
items: [{ text: "Changelog", link: "/docs/changelog" }],
56-
},
57-
{
58-
text: "Screenshots",
59-
items: [{ text: "Screenshots", link: "/docs/screenshots" }],
60-
},
61-
],
16+
sidebar: [
17+
{
18+
text: "Get Started",
19+
items: [
20+
{ text: "About Tinyauth", link: "/docs/about" },
21+
{ text: "Getting started", link: "/docs/getting-started" },
22+
],
23+
},
24+
{
25+
text: "Reference",
26+
items: [
27+
{ text: "Configuration", link: "/docs/reference/configuration" },
28+
{ text: "API", link: "/docs/reference/api" },
29+
{ text: "Flow", link: "/docs/reference/flow" },
30+
{ text: "CLI", link: "/docs/reference/cli" },
31+
{ text: "Headers", link: "/docs/reference/headers" },
32+
],
33+
},
34+
{
35+
text: "Guides",
36+
items: [
37+
{ text: "Github OAuth", link: "/docs/guides/github-oauth" },
38+
{ text: "Google OAuth", link: "/docs/guides/google-oauth" },
39+
{ text: "Tailscale OAuth", link: "/docs/guides/tailscale-oauth" },
40+
{ text: "Github App OAuth", link: "/docs/guides/github-app-oauth" },
41+
{ text: "Access controls", link: "/docs/guides/access-controls" },
42+
{
43+
text: "Two factor authentication",
44+
link: "/docs/guides/totp",
45+
},
46+
{ text: "Tinyauth with Runtipi", link: "/docs/guides/runtipi" },
47+
{
48+
text: "Tinyauth with Nginx Proxy Manager",
49+
link: "/docs/guides/nginx-proxy-manager",
50+
},
51+
],
52+
},
53+
{
54+
text: "Contributing",
55+
items: [{ text: "Contributing", link: "/docs/contributing" }],
56+
},
57+
{
58+
text: "Advanced configs",
59+
items: [{ text: "Advanced configs", link: "/docs/advanced" }],
60+
},
61+
{
62+
text: "Community",
63+
items: [{ text: "Caddy", link: "/docs/community/caddy" }],
64+
},
65+
{
66+
text: "Changelog",
67+
items: [{ text: "Changelog", link: "/docs/changelog" }],
68+
},
69+
{
70+
text: "Screenshots",
71+
items: [{ text: "Screenshots", link: "/docs/screenshots" }],
72+
},
73+
],
6274

63-
socialLinks: [
64-
{ icon: "github", link: "https://github.com/steveiliop56/tinyauth" },
65-
{ icon: "discord", link: "https://discord.gg/eHzVaCzRRd" },
66-
],
67-
},
68-
head: [
69-
["link", { rel: "icon", href: "/favicon.ico" }],
70-
["link", { rel: "manifest", href: "/site.webmanifest" }],
71-
["script", {}, `
75+
socialLinks: [
76+
{ icon: "github", link: "https://github.com/steveiliop56/tinyauth" },
77+
{ icon: "discord", link: "https://discord.gg/eHzVaCzRRd" },
78+
],
79+
},
80+
head: [
81+
["link", { rel: "icon", href: "/favicon.ico" }],
82+
["link", { rel: "manifest", href: "/site.webmanifest" }],
83+
[
84+
"script",
85+
{},
86+
`
7287
const umamiAttributes = {
7388
src: "https://analytics.doesmycode.work/script.js",
7489
"data-website-id": "ed560a2b-b321-4745-b2f8-d7de846aeb7f",
@@ -81,9 +96,11 @@ export default defineConfig({
8196
);
8297
8398
document.head.appendChild(umamiScript);
84-
`]
85-
],
86-
sitemap: {
87-
hostname: "https://tinyauth.app",
88-
}
89-
});
99+
`,
100+
],
101+
],
102+
sitemap: {
103+
hostname: "https://tinyauth.app",
104+
},
105+
})
106+
);

‎.vitepress/theme/custom.css‎

Lines changed: 0 additions & 7 deletions
This file was deleted.

‎.vitepress/theme/index.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
import DefaultTheme from "vitepress/theme";
2-
import "./custom.css";
32

43
export default DefaultTheme;

‎bun.lockb‎

51.7 KB
Binary file not shown.

‎docs/about.md‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# About tinyauth
2+
3+
Before installing tinyauth you may be wondering _Why should I use tinyauth instead of Authelia/Authentik/Keycloack?_ which is a really valid question and I would like to answer in depth.
4+
5+
## The issue with authentication on homelabs
6+
7+
Most of us like using an authentication middleware in front of our apps to either protect them when they don't offer a login screen or just to add an additional level of authentication. While the projects mentioned above can certainly do the job and offer a variety of configuration options, they can be hard to configure for new users, resource hungry (apps like Authentik and Keycloack are designed for businesses and not the average homelabber) or simply too annoying to set up and maintain. This is where tinyauth comes in to play.
8+
9+
## Why I created tinyauth
10+
11+
Tinyauth was created to test my skills in making a quite complex app and most importantly to solve the issues mentioned above. I tried a wide variety of authentication projects but most of them didn't even support traefik's forward auth out of the box so they needed weird plugins requiring more and more containers. When I created tinyauth I only had one thing in mind, make it as simple as possible, no fancy dashboards, no complex configuration files, no databases and the entire configuration could be done with simple environment variables everyone knows and loves.
12+
13+
## The use case for tinyauth
14+
15+
Tinyauth by no means is made for production use cases, by this I mean that it is designed solely for adding a login screen to the apps of an average homelaber that just wants to secure his infrastructure a bit more. While I consider tinyauth secure enough to even be exposed in the internet it has some limitations like being completely stateless (meaning that the server cannot expire a session) and not being able to get configured dynamically (e.g. updating the users requires a restart). If you need an app to handle multiple users and support more advanced backends (like LDAP) my recommendation is Authentik.
16+
17+
## The future plans for tinyauth
18+
19+
Tinyauth has reached a really good state where it supports almost everything you would ever need from an app like this, it supports what I believe are the most important features like OAuth, TOTP and even access controls and it also integrates very well with the most popular proxies like nginx, traefik and caddy. I am planning to keep the app in this state while slowly adding QOL updates, I am not planning to add any fancy dashboards or configuration files since I do not want to change the project's base idea.

‎docs/changelog.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Below you can find all release notes from all Tinyauth versions:
2525

2626
## v3.0.1
2727

28-
## Fixes
28+
### Fixes
2929

3030
- Fix the redirect URI not getting passed correctly to the continue screen
3131

‎docs/getting-started.md‎

Lines changed: 45 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,50 @@ As promised in the readme, tinyauth is extremely easy to get up and running.
66
Tinyauth by default ships with the traefik proxy, if you are using a different proxy there are available guides for [Nginx Proxy Manager](/docs/guides/nginx-proxy-manager) and [Caddy](/docs/community/caddy).
77
:::
88

9+
## Creating a user
10+
11+
A tinyauth user consists of 3 things, a username, a password hash and an optional TOTP secret:
12+
13+
```mermaid
14+
flowchart BR
15+
user["username:hash:totp"]
16+
user --> username["Username is your username in plaintext"]
17+
user --> hash["Hash is your password hashed in bcrypt"]
18+
user --> totp["TOTP is an optional TOTP secret"]
19+
```
20+
21+
To generate your user you can use the tinyauth CLI like so:
22+
23+
```sh
24+
docker run -i -t --rm ghcr.io/steveiliop56/tinyauth:v3 user create --interactive
25+
```
26+
27+
It will ask you for your username and password and then give you your new user. For more information about the create command check out the [reference](/docs/reference/cli.md#create-user-command).
28+
29+
::: info
30+
If you are using docker compose or environment variables make sure to pick yes in the format for docker so as your bcrypt hash is escaped correctly.
31+
:::
32+
33+
You can repeat this step as many times as you like and create a comma separated list of your users.
34+
35+
## Setting up your domains
36+
37+
The way tinyauth works is by setting a cookie for the parent domain of the app URL, in other words if your app URL is `http://tinyauth.sub.example.com`, tinyauth will set a cookie for `.sub.example.com` in order to be able to authenticate you. This means that all your apps will have to be under this subdomain. Here is an example:
38+
39+
```mermaid
40+
flowchart BR
41+
domain["sub.example.com"]
42+
domain --> tinyauth["tinyauth.sub.example.com"]
43+
domain --> app["app.sub.example.com"]
44+
```
45+
46+
::: warning
47+
You cannot use tinyauth directly in DDNS services (e.g. `tinyauth562.duckdns.org`) it **_has to_** be under a subdomain (e.g. `tinyauth.mylab562.duckdns.org`) as well as all of your apps.
48+
:::
49+
950
## Installation
1051

11-
To get started simply add the tinyauth service next to your traefik container:
52+
Now it's time to create our docker compose file which can be as simple as this:
1253

1354
```yaml
1455
tinyauth:
@@ -25,16 +66,8 @@ tinyauth:
2566
traefik.http.middlewares.tinyauth.forwardauth.address: http://tinyauth:3000/api/auth/traefik
2667
```
2768
28-
::: info
29-
Make sure to set the labels according to your own setup, this guide includes the most basic ones.
30-
:::
31-
32-
::: info
33-
Tinyauth accepts a comma separated list of `username:hash` combinations. Make sure escape the dollar signs by doubling them. If you are unsure on how to create your user you can use the tinyauth CLI by running `docker run -i -t --rm --name tinyauth ghcr.io/steveiliop56/tinyauth:v3 user create --interactive` or use [IT Tools](https://it-tools.tech/bcrypt) to generate the password hash.
34-
:::
35-
3669
::: tip
37-
Use this command to generate the `SECRET` value: `tr -dc A-Za-z0-9 </dev/urandom | head -c 32; echo`
70+
You can generate the `SECRET` environment variable using `openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | head -c 32`.
3871
:::
3972

4073
Then for every app you want tinyauth to protect just add the following label:
@@ -45,9 +78,9 @@ traefik.http.routers.[your-router].middlewares: tinyauth
4578

4679
And that's it! When you try to visit an app you should be redirected to the tinyauth login page.
4780

48-
## Example Docker compose file
81+
## Example docker compose file
4982

50-
Here is a full example with traefik, nginx and tinyauth:
83+
Here is a full example with traefik, whoami and tinyauth:
5184

5285
```yaml
5386
services:

‎docs/guides/runtipi.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ The runtipi app also includes inputs for Github, Google and Tailscale so if you
1212

1313
Runtipi by default uses its own login screen for authentication, we want to replace that with tinyauth. This can be done by enabling advanced settings:
1414

15-
<img src="/screenshots/runtipi_enable_advanced_settings.png" alt="Enable advanced settings" width="256">
15+
<img src="/screenshots/runtipi-enable-advanced-settings.png" alt="Enable advanced settings" width="256">
1616

1717
And settings the forward auth URL to `http://tinyauth:3000/api/auth/traefik`:
1818

19-
![Set forward auth URL](/screenshots/runtipi_forward_auth_url.png)
19+
![Set forward auth URL](/screenshots/runtipi-forward-auth-url.png)
2020

2121
Finally make sure to save your settings and restart runtipi.
2222

@@ -32,7 +32,7 @@ You can customize more aspects of tinyauth, like adding a generic OAuth provider
3232

3333
From now on, you can enable authentication for every app you like by opening its settings and flipping the enable authentication switch:
3434

35-
<img src="/screenshots/runtipi_install_app_example.png" alt="Install app example" width="512">
35+
<img src="/screenshots/runtipi-install-app-example.png" alt="Install app example" width="512">
3636

3737
::: warning
3838
For authentication to work correctly you either need to use the local domain or make sure that the expose domain is under the same root level domain as tinyauth. For example `tinyauth.example.com` and `nginx.example.com` will work but `tinyauth.domain1.com` and `nginx.domain2.com` will **not** work.

‎docs/guides/totp.md‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Two factor authentication with tinyauth
2+
3+
Tinyauth has built-in support for TOTP, this means that you can use your favorite authenticator app to get 2FA codes when trying to login to tinyauth.
4+
5+
## Generating the secret
6+
7+
We firstly need to generate our TOTP secret, to do this we will need our current `username:hash`. Then we can use the tinyauth CLI to create our new user. This can be done like so:
8+
9+
```sh
10+
docker run -i -t --rm ghcr.io/steveiliop56/tinyauth:v3 totp generate --interactive
11+
```
12+
13+
It will prompt you for your user and then give you (a massive) QR code to scan with your authenticator app. After you add it you can copy your newly generated user (the part after the `user=` log message) and add it to your tinyauth user list and restart. Finally every time you try to login tinyauth will prompt your for your TOTP code.
14+
15+
## Verifying your user
16+
17+
If you are unsure if your user is correct you can use the following command to check:
18+
19+
```sh
20+
docker run -i -t --rm ghcr.io/steveiliop56/tinyauth:v3 user verify --interactive
21+
```
22+
23+
It will prompt you for your user (`username:hash:totp`), your username, your password (actual password) and a TOTP code from your authenticator app. If everything succeeds you should see the user verified message.

0 commit comments

Comments
 (0)