Getting started
How Rezin Core is organised
Five ideas explain almost everything else in these pages.
Workspace
A workspace is the account that owns projects: your company, your team, or you. Signing up gives you one of your own. Its members are console accounts with one of three roles: owner, developer or read-only. See Team and roles.
Project
A project is one application's backend. It has its own section of the database, its own users, files, keys, secrets, webhooks and logs. Nothing in one project can reach another: each project's database roles are confined to that project's section. A workspace can hold 5 live projects.
Organizations
An organization is one of your application's own customers or tenants: one company, one team, one household, whatever your application serves many of.
- Every user of your application belongs to exactly one organization.
- Every request acts for one organization. A signed-in user acts for theirs.
- A table that has an
organization_idcolumn gets it filled in by the API with the caller's organization, and your policies compare it withcore.app_org(). - Files belong to an organization too.
A new project has one organization. If your application has no notion of tenants, keep that one and put everyone in it. If it does, add organizations on the project's Sign-in page; each is separate from the others at the database.
Users
A user is a person who signs in to your application. Users are separate from console accounts: a user cannot open the console, and a console account is not a user of your application.
A user signs in through your project's key and gets a token. The token identifies them on every request until it ends: after 15 minutes without use, after 12 hours in any case, on sign-out, or when the account is disabled. A project can make those two times shorter, never longer.
Keys and who a request acts for
| The request carries | It acts for |
|---|---|
| A publishable key and a user's token | That user, in their organization |
| A secret key and a user's token | That user, in their organization |
A secret key, no token, and x-organization-id: <id> | That organization, with no person signed in (core.app_user() is null) |
| A publishable key and no token | Nobody. Only sign-up and sign-in work. |
In every case the database checks your policies. A secret key does not skip row-level security; it only lets your own server act for an organization without a user.
Database roles
Each project has two database roles, and you will see both mentioned:
- The application's role. Every API request runs as this role. Row-level security applies to it. What it may do to each table is set under "The application may" on the Access rules page.
- The project's own confined role. The SQL workspace, the table editor, the command-line tool and the connector run as this role. It reaches the project's section of the database and nothing else on the server. It sees all of the project's rows regardless of policies, because the people who may use it are the project's own members.
So: what you see in the SQL workspace is not what the application gets. Use View as on the Access rules page to see what a user is given.
The two kinds of sign-in, side by side
| Console account | User of your application | |
|---|---|---|
| Who | You and your team | The people who use what you build |
| Signs in at | console.rezincore.com | Your application, through api.rezincore.com |
| Made by | Sign-up with an invite code, or added to a workspace by an owner | Self sign-up (if the project allows it) or first sign-in with Google or GitHub |
| Identified by | A console session | A token sent as Authorization: Bearer … |
| Tools | Personal access tokens for the command line and the connector | Project keys |