Skip to main content
TMT Platform defines three distinct user roles, each stored in a separate Firestore collection and created through its own Cloud Function. Every user receives a Firebase Authentication account tied to their Firestore document by UID.

Clients

Organizations or individuals that own events. Clients have commercial and fiscal data, manage collaborators, and hold contracts. Stored in u_clients.

Collaborators

Users who operate under a client account. Each collaborator is linked to a parent client by UID. Stored in u_collaborators.

Staff

Internal platform operators with access to admin tooling. Staff accounts include 2FA configuration and timezone settings. Stored in u_staff.

How user creation works

All three creation functions follow the same pattern:
1

Receive request

The HTTP function receives a POST request with a { data: { ... } } body.
2

Create Firebase Auth account

auth.createUser() is called with the provided email and password. On success, Firebase returns a uid.
3

Write Firestore document

A document is written to the role-specific collection (u_clients, u_collaborators, or u_staff) using the uid as the document ID.
4

Return the UID

The function responds with status: 200 and the new uid.

Firestore collections

RoleCollectionAuth required to create
Clientu_clientsNo
Collaboratoru_collaboratorsNo
Staffu_staffNo
All user documents store a date.create Firestore Timestamp set at creation time. The date.last_access and date.last_update fields are initialized as empty strings and updated by other functions during the user lifecycle.

Role differences

FieldClientCollaboratorStaff
name_commercialYesNoNo
commercial_registryYesNoNo
fiscal_infoYesNoNo
bank_accountsYesNoNo
client (parent link)NoYesNo
commercial_nameNoNoYes
security_2faNoNoYes
timezoneNoNoYes
data countersYesNoNo

Validation and session management

After a user is created and signs in, use the validation functions to verify platform membership, check account type, set a session ID, and activate collaborator accounts via email confirmation.

Build docs developers (and LLMs) love