Safety rules
The eight safety rules, your account and your app, rendering other people's content, and what the rules leave out.
The eight safety rules
Gemmein is built for apps you run for your own customers. Team workspaces, organisations and shared company accounts, where a company's members share records, aren't part of it.
| Rule | Who can read | Who can write | Use case |
|---|---|---|---|
private | Owner only (the dashboard reads every record) | Owner only | Personal data: tasks, notes, settings |
shared | All signed-in people | Each person: own records only | Feeds, communities, shared boards |
public_read | Anyone, without signing in | You only (dashboard, secret key or relay) | Menus, listings, single-author blogs |
community | Anyone, without signing in | Each signed-in person: own records, plain text | Multi-author blogs, public boards, profiles |
addressed | Each person: records addressed to them (the dashboard reads every one) | You only (dashboard, secret key or relay), naming a recipient | Notifications, invoices, order status |
direct | Author + the named recipient | Each signed-in person, naming a recipient | Messages, sharing, requests |
admin_write | All signed-in people | You only (dashboard, secret key or relay) | App settings, announcements |
app_only | Nobody using the app: only you (dashboard), your server (secret key) and relays | You only (dashboard, secret key or relay) | Answers to hidden questions, scores your server keeps so nobody can cheat, anything shown to people only through another collection |
app_only is the most private rule. No app session reaches it: not a visitor, not a
signed-in person, and not you signed in to your own app. Every read and write from the app
(list, get, count, stats, search,
watch, expand, open fields, uploads) is refused with
403 app_only, and signing in changes nothing. Your server creates its records with no
person ({ for } is 400 invalid_person), and a file uploaded into one is
never on a public link. Nothing opens it: openFields, publishing,
fields, directInitiation and unlockedBy are refused in its
file. To show people part of what it holds, have your server or a relay copy that part into a
collection they can read.
Beside the rule, a collection can take two options: show and hide times on its records, and rankable numbers. An option only hides or orders; it never lets anyone read a record the rule keeps from them.
Your account and your app
Your Gemmein account and a person using your app are two different things, even when
they share an email. Sign in to your own app with that email and you are an ordinary
signed-in person: for private collections you see only your own records, under
the same safety rule as anyone else. The Gemmein
dashboard is where you see every person, every record, every message.
Don't build a role field to hide admin UI. Every
session reports member, yours included, so every session inside the app has
the same role and nothing to branch on. Never filter by userId, and never set
userId/owner/role fields. The server derives them
from the session and rejects reserved fields (id, userId,
ownerUserId, role, createdAt, and others) if you
try.
For an admin screen inside your app (a support desk, a moderation queue), create a secret key in the dashboard, scoped read-only to the collections it shows. Keep it on your own server and call your server from the app; a secret key refuses to run in a browser or a phone. See Server: gemmeinServer(sk).
Rendering another person's content
When one person's content renders in another person's session (community,
shared, direct), render it with text bindings
(textContent, or {} in React/Vue/Svelte), never
innerHTML. community, addressed, and
direct enforce this server-side: any string field containing HTML tags is
refused with 400 html_not_allowed, and the message names the collection's
allowsMarkup setting. You turn it on in the dashboard (Content: allows
markup) for a collection whose app renders HTML safely.
What the safety rules leave out
- Writes are always a signed-in person. The person is the sign-in: editing your own, per-person write limits and erasure rest on it. A guest book signs people in with an email code, or your server writes with a secret key.
- Acknowledgements on
addressedrecords live in aprivatecollection, one keyed record per item:acks.create({ item: notice.id }, { key: "ack:" + notice.id }). The app writes an addressed record; its recipient reads it. expandworks oncommunity,sharedanddirect. Onprivatenothing is another person's to read, andpublic_readandadmin_writehold the app's own records with no link fields; join in memory there.
Thanks for telling us.
Thanks for telling us.
Last updated