superadminis the service account of the team that builds and maintains the app. It keeps access for the support period, and the client can’t change or remove it.adminis the client’s administrator. It manages users and data, but can’t touch service accounts.
Because the client can’t remove service accounts, your team decides when support access ends, and removes it as described below.
At handover
Create the accounts right after the first successful deploy, before you open sign-up. On Railway, runadmin:create from your machine through railway run with the database’s public URL (see Create the first accounts).
1
Create the service account with the client's organization name
The first
admin:create on an empty database creates the organization, and --org-name only works then. Without it, the organization gets the placeholder project name.2
Create the client admin
Omit Both accounts become
--role; the default is admin.owner of the same organization. The order of accounts doesn’t change that.3
Let the client set their own password
Don’t hand over the generated password. Ask the client to use “forgot password” (
/forgot-password) to set their own. It also proves that production email works.If you do share the generated password, use a secure channel and ask them to change it on /account. Neither a reset nor a change signs out other sessions, so don’t sign in to the client’s account yourself.4
Walk through it with the client
The client signs in and opens Users. Service accounts show a service badge and no Sign in as button.
5
Agree on the flags
Decide with the client on
ADMIN_IMPERSONATION (may their admin impersonate regular users?), MULTI_ORG and AUTH_PUBLIC_SIGNUP. Set them on the service and redeploy. Until now, AUTH_PUBLIC_SIGNUP must stay false.With AUTH_PUBLIC_SIGNUP=true and MULTI_ORG=false, anyone who signs up becomes a member of the client’s organization.owner of the client’s organization, so it works there like any owner: no service-mode banner and no confirmation dialog on data changes. Service mode applies only when a superadmin works in an organization they’re not a member of.
Access outside the app
App roles don’t cover infrastructure. Anyone with access to the Railway project has the database and every variable, includingBETTER_AUTH_SECRET. The kit doesn’t manage access to Railway, the repository, Resend or your log collector; agree on transferring those with the client separately.
Remove support access
At the end of the support period, a superadmin removes the team’s access. The order matters because of how better-auth and the kit work:- An account can’t delete itself.
/admin/remove-useranswers400 "You cannot remove yourself", so the last service account can’t remove itself. - Changing the role to
userdoesn’t remove theownermembership, so the account would still see organization data. - The change is one-way. Once the role is
user, it can’t be restored: only a superadmin can grantsuperadmin. - Impersonation sessions outlive the impersonator. A Sign in as session belongs to the impersonated account, expires after 3600 seconds, and isn’t deleted when the service account is removed.
After step 6, your team has no access to app data. Deleting the account in step 7 cascades to its sessions, sign-in methods, memberships and the invitations it sent.
The API calls
The kit has no UI for changing roles, deleting accounts or leaving organizations, so these steps call better-auth endpoints under/api/auth/ from the browser’s developer console. Open the app at the APP_URL address and sign in first: fetch from that tab sends the session cookie and Origin header, and better-auth rejects other origins.
When you’re the only owner
If step 4 fails with"You cannot leave the organization as the only owner", the service account is the sole owner, for example of an organization it created itself with MULTI_ORG=true. This doesn’t happen in the organization created by admin:create, because the client admin is an owner too.
The members form doesn’t assign owner, and better-auth lets only an owner grant it. So before step 5, while you’re still an owner, promote someone from the client who is a member:
-
Open
/api/auth/organization/list-members?organizationId=<organization id>and take the membershipid(notuserId) of that person. -
Run:
- Repeat step 4 for that organization.
/api/auth/organization/delete with { "organizationId": "<organization id>" }. With MULTI_ORG=false, the kit allows this only for a global admin or superadmin. Deleting cascades to its memberships and invitations.
Between steps 5 and 6, UI elements that read the role from the cookie cache may show admin menus for up to 5 minutes. Data stays protected:
getOrgContext() reads the session from the database, bypassing the cookie cache.Related
Superadmin and service mode
What service accounts can do and how service mode works.
Auth and roles
Global roles, organization roles and sign-up policy.
Deploy on Railway
The deploy steps that come before handover.
Known limitations
Impersonation and service accounts after support.