First account created at /admin is a resident, so a fresh install has no admin
Back to our planProblem
On an empty database, the first account created at /admin (Payload's first-register) gets the role resident, not admin. The role field in src/modules/accounts/cms/users.ts has defaultValue: resident and field-level create: isAdminFieldAccess, and at first registration nobody is signed in, so the role the form sends is dropped and the default applies. A resident can't use /admin (admin: isAdminOrEditorBoolean), so the setup step in docs/project.md ("Visit /admin for first-time Payload admin setup (create first admin user)") leaves a fresh install with no usable admin.
Production is not affected today (it already has an admin), but every new local setup, and a restore onto an empty database, is.
Found while proving #141 locally (the builder promoted the account by hand in local databases).
Acceptance criteria
- The first account created on an empty
userscollection is an admin; every later account still defaults to resident and only an admin can change roles. - Native first: use Payload's own first-user handling if it offers one (for example a
beforeChangehook that checks the operation iscreateand the collection is empty), not a public way to choose a role. - A test: first user on an empty DB is admin; a second user created the same way is resident; a visitor or resident still can't set
role. docs/project.mdsetup step stays accurate.
Generated by Claude Code, opens in a new tab