Skip to Content
SahajFlowHelp Center
Product

Platform concepts

Purpose: the six ideas that explain almost every behaviour in SahajFlow. Read this once and the module guides become predictable.

1. Organization = tenant = workspace

An organization is the container for every business record. The UI calls it a workspace. Its properties:

  • Name (unique, case-insensitive), an immutable slug, logo, email, phone, website, GSTIN, and IANA timezone.
  • Lifecycle flags: active, suspended (set by platform staff), archived.
  • A subscription plan that decides which modules can be opened.
  • One or more memberships.

Nothing in any module is shared across organizations. There is no cross-tenant search, report, attachment, or number sequence.

2. User ≠ member

A user is a person's login: email, password, verification state, Google link. A membership is that user inside one organization, with exactly one role and one status. One person can hold different roles in different organizations.

Membership states:

StateCan use protected APIs?How it is reached
INVITEDNoInvitation created, not accepted
ACTIVEYesInvitation accepted, or workspace created
SUSPENDEDNoAdmin suspends the member
REMOVEDNoAdmin removes the member

Only ACTIVE memberships pass the request-context check. Role, permissions, and membership are validated on every request and are not cached in the session.

3. Active organization is backend-owned

The browser never chooses a tenant by sending an organization ID with a request. The backend keeps the active organization in the session and validates, per request, that the user is an ACTIVE member of a live organization. Switching workspaces is a dedicated operation that re-validates first and then updates the session.

Practical consequences:

  • A copied URL from another workspace returns "not found", not another tenant's data.
  • Refreshing keeps you in the same workspace.
  • Removing a member takes effect on their next request, not when their tab closes.

4. Every action has a permission code

Permissions are explicit grants shaped <module>.<resource>.<action>:

crm.lead.view        crm.lead.create       crm.lead.convert
q2c.quote.send       q2c.invoice.issue     q2c.payment.record
procurement.purchase_order.approve         reach.campaign.approve
projects.project.complete                  documents.file.manage
admin.settings.manage

Roles are bundles of these grants. A grant answers "may this person attempt the action?" It never answers "is this action valid for this record?" — the service layer still enforces lifecycle and business rules.

Sensitive actions have their own grant, never a generic "update": converting a lead, moving a stage, accepting a quote, converting a quote, issuing an invoice, recording or reversing a payment, approving a purchase order, receiving goods, completing a project, approving a campaign, changing ownership.

5. Every gate before data appears

1. Plan entitlement ─ has the tenant bought this module?
2. Organization     ─ is the tenant live (not suspended/archived)?
3. Membership       ─ is this member ACTIVE?
4. Role grant       ─ may this role attempt this action?
5. Department access─ has an admin hidden this module from this member?
        ↓
   Data visibility  ─ how far inside the organization may they read?
        ↓
   Business rules    ─ is the record in a state that allows this?

The sidebar mirrors gates 1, 4, and 5 to hide what cannot be used, but hiding is cosmetic: every API repeats all checks. A hidden button is not a security control, and a visible button does not guarantee success.

6. Records follow a lifecycle, and history is kept

  • Almost nothing is hard-deleted. Records are archived (archived_at) and can be restored. Business numbers are not reused.
  • Lifecycle transitions happen only through explicit actions (send, accept, issue, confirm, cancel, complete), each with its own permission and validation.
  • Every business change writes an activity (user-facing timeline) and, where applicable, an audit row (compliance, immutable).
  • Human-readable numbers are generated centrally per organization and prefix, for example QT-2026-000042 (yearly reset) or LEAD-000007 (never reset).

Supporting concepts

Modules and entitlements

A module is both a permission prefix and a plan feature. crm, q2c, projects, documents, hr, inventory, procurement, reach, assets, automation, integrations, and ai are plan-gated. reports, notifications, resources, and admin are available on every plan. reach_plus is an add-on entitlement on Premium.

Data visibility

Independent of role, a member's reads can be scoped to: OWN, TEAM, DEPARTMENT, ORGANIZATION, CUSTOM (explicitly assigned records), or ALL. The default is ORGANIZATION for every role except OWNER (ALL). Tightening it is an explicit administrative act.

Documents and attachments

Files belong to an organization and to a business record. Bytes live in object storage; metadata, checksums, and ownership live in the database. Uploading a new version never overwrites the old bytes; downloads are logged.

Background work

Emails, notification delivery, webhook fan-out, workflow execution, AI pruning, and scheduled reminder scans run asynchronously. They never block or roll back the business transaction that triggered them. A side effect can therefore arrive a few seconds after the action that caused it.

Platform staff are outside the tenant model

MarTech Panthers staff (is_staff) administer tenants through a separate /api/v1/platform/ surface. Tenant owners and admins receive 403 there. Staff actions are audited and are not tenant roles.

Common questions these concepts answer

QuestionAnswer
Why can't I see a module my colleague sees?Your role, your department's module access, or your plan differs. Check all three.
Why did my saved link stop working?The active workspace changed, or you are no longer an ACTIVE member of that tenant.
Why is the number 000043 when there are only 12 quotes?Numbers are per tenant and per period; archived and cancelled records keep theirs.
Why can't I edit an accepted quote?Lifecycle rule: accepted quotes are read-only. Permission is not the blocker.
Why did the notification arrive after the page updated?Delivery is asynchronous by design.

On this page