steid

@jamesgill /

steid/plans/decisions/0004-root-handles-grouped-routes.md
Markdown6.4 KBRendered·Source·Blame·History·Raw
1# 0004 — Handles at the root, application routes grouped under prefixes
2
3**Status:** accepted · **Date:** 2026-08-04 · **Supersedes:** [0003]0003-scoped-urls.md
4
5> **Note, 2026-09-27.** The URL scheme recorded here still stands; its justification is
6> now [0010]0010-single-tenant-vcs-not-portfolio.md. The owner's handle — a person or
7> an organisation — is the front door of the instance, not a CV URL. The original text
8> is kept below as written.
9
10## Context
11
12[0003]0003-scoped-urls.md scoped handles under `/user/{handle}` to eliminate the
13reserved-word problem. It worked, but it paid for that with the thing Steid is
14supposedly about: `/james` is a URL you put on a CV, `/user/james` is a URL an app
15gives you. For a portfolio-first product the profile URL is part of the product, and
160003 traded it away for an implementation concern.
17
18The reserved-word problem is real, though. Handles at the root share a namespace with
19application routes, so `/login` and a user called `login` cannot coexist.
20
21The insight that makes both possible: the denylist only has to grow per *route* if
22routes live at the root. Group them under functional prefixes and the list grows per
23*area* instead — rarely, and predictably.
24
25## Decision
26
27Handles live at the root. Application routes are grouped under functional prefixes, and
28content below a handle is grouped by type.
29
30```
31/james profile
32/james/repos/{name} repository
33/james/posts/{slug} writing
34
35/auth/login sign in
36/auth/logout
37/auth/setup first-run claim
38/api/... JSON
39```
40
41A lean denylist in `OrgName::new` reserves the prefixes, checked against the normalised
42lowercase form so `API` and `api` are the same handle:
43
44```
45about admin api assets auth dashboard docs explore help legal
46notifications privacy search security settings static status steid support terms
47```
48
49Adding `/auth/reset-password` costs nothing. Only a genuinely new *area* adds an entry.
50
51`steid` is reserved so nobody can hold the project's own name and impersonate the
52software. The legal cluster (`privacy`, `terms`, `legal`, `security`) is there because a
53publicly hosted instance conventionally wants those at the root.
54
55**The test for adding one:** could this ever be a top-level route? Under grouping,
56almost nothing is — a health check is `/api/health`, sign-up is `/auth/register`. Words
57that would live under a prefix do not belong on the list.
58
59## Alternatives considered
60
61- **`/user/{handle}` scoping** ([0003]0003-scoped-urls.md). Zero denylist, no
62 ambiguity. Rejected for the URL it produces; the maintenance it avoided turned out to
63 be small once routes were grouped.
64- **A sigil for system routes** (`/-/login`, as GitLab uses). Genuinely zero denylist —
65 `OrgName` already rejects handles starting or ending with a hyphen, so `-` is
66 structurally unclaimable. Rejected because `/auth/login` says what it is and `/-/login`
67 makes you learn a convention, and readable URLs are worth a ten-word list on a product
68 where URLs are part of the presentation.
69- **Root handles with a per-route denylist** (GitHub, Gitea). What grouping exists to
70 avoid: the list grows every time a route is added and fails silently when someone
71 forgets.
72
73## Consequences
74
75- **`/james` is the profile URL.** Clone URLs come out as
76 `https://host/james/repos/steid.git`, comparable to GitHub's.
77- **Content types cannot collide with each other**, because everything below a handle is
78 grouped: `/james/repos/x` and `/james/posts/x` coexist, and a repo named `posts` is
79 fine at `/james/repos/posts`.
80- **A small denylist exists and must be maintained**, unlike under 0003. It is enforced
81 in `OrgName::new` with tests, so it fails loudly at claim time rather than producing a
82 shadowed route.
83- **Reserve early.** Adding an entry later is a breaking change for whoever holds that
84 handle — the account must be renamed and its links break. Reserving while unclaimed is
85 free, which is why the list covers areas that do not exist yet.
86- **An unknown root path is ambiguous** — `/jmaes` could be a typo'd handle or a missing
87 page. Both 404, so this costs little in practice.
88- **`orgs.kind` is no longer needed for routing.** 0003 required it to tell `/user/`
89 from `/org/`; with one root namespace, both are just `/{handle}`. It may still be
90 worth having for display, but it is not load-bearing and is dropped from Milestone 2.
91- Topcoat serves its assets from `/_topcoat/`, which the character rules already exclude,
92 so it needs no reservation. The same holds for `/.well-known/` (federation,
93 `security.txt`), `robots.txt`, `favicon.ico` and `sitemap.xml` — every conventional
94 root path that contains a `.` or `_` is unreachable as a handle for free.
95
96## How this ages — prior art
97
98GitHub's namespace is flat, and it pays for it: community mirrors of its reserved list
99run to [590+ names]https://github.com/shouldbee/reserved-usernames, with no official
100list published. You discover a name is taken when signup rejects it.
101
102GitLab is the more useful comparison, because they hit it hard enough to build
103machinery. Their reserved names live in `namespace_validator.rb` and
104`project_path_validator.rb`, and their docs state plainly that as new functionality is
105introduced, more restrictions will be added — the list is expected to grow forever. Two
106details bear on us:
107
108- **Their reservation is depth-dependent.** A group named `api` is rejected at the top
109 level but allowed nested under another namespace, where nothing collides. That is
110 exactly the property grouping gives us, and it is what our substring and nesting tests
111 pin down.
112- **They built `RenameReservedPathsMigration`** — tooling to forcibly rename users who
113 already hold a newly-reserved path. That is the escape hatch for the breaking change
114 described above, and the reason their list can keep growing.
115
116The cost runs both ways: GitLab has a long-standing open issue,
117[*Rename GitLab-reserved paths that our users want to use*]https://gitlab.com/gitlab-org/gitlab/-/issues/16854,
118trying to give paths back. Over-reserving is not free either.
119
120**Deliberately not built yet:** a rename path. With a single user who is also the
121operator, adding a reserved word means renaming yourself. It becomes worth having around
122Milestone 7, when multi-user registration means handles stop being ours to reassign
123freely — but building it now would be machinery for a problem that does not exist.