Accounts on a shared instance
What keeps several people on one Hotaru instance apart, and what an admin can do about each account (SI-563). Logging in, sessions and tokens are in auth.md. The rate limits are in api.md.
Isolation
Sources and items are shared: a feed several people follow is fetched once. Everything a person owns or decides carries their user_id, and every query filters by it (conventions.md). Two test suites check that this holds everywhere:
- The API:
apps/web/src/lib/server/isolation.spec.ts. Alice owns one of everything, each named with a marker. Bob calls every route of the capability list with Alice’s IDs in the path, the body or the query. No answer may contain the marker, a route that names something of Alice’s must refuse (4xx), and Alice’s rows must be the same afterwards. A route without a case fails the suite, so a new endpoint can’t skip it. The routes outside the API (an item’s image, the starred feed) and the live event stream are checked too. - The agent’s tools:
packages/core/src/agent/tools-isolation.spec.ts. Every tool, run for Bob with Alice’s IDs and names, shows and changes nothing of hers, and Bob can’t confirm, cancel or undo her agent’s changes. The chat’s own test checks that each reader’s conversation is their own.
Sources are shared by URL, but nothing on them that one account sets changes another’s: a JSON API’s mapping and a web page’s recipe are part of the source’s URL, so changing either moves only your subscription (source-types.md, SI-572).
Quotas
Each account has three limits. An admin sets the defaults and, for any account, limits of its own. Admins have no limits.
| Limit | Default | What it counts | When it’s reached |
|---|---|---|---|
| Sources | 1,500 | Subscriptions | Following one more answers 403. An import follows what fits and lists the rest under “couldn’t import”, with the reason. |
| Text kept | 500 MB | The text of items in sources nobody else on the instance follows, the account’s links included: title, excerpt, content and extracted text. Shared sources count for no one. | Following a new source or adding a link answers 403. |
| Highest AI budget | $10 a month | The monthly budget the account may set (costs.md). Doesn’t apply to an account with its own OpenRouter key: it pays (costs.md). Without one, an account that isn’t an admin has no AI at all (costs.md). | Setting more answers 403. A budget set before the limit was lowered is capped at the limit. |
A limit never takes anything away. An account over a limit, after an admin lowered it, keeps what it has and can’t add more until it’s under. Fetching its sources goes on. Full texts are removed after 90 days (retention), so the text kept shrinks on its own.
The text kept is summed at most every 10 minutes per account, since summing a large account’s items takes a moment. The code: packages/core/src/services/quotas.ts. The defaults are stored in instance_settings (quotas), an account’s own limits in user_quotas (null: the default).
Each person sees their usage against their limits under Settings → Account.
The admin screen
Settings → Accounts (/settings/accounts), for admins only. Others get a 404 for the page and 403 from its API (/api/v1/admin/…). It shows every account with its role and status, sources, text kept and AI spend this month against its limits, when it was last seen in a browser, and the limits it’s over. An admin can:
- Change the default limits.
- Set an account’s own limits. An empty field means the default.
- Suspend an account. It can’t log in any more, its sessions end at once, its API tokens and starred feed stop working, and the pipeline and the chat make no paid calls for it. A page it already has open keeps its live connection until that drops; any request it then makes is refused. Nothing is deleted. Reactivate lets it back in.
- Delete an account, as below.
Under Registration it also says whether this instance sends email and, when it does, from which address and how the last email went since the server started: sent, or Resend’s error (email.md).
An admin can’t suspend or delete their own account here, and the last active admin can’t be suspended or deleted at all. Only the admin CLI makes admins (auth.md).
The same from the server’s terminal:
Registration
Who may make an account themselves (SI-564). An admin chooses on Settings → Accounts:
| Mode | Who | Email confirmation |
|---|---|---|
| Off (the default) | Nobody new. /register answers 404, invites included. Accounts come from the admin CLI (auth.md). |
— |
| Invite only | People with a working invite link. /register without one answers 404. |
Not needed: an admin vetted the invite. |
| Open | Anyone, on /register, linked from the login page. Invite links work too. |
Needed before the first login, unless an invite for the same address was used. |
The choice is stored in instance_settings (registration). Until an admin makes one, REGISTRATION_MODE (off, invite or open) decides, and the older REGISTRATION_ENABLED=true means open. Changing the mode never touches accounts that exist.
Registered accounts are always plain users. The form needs a name, an email, a password of 12 characters or more and, optionally, a username (3–30 letters, digits, dots or underscores).
Confirming the email: with open registration, the new account is pending and gets an email with a link that works for 24 hours (email.md). The link confirms the address, the account turns active, and the person logs in. Logging in before that, with the right password, sends a new link. The admin screen shows such accounts as Email not confirmed.
Invites
On Settings → Accounts → Invites, an admin makes an invite link, /register?invite=…. An invite for an email address is emailed there through Resend (SI-575, email.md), and the page says so. Without Resend, or when sending fails, the admin passes the link on. The page shows the link either way. Each one:
- is shown once, when it’s made. Only a SHA-256 hash of its code is stored.
- works once: using it and making the account are one step, so two people can’t share a link.
- works for 14 days, and only while registration is invite only or open.
- may be locked to one email address: then only that address can use it, the field is filled in, and the address counts as confirmed. Its link is emailed there when the instance sends email.
- can be revoked until it’s used.
The list shows each invite with its address, status (open, used and by whom, expired, revoked) and dates. An invite whose account is deleted stays in the list as used.
The code: packages/core/src/services/registration.ts.
Export
Settings → Account → Download my data, or GET /api/v1/me/export (a logged-in browser only). One JSON file with everything Hotaru keeps for the account:
- the account itself: name, email, username, role, when it was made
- the sources it follows (address, type, title, settings) and which tags each carries
- the items in its stream, with title, address and author
- every row it owns, by table: item state, votes and labels, keywords, tags, filters and rules, checks and their answers, saved views, taste reviews, the agent’s actions, AI calls, settings, tokens, connections, sessions
- the agent chat’s messages, when the chat runs on the server
Secrets stay out: session tokens, the password hash, token hashes, the credentials of connections and your own OpenRouter key (EXPORT_OMITS in accounts.ts). A test checks that every table with a user_id is in the export. For the subscriptions alone, OPML under Import and export is the format other readers take.
Deleting an account
Settings → Account → Delete account asks for the password, then deletes at once (DELETE /api/v1/me). An admin deletes others on the admin screen, the operator with pnpm user delete. All three run deleteAccount():
- every row with the account’s
user_id: the foreign keys cascade fromusers - its password-reset tokens (
verifications) - the sources only it followed, with their items, its links among them. A source stays when another account kept one of its items starred.
A test checks that no row names the account afterwards.
One gap: the chat’s messages live in durable.db, and pi-durable can’t delete a conversation yet. After the account is deleted, its conversation stays there, linked to no one, until it can be removed. Cached images of removed items stay on disk until the image cache is over its size limit and prunes the least recently used (images.md).
Better Auth’s own delete endpoint is off, so this is the only way an account goes.