Add GoTo reference docs and screenshots #52
No files matched your search
+13
-1
@@ -1,5 +1,17 @@
|
||||
/.nono.json
|
||||
/docs/
|
||||
/docs/*
|
||||
!/docs/config.md
|
||||
!/docs/development.md
|
||||
!/docs/philosophy.md
|
||||
!/docs/screenshots.md
|
||||
!/docs/testing.md
|
||||
!/docs/images/
|
||||
/docs/images/*
|
||||
!/docs/images/overview.png
|
||||
!/docs/images/sign-in.png
|
||||
!/docs/images/analytics.png
|
||||
!/docs/images/health.png
|
||||
!/docs/images/link.png
|
||||
/AGENTS.md
|
||||
|
||||
node_modules/
|
||||
|
||||
+6
-1
@@ -9,7 +9,12 @@ coverage/
|
||||
playwright-report/
|
||||
test-results/
|
||||
pnpm-lock.yaml
|
||||
/docs/
|
||||
/docs/*
|
||||
!/docs/config.md
|
||||
!/docs/development.md
|
||||
!/docs/philosophy.md
|
||||
!/docs/screenshots.md
|
||||
!/docs/testing.md
|
||||
/AGENTS.md
|
||||
/.nono.json
|
||||
.env
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
A small, self-hosted URL shortener. Give a long address a short name and get on with it.
|
||||
|
||||

|
||||
|
||||
One YAML file can run links for several domains. The admin shows what’s configured and how often links are used. To change a link, edit the file.
|
||||
|
||||
## Get started
|
||||
@@ -43,18 +45,10 @@ docker compose up --wait
|
||||
|
||||
Open `/hello` on your host. It should send you on your way. Sign in at `/admin` to see the link. The worker prepares Analytics in the background, so don’t stare at the chart waiting for that first click.
|
||||
|
||||
## Why this way?
|
||||
## Documentation
|
||||
|
||||
**Why YAML?** You can review a diff and undo a bad edit. Keep the link rules in Git if you like; keep the passwords out of it. The admin is read-only so there’s no second place to change a link.
|
||||
|
||||
**Why a worker?** Sending someone to a link shouldn’t wait for a report. The web app redirects; the worker prepares reports from SQLite in the background.
|
||||
|
||||
**What gets kept?** Analytics keeps 90 days of detail by default. Set `analytics.retention_months: 0` to turn off detailed Analytics without losing lifetime totals. Stop both services before reducing retention or switching between zero and a positive value, then start them again.
|
||||
|
||||
## Configuration
|
||||
|
||||
Admin and short links can share a host or use separate ones. The [example YAML](examples/goto.yaml) shows multiple domains, SSO, tags and conditional redirects. The [schema](packages/config/src/config.schema.json) has the full list. Most link edits take effect without a restart.
|
||||
|
||||
## Development
|
||||
|
||||
The [development Compose file](apps/web/docker-compose.dev.yml) reloads the app as you edit. For local tooling, [mise](mise.toml) pins Node and pnpm. `pnpm verify` runs the checks, including Chromium browser tests.
|
||||
- [Configuration](docs/config.md)
|
||||
- [Development](docs/development.md)
|
||||
- [Philosophy](docs/philosophy.md)
|
||||
- [Testing](docs/testing.md)
|
||||
- [Screenshots](docs/screenshots.md)
|
||||
@@ -0,0 +1,83 @@
|
||||
# Configuration
|
||||
|
||||
GoTo reads `config/goto.yaml` unless `CONFIG_PATH` points somewhere else. This page explains the fields without requiring an editor extension. For a complete example, see [examples/goto.yaml](../examples/goto.yaml). The [JSON schema](../packages/config/src/config.schema.json) is also served at `/schema.json` on the admin origin.
|
||||
|
||||
## Application settings
|
||||
|
||||
| Setting | Meaning and default |
|
||||
| -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `version` | Configuration format version. Set it to `1`, or omit it. This is not the GoTo release version. |
|
||||
| `url.app` | The admin origin, including `http://` or `https://` and any port. No path, trailing slash, query, or fragment. Defaults to `http://localhost:3000`, or `http://localhost:5173` in development. Set it explicitly when using a different origin. |
|
||||
| `url.worker` | The base URL the admin uses to check worker health. Defaults to `http://goto-worker:9000`. It does not set the worker’s listening address. |
|
||||
| `appearance.primary_light_color` | Accent color for light mode. Defaults to `'#0f766e'`. |
|
||||
| `appearance.primary_dark_color` | Accent color for dark mode. Defaults to `'#5eead4'`. Quote hex colors so YAML doesn’t read `#` as a comment. |
|
||||
| `database.path` | SQLite file for visit data and totals. Defaults to `./data/goto.sqlite`. |
|
||||
| `database.worker_path` | SQLite file for the worker’s workflow state. Defaults to `./data/worker.sqlite`. |
|
||||
| `analytics.retention_months` | Detailed analytics retention: `0`, `3`, `9`, or `12`. A month is 30 days. The default is `3` (90 days). `0` disables detailed Analytics; lifetime counts continue. |
|
||||
|
||||
Database paths are relative to the deployment directory above `config/` in the usual layout. Both services need access to the same visit database. The worker’s workflow database must be a different file. The link definitions live in YAML, not in SQLite.
|
||||
|
||||
## Authentication
|
||||
|
||||
Configure exactly one sign-in method. It protects the admin, not public redirects.
|
||||
|
||||
| Setting | Meaning |
|
||||
| -------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `auth.credentials.username`, `auth.credentials.password` | The shared username and password. Both are required for credential sign-in. |
|
||||
| `auth.oidc.issuer` | The OpenID Connect provider’s issuer URL. |
|
||||
| `auth.oidc.client_id`, `auth.oidc.client_secret` | The credentials issued by your OIDC provider. Both are required for OIDC sign-in. |
|
||||
| `auth.oidc.name` | Sign-in button label. Defaults to `Single Sign-On`. |
|
||||
| `auth.secret` | Optional session secret, at least 32 characters. Set a stable value to keep sessions across restarts. If omitted, GoTo generates one when the app starts. |
|
||||
|
||||
For OIDC, register `<url.app>/auth/callback/oidc` as the redirect URI. For example, use `https://go.example.org/auth/callback/oidc` when `url.app` is `https://go.example.org`. GoTo verifies the ID token returned by the provider. Restrict access to the GoTo client at your provider: GoTo does not assign separate admin roles.
|
||||
|
||||
Use environment variables for passwords and secrets you don’t want in the YAML file. For example, `password: '${GOTO_ADMIN_PASSWORD}'` reads `GOTO_ADMIN_PASSWORD` from the process environment. `${NAME:-fallback}` supplies a fallback only when the variable is unset. An empty value stays empty. Use `$$` for a literal dollar sign. Substitution applies to string values, not keys.
|
||||
|
||||
## Domains, root, and fallback
|
||||
|
||||
`domains` is required and maps hostnames to redirect settings. Use `domains: {}` if you have no redirect domains. Each domain requires `links`; use `links: {}` if it has no named links. Include the port for a host that uses a non-default port. List the admin host here if it should also serve short links; GoTo reserves its own app paths on that host.
|
||||
|
||||
| Setting | Meaning |
|
||||
| ------------------------- | ------------------------------------------------------------------------------------------------------------- |
|
||||
| `domains.<host>.links` | Named paths such as `/docs` and their settings. |
|
||||
| `domains.<host>.root` | Optional response for `/`. If omitted, `/` uses the domain’s effective fallback. |
|
||||
| `domains.<host>.fallback` | Optional response for a missing or inactive link on this domain. Overrides the top-level `fallback`. |
|
||||
| `fallback` | Optional default fallback for all domains. Without either fallback, a missing or inactive link returns `404`. |
|
||||
|
||||
Root and fallback responses take a required absolute HTTP(S) `url`, a `status_code` (default `302`), and `forward_query` (default `false`). They do not inherit the named-link defaults.
|
||||
|
||||
## Named links and defaults
|
||||
|
||||
Write the path as it should be matched, starting with `/`. Don’t put `/` itself under `links`; use `root`. Don’t add a trailing slash, use `.` or `..` path segments, or percent-encode characters just to spell a readable path. Keys aren’t percent-decoded by the configuration loader. `/@static/` is reserved.
|
||||
|
||||
The following settings can be set globally under `link_defaults`, then overridden under `domains.<host>.link_defaults` or on a link. The most specific value wins, including an explicit `false`.
|
||||
|
||||
| Setting | Meaning and global default |
|
||||
| ----------------------- | ---------------------------------------------------------------------------------------------------------------------- |
|
||||
| `status_code` | `301`, `302`, `307`, or `308`. Defaults to `302`. |
|
||||
| `case_insensitive` | Ignore case for ASCII letters only. Defaults to `true`. |
|
||||
| `ignore_trailing_slash` | Also match an incoming trailing slash. Defaults to `true`. |
|
||||
| `forward_path` | Match a path below the named link and append the remainder to the destination. Defaults to `false`. |
|
||||
| `forward_query` | Forward the query string. Incoming values replace destination values for the same parameter name. Defaults to `false`. |
|
||||
|
||||
These fields belong to individual links, not `link_defaults`:
|
||||
|
||||
| Setting | Meaning |
|
||||
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `url` | Required default destination. Use an absolute HTTP(S) URL without embedded credentials. |
|
||||
| `title`, `description` | Optional text for the link. |
|
||||
| `tags` | Optional list of case-sensitive labels. Defaults to an empty list. |
|
||||
| `enabled` | Defaults to `true`. Set `false` to send requests for this link to the fallback. |
|
||||
| `valid_from`, `valid_until` | Optional start and end timestamps. Quote an ISO timestamp with seconds and a timezone, such as `'2027-01-01T00:00:00Z'`. Outside the window, the link uses the fallback. |
|
||||
| `max_visits` | Optional positive integer limit on successful GET redirects. Omit for no limit. It is best-effort, not a strict quota. |
|
||||
| `redirect` | Optional ordered list of conditional destinations. Each rule has an `if` and a `to` URL. The first matching rule wins; if none match, GoTo uses `url`. |
|
||||
|
||||
A redirect rule can match `if.language`, `if.os`, or both. A rule with both conditions requires both to match. A primary language such as `fr` matches `fr` or `fr-CA` in `Accept-Language`; a full tag such as `fr-CA` requires that tag. Language preferences weighted below `0.9` are ignored. Recognized OS values are `ios`, `android`, `windows`, `macos`, `linux`, and `chromeos`.
|
||||
|
||||
## Validation and reloads
|
||||
|
||||
From a checkout with dependencies installed, run `pnpm cli config validate /path/to/goto.yaml` to validate the YAML and its environment substitutions. Use the same environment values you plan to give the services.
|
||||
|
||||
Most valid edits reload automatically. When an edit is rejected, the previous configuration stays active. Stop both services before changing the admin origin, authentication, database paths, reducing retention, or switching detailed Analytics on or off. Start both again with the new configuration.
|
||||
|
||||
If you change `.env` values, recreate the Compose containers with `docker compose up --wait --force-recreate` (using the same Compose file as before). Stopping and starting existing containers does not reload their environment.
|
||||
@@ -0,0 +1,20 @@
|
||||
# Development
|
||||
|
||||
Read the [philosophy](philosophy.md). Keep changes small.
|
||||
|
||||
With Docker Compose, run from `apps/web`:
|
||||
|
||||
```sh
|
||||
mkdir -p config data
|
||||
cp -n ../../examples/goto.yaml config/goto.yaml
|
||||
```
|
||||
|
||||
Edit `config/goto.yaml` before starting. Set `url.app` to `http://localhost:5173` and configure `localhost:5173` as a domain if you want to try redirects on the same host. Replace the example OIDC block with development credentials or configure your own provider. Set the referenced secrets in `apps/web/.env`, or omit `auth.secret` for a throwaway local session secret. See the [configuration reference](config.md) for the fields.
|
||||
|
||||
Make `data/` writable by the container user. The default UID and GID are `1000:1000`; on Linux, set `LOCAL_UID` and `LOCAL_GID` in the Compose environment to match your user if they differ.
|
||||
|
||||
```sh
|
||||
docker compose -f docker-compose.dev.yml up --build --wait
|
||||
```
|
||||
|
||||
Open [the admin](http://localhost:5173/admin). The dev Compose setup runs the web app and worker; the web app hot-reloads as you edit. If you have mise and fnox, `mise run docker -- up --build --wait` wraps the same Compose command. See [Testing](testing.md) for checks.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 116 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 91 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 89 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 45 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,9 @@
|
||||
# Philosophy
|
||||
|
||||
GoTo is for the short links I keep. I built it for myself and other self-hosters whose links are mostly stable shortcuts, not hundreds of randomly generated URLs.
|
||||
|
||||
The important part is the link itself: its name, where it goes, and the rules it follows. That belongs in a text file I can read, back up, and restore. SQLite stores visit counts and analytics, not the link definitions. The admin shows what’s configured without becoming a second place to edit it. It can use the sign-in system I already run.
|
||||
|
||||
I want GoTo to be simple, fast, and readable, without asking a small self-hosted setup to run more than it needs. Those tradeoffs are the point.
|
||||
|
||||
If you need an API, integrations, or a shortener that scales, use [Shlink](https://shlink.io/). It’s the best self-hosted shortener for that job, hands down. GoTo is for a smaller job.
|
||||
@@ -0,0 +1,19 @@
|
||||
# Screenshots
|
||||
|
||||
GoTo in light mode with demo data. The admin overview is in the [README](../README.md).
|
||||
|
||||
## Sign-in
|
||||
|
||||

|
||||
|
||||
## Analytics
|
||||
|
||||

|
||||
|
||||
## Health
|
||||
|
||||

|
||||
|
||||
## Link
|
||||
|
||||

|
||||
@@ -0,0 +1,15 @@
|
||||
# Testing
|
||||
|
||||
From the repository root, use the Node and pnpm versions pinned in [mise.toml](../mise.toml):
|
||||
|
||||
```sh
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm --filter @goto/web exec playwright install chromium
|
||||
pnpm verify
|
||||
```
|
||||
|
||||
`pnpm verify` checks editor schema drift, builds the apps, checks types and lint, runs workspace tests with coverage, exercises the production web build in Chromium, and runs the worker smoke test. Playwright needs Chromium and its system dependencies.
|
||||
|
||||
For a smaller run, use `pnpm --filter @goto/config test`. For web tests on a fresh checkout, run `pnpm build:packages` first, then `pnpm --filter @goto/web test`. After changing the configuration schema, run `pnpm schema:generate` and include the resulting editor schema in the change.
|
||||
|
||||
Prefer focused tests of GoTo’s behavior. Use browser tests for boundaries that need the production server or a real browser, such as sign-in and host routing. Use the [development setup](development.md) to check hot reload in a working app; the browser suite tests the production build instead.
|
||||
Reference in new issue
Block a user