Initialization
Once the containers are configured, these steps bring the platform to a state where users can sign in.
1. Prepare the database​
PostgreSQL: apply the migrations before the first start, and before starting each new version. They are run with the Breign API image:
docker run --rm --env-file api.env <registry>/breign/breign-api:<version> \
node -r tsconfig-paths/register dist/migrate.js
With the Helm chart, enable migrations.enabled on Breign API instead: an init container runs them. Keep LOGGER__LEVEL=info (or higher) for this command: at debug level the connection URI is written to the logs.
MongoDB: no migration is needed. Create the indexes once (and after each upgrade; the command only adds what is missing):
docker run --rm --env-file api.env <registry>/breign/breign-api:<version> \
node -r tsconfig-paths/register dist/mongodb-indexes.js
2. Start and check the services​
Start Breign API, Breign APP and Breign Document API (and the optional components), then check:
https://<api>/healthanswersok;https://<app>/loginshows the sign-in page;- the logs of Breign API and Document API show no connection error (database, storage).
3. Create the first superadmin​
The superadmin manages the platform: organizations, platform engines, tool and skill libraries. Sign-in is refused to unknown e-mail addresses, so create the first superadmin directly in the database.
PostgreSQL:
INSERT INTO users (id, email, name, "isAdmin", "createdAt")
VALUES (gen_random_uuid(), 'admin@company.example', 'Admin Name', true, to_char(now(), 'YYYY-MM-DD'));
MongoDB, in the users collection:
db.users.insertOne({
id: crypto.randomUUID(),
user: { email: "admin@company.example", name: "Admin Name" },
isAdmin: true,
apiKeys: [],
createdAt: new Date().toISOString().slice(0, 10)
});
4. Sign in and create the first organization​
- Open
https://<app>/loginand sign in with the superadmin's e-mail address: a one-time code is sent by e-mail. While you set up the e-mail sending,RESEND_API_KEY=CONSOLEon Breign APP writes the codes to its logs instead. - Open the Superadmin dashboard (
https://<app>/superadmin) and create an organization. - In the organization, invite its first administrators. See Users, roles and permissions.
- Add an AI engine to the organization, or offer it a platform engine: see Connect your models, data and tools.
Other sign-in methods (passkeys, single sign-on) are available depending on your license.
5. Optional: single sign-on​
Users can sign in through your identity provider (Microsoft Entra ID, Keycloak, Google…) with OpenID Connect (or SAML). Members of a given group are added to an organization automatically when they sign in.
Declare Breign in your identity provider​
Create a client (application) of type "confidential" with the authorization code flow, and allow these redirect URIs:
https://<app>/api/auth/*— sign-in to Breign APP;https://<api>/rp/auth/*— sign-in through Breign API (Breign as a relying party for other applications).
Request the scopes openid, email and profile, and add the user's groups to the token (a groups claim).
Register the provider​
Add the provider to the ssoProvider table (PostgreSQL) or collection (MongoDB). Replace the values in angle brackets:
| Field | Value |
|---|---|
providerId | An identifier you choose, for example company-sso. |
issuer | The issuer URL of your provider. |
domain | The domain of your provider. |
oidcConfig | The OpenID Connect configuration, as a JSON string (see below). |
customRules.requiredGroup | Only members of this group can sign in. |
customRules.adminGroup | Members of this group become administrators of the organization. |
customRules.organizationId | The organization that users join when they first sign in. |
Group membership and the administrator role are updated at every sign-in.
The oidcConfig value, before turning it into a string (example for Keycloak):
{
"issuer": "https://sso.company.example/realms/company",
"clientId": "<client-id>",
"clientSecret": "<client-secret>",
"discoveryEndpoint": "https://sso.company.example/realms/company/.well-known/openid-configuration",
"authorizationEndpoint": "https://sso.company.example/realms/company/protocol/openid-connect/auth",
"tokenEndpoint": "https://sso.company.example/realms/company/protocol/openid-connect/token",
"jwksEndpoint": "https://sso.company.example/realms/company/protocol/openid-connect/certs",
"pkce": true,
"scopes": ["openid", "email", "profile", "groups"],
"mapping": {
"id": "sub",
"email": "email",
"emailVerified": "email_verified",
"name": "name",
"extraFields": { "groups": "groups" }
},
"overrideUserInfo": false
}
PostgreSQL:
INSERT INTO "ssoProvider" (id, "providerId", issuer, domain, "oidcConfig", "customRules")
VALUES (
gen_random_uuid()::text,
'company-sso',
'https://sso.company.example/realms/company',
'sso.company.example',
'<oidcConfig as a JSON string>',
'{"requiredGroup": "/Breign", "adminGroup": "/Breign-Admins", "organizationId": "<organization id>"}'
);
MongoDB:
db.ssoProvider.insertOne({
providerId: "company-sso",
issuer: "https://sso.company.example/realms/company",
domain: "sso.company.example",
oidcConfig: JSON.stringify({ /* the configuration above */ }),
samlConfig: null,
customRules: {
requiredGroup: "/Breign",
adminGroup: "/Breign-Admins",
organizationId: "<organization id>"
}
});
The organization id is shown in the superadmin dashboard (or in the organizations table / organisation collection).
Turn it on in Breign APP​
Set NEXT_ to the providerId (company-sso) on Breign APP and restart it. The sign-in page now redirects straight to your provider, and passkeys are turned off (set PASSKEYS_ENABLED=true to keep them).
The superadmin keeps their rights after the switch, as long as their account in the identity provider has the same e-mail address as the superadmin created in step 3 and belongs to the required group.