All Products

Master Documentation

Exhaustive Technical Reference · Quantyx Admin Portal

Quantyx Solutions

Master Technical Documentation

Exhaustive Reference · Architecture · Data Model · Backend · Frontend · Compliance

Version 1.0 · September 2026

https://quantyxsolutions.base44.app

Confidential

This document is intended for internal engineering staff and authorised developers. It describes the full architecture, data model, and security posture of the Quantyx admin portal.

1. Architecture & Overview

1.1 What is Quantyx?

Quantyx Solutions is a multi-tenant SaaS administration platform built on the Base44 backend-as-a-service. It serves as a single command center for an operator managing multiple SaaS products — onboarding subscriber organisations, tracking subscriptions and billing, running a support ticketing desk with OTP-gated account access, publishing a token-gated Knowledge Base, monitoring customer health and revenue, and maintaining GDPR / compliance posture.

The application exposes two distinct surfaces:

  • Admin Portal — the authenticated staff workspace (sidebar + topbar shell). Access is controlled by Base44 Auth plus a TeamMember record with granular per-product, per-module permissions.
  • Client Portal — a token-based, public surface (/portal/*) where client organisations view their tickets, reply to agents, complete onboarding, and set passwords. No Base44 login is required; sessions are issued via ClientPortalSession magic links.

1.2 Technology Stack

LayerTechnology
Frontend frameworkReact 18 + Vite (ESM)
StylingTailwind CSS with CSS-variable design tokens, shadcn/ui component library, lucide-react icons
Routingreact-router-dom v6 (BrowserRouter, nested layout routes)
Data / state@tanstack/react-query, Base44 SDK entities, React Context (AppContext, PermissionsContext)
Chartsrecharts (solid lines only — no dashed/dotted patterns per design policy)
Rich textreact-quill (Knowledge Base editor + rendered .kb-content styles)
Maps / 3D / DnDreact-leaflet, three.js, @hello-pangea/dnd (available, used selectively)
BackendBase44 BaaS — entities (JSON schemas), auth, scheduled/entity automations
Server runtimeDeno (backend functions in base44/functions/*/entry.ts)
PDF generation (server)jsPDF — used by generateInvoice to produce A4 invoice PDFs server-side
PDF generation (client)jsPDF + html2canvas — used by this documentation page for standalone export
PaymentsStripe (via shared paymentGateway abstraction) + configurable PaymentGateway records
External validationEU VIES REST API (VAT number validation)

1.3 High-Level Architecture

┌─────────────────────────────────────────────────────────────────┐
│  src/App.jsx  —  AuthProvider → QueryClientProvider → Router      │
│     └─ AuthenticatedApp                                            │
│          ├─ Public routes:  /portal/*  and  /kb/:productId          │
│          └─ <AppLayout>  (admin shell, wraps protected routes)      │
│               ├─ AppProviders  (user, products, notifications,     │
│               │                  PermissionsProvider)              │
│               ├─ Sidebar   (product switcher + nav, permission-filtered) │
│               ├─ TopBar     (search, notifications, profile)       │
│               └─ <Outlet/>  → routed page                            │
└─────────────────────────────────────────────────────────────────┘
                         │
        ┌────────────────┴───────────────────┐
        ▼                                     ▼
  Base44 SDK (client)                   Backend Functions (Deno)
  base44.entities.<Name>.{list,         base44/functions/<name>/entry.ts
    filter,get,create,update,delete}    — invoked via base44.functions.invoke()
  base44.auth.{me,logout,...}           — or via external HTTP (webhooks)

1.4 Navigation Structure (Sidebar)

The sidebar (src/components/layout/Sidebar.jsx) renders a permission-filtered list of nav items. Each item declares a module gate checked against the current user's TeamMember permission sets.

LabelPath(s)Module gate
Dashboard/, /dashboard, /revenue-analyticsdashboard
Organisations/organisationsorganisations
Customer Success/customer-relationshipsorganisations
Tickets/ticketstickets
Billing/payments, /credit-notespayments
GDPR Requests/gdpr-requestsdashboard
Notifications/notificationsdashboard
Knowledge Base/knowledge-baseknowledge_base
Settings/settings, /teamsettings
Master Docs/master-documentationdashboard

1.5 Authentication & Permissions Model

Authentication is owned by the Base44 platform (tokens, sessions, email verification). The app never implements its own auth backend.

  • base44.auth.me() returns the current platform user; base44.auth.logout() ends the session.
  • Every authenticated admin user is mapped to a TeamMember record (matched by user_id, status active).
  • Platform users with role === 'admin' are treated as super admins even without a TeamMember record.
  • Users with no active TeamMember record hit an AccessPendingScreen (see AppLayout).

Permissions are resolved in src/lib/PermissionsContext.jsx and exposed via usePermissions():

  • Module access — each permission set declares a level (none | read | write | admin) per module: dashboard, organisations, tickets, payments, otp_access, settings, knowledge_base. The highest level across all sets wins.
  • Organisation scoping — accessible_organisation_ids restricts which client orgs a user can see (empty = all).
  • Settings scoping — accessible_settings_sections restricts which Settings tabs are visible.

Enforcement happens in two places:

  • Frontend — PermissionGuard wraps routes; canAccessModule/canAccessOrganisation filter data and UI.
  • Backend — sensitive functions (e.g. initiateOnboarding, generateInvoice) re-check the TeamMember permission level before acting, so a crafted client request cannot bypass the gate.

Idle session timeout

useIdleTimeout warns at 25 min and force-logs-out at 30 min of inactivity, surfaced via SessionTimeoutWarning.

1.6 Design System

Design tokens live in src/index.css (:root light + .dark) and are mapped to Tailwind in tailwind.config.js. The palette is a polished slate/indigo light theme. Key tokens: --primary (indigo), --success, --warning, --destructive, plus sidebar-specific tokens. The font is Inter. StatusBadge (src/components/ui/StatusBadge.jsx) centralises all status pill styling across org/ticket/payment/onboarding/health/sentiment statuses.

2. Data Model

All data is stored as Base44 entities (JSON schemas in base44/entities/*.jsonc). Every record automatically includes id, created_date, updated_date, and created_by_id — these are not redeclared in the schemas below. Entities are accessed client-side via base44.entities.<Name> and server-side via base44.asServiceRole.entities.<Name>.

Access control note

Entities use Base44's default authenticated access (no per-entity RLS rules are declared). Access is enforced at the application layer — frontend PermissionGuard + backend permission re-checks inside functions. See §7 for the full compliance treatment.

2.1 Core / Platform

User base44/entities/User.jsonc

Built-in. Read-only: id, created_date, full_name, email. Editable: role (admin | user). Platform admins (role='admin') are super admins. User records cannot be created/imported — users join via base44.users.inviteUser(email, role).

FieldTypeNotes
roleenum: admin, userPlatform-level role. admin = super admin.

TeamMember base44/entities/TeamMember.jsonc

Maps a platform User to an internal staff member with a role template and per-product permission sets. The central record for all access control.

FieldTypeRequiredDescription
user_idstring—Linked platform User id
full_namestring—Display name
emailstring✓Login email
role_templateenum: super_admin, support_agent, finance, custom✓Default permission template
statusenum: active, invited, deactivated—Only active members can log in
avatar_urlstring—
permission_setsarray<object>—Per-product grants (see below)
last_logindate-time—

Each permission_sets[] entry:

FieldTypeDescription
saas_product_idstringProduct this grant applies to
saas_product_namestringDenormalised for display
modulesobjectPer-module level: none/read/write/admin for dashboard, organisations, tickets, payments, otp_access, settings, knowledge_base
accessible_organisation_idsstring[]Orgs this user can access (empty = all)
accessible_settings_sectionsenum[]company, products, email, invoice, otp (empty = all)

SaasProduct base44/entities/SaasProduct.jsonc

Represents one of the SaaS products the operator manages. Carries billing config, OTP config, and KB secret.

FieldTypeRequiredDescription
namestring✓Product name
descriptionstring—
api_base_urlstring—Product API base URL
api_key_hintstring—
otp_callback_urlstring—Where OTP verification requests are sent
stripe_account_idstring—Platform Stripe account (shared)
kb_secretstring—HMAC secret signing Knowledge Base access tokens
statusenum: active, inactive, maintenance—Defaults active
logo_urlstring—
color_accentstring—
default_currencystring—ISO 4217, default GBP
supported_currenciesstring[]—Currencies clients can be billed in
supported_payment_methodsenum[]card, sepa_debit, bacs_debit, ach_debit, ideal, bancontact, sofort, au_becs_debit
stripe_tax_enabledboolean—Auto VAT/GST via Stripe Tax
otp_expiry_minutesnumber—Default 15
otp_session_duration_minutesnumber—Default 30
support_admin_user_idstring—Primary support admin
support_team_member_idsstring[]—Backup support team
escalation_enabledboolean—Escalate to super admins if no response
invoice_template_reminderobject{subject,body}—
invoice_template_overdueobject{subject,body}—

CompanyProfile base44/entities/CompanyProfile.jsonc

The operator's own company details — used for invoice branding, bank details, portal link origin, and sidebar logo.

FieldTypeDescription
company_namestring (required)Legal name
trading_namestring
logo_urlstringShown in sidebar + invoices
registered_address_line1/line2, city, county, postcode, countrystringRegistered address
phone, email, support_email, websitestringContact details. website origin used for portal magic links
company_registration_number, vat_numberstring
bank_name, bank_account_name, bank_account_number, bank_sort_code, bank_iban, bank_swift_bicstringBank transfer details on invoices
payment_terms_daysnumberDefault 15 — invoice due date = invoice date + this
invoice_notesstringFooter notes on invoices
opening_cash_balancenumberStarting bank balance (cash position)

SubscriptionPlan base44/entities/SubscriptionPlan.jsonc

A pricing tier for a product. Supports flat and metered billing models.

FieldTypeRequiredDescription
namestring✓Plan name
saas_product_idstring✓Owning product
plan_codestring✓Unique code
tierenum: starter, growth, pro, enterprise✓
currencystring—ISO 4217, default GBP
billing_modelenum: flat, metered—Default flat
tax_codestring—Stripe Tax product tax code
metered_metricstring—What is measured (metered)
included_unitsnumber—Units before overage
overage_unit_pricenumber—Price per unit beyond included
price_monthly_gbpnumber✓Monthly price
price_annual_gbpnumber—Annual price
billing_cycleenum: monthly, annual—Default monthly
featuresobject—max_users, max_tickets_per_month, max_storage_gb, api_calls_limit, modules_enabled[], priority_support, custom_branding, api_access, webhooks_enabled, sla_response_hours
stripe_price_id_monthly / _annualstring—Stripe price IDs
statusenum: active, archived—
setup_fee_gbpnumber—One-time setup fee
contract_template_urlstring—

2.2 Tenancy & Onboarding

Organisation base44/entities/Organisation.jsonc

A subscriber organisation on a product. The central tenancy record — most other entities reference it.

FieldTypeRequiredDescription
saas_product_idstring✓Product this org subscribes to
company_namestring✓
statusenum: prospect, trial, active, suspended, churned—Lifecycle status
subscription_plan_idstring—
plan_typeenum: starter, growth, pro, enterprise—
mrrnumber—Monthly recurring revenue
primary_contact_name/email/phonestring—
company_address, company_website, industry, company_sizestring—
billing_cycleenum: monthly, annual—
billing_currencystring—ISO 4217, default GBP
countrystring—Customer country for tax determination
vat_numberstring—Customer VAT/GST/Tax ID
vat_validatedboolean—Validated via VIES/Stripe
tax_exemptboolean—No tax charged (reverse-charge B2B)
subscription_start_date, subscription_renewal_datedate—
stripe_customer_id, stripe_subscription_idstring—
payment_method_typeenum: card, direct_debit, bank_transfer, invoice—
admin_notesstring—
last_activity_datedate-time—
active_users_countnumber—
logo_urlstring—
onboarding_workflow_idstring—Linked OnboardingWorkflow
encryption_key_versionnumber—Default 1
data_classificationenum: standard, sensitive, restricted—Default standard
health_statusenum: healthy, at_risk, critical—Auto-calculated
health_scorenumber—0-100, auto-calculated
health_checked_atdate-time—
sentiment_statusenum: happy, neutral, unhappy, unknown—Manually set by account team
sentiment_updated_at, sentiment_updated_by_name—

ClientUser base44/entities/ClientUser.jsonc

A user within a client organisation who can access the Client Portal. Passwords are SHA-256 hashed (salt = user id).

FieldTypeRequiredDescription
organisation_idstring✓
saas_product_idstring✓
full_namestring—
emailstring✓
roleenum: business_admin, business_user✓
statusenum: active, suspended, revoked—
invited_by_id, invited_by_name, invited_at—
revoked_at, revoked_reason—
password_hashstring—SHA-256(salt+password)
has_set_passwordboolean—
password_reset_token, password_reset_expires—
last_logindate-time—

ClientPortalSession base44/entities/ClientPortalSession.jsonc

Token-based session for the Client Portal. Issued via magic link or password login; no Base44 auth required.

FieldTypeRequiredDescription
organisation_idstring✓
saas_product_idstring✓
user_idstring—Linked ClientUser (null for magic-link-only)
session_tokenstring✓The token carried in ?token= query param
session_typeenum: onboarding, billing, settings, support✓
expires_atdate-time✓
created_at, last_accessed_atdate-time—
ip_addressstring—
statusenum: active, expired, revoked—Default active

OnboardingWorkflow base44/entities/OnboardingWorkflow.jsonc

Tracks an organisation through the 8-stage onboarding lifecycle from prospect to active.

FieldTypeRequiredDescription
organisation_idstring✓
saas_product_idstring✓
subscription_plan_idstring✓
statusenum: draft, invite_sent, contract_pending, contract_signed, payment_setup, payment_verified, provisioning, active, failed—Default draft
current_stagenumber—Default 1
total_stagesnumber—Default 8
invited_by_id, invited_by_name—
primary_contact_email, primary_contact_name, company_name✓
billing_cycleenum: monthly, annual—
contract_document_id, contract_signed_at, contract_signed_by—
stripe_customer_id, stripe_subscription_id—
payment_method_typeenum: card, direct_debit, bank_transfer, invoice—
payment_setup_completed_atdate-time—
provisioning_configobjectmodules_configured[], api_keys_generated, webhooks_configured, custom_domain, branding_configured
activated_at, failed_at, failure_reason, notes—

2.3 Support

Ticket base44/entities/Ticket.jsonc

FieldTypeRequiredDescription
saas_product_idstring✓
organisation_idstring✓
ticket_numberstring—Human-readable ID
subjectstring✓
descriptionstring—
statusenum: open, in_progress, pending_client, resolved, closed—Default open
priorityenum: critical, high, medium, low—Default medium
assigned_agent_id, assigned_agent_name—
organisation_namestring—Denormalised
sla_hoursnumber—Default 24
resolved_at, closed_atdate-time—
resolution_summarystring—
tagsstring[]—
sourceenum: client_portal, email, admin_created—Default admin_created
is_encryptedboolean—Default true
encryption_key_versionnumber—Default 1

TicketMessage base44/entities/TicketMessage.jsonc

FieldTypeRequiredDescription
ticket_idstring✓
saas_product_idstring—
sender_typeenum: agent, client, system✓
sender_name, sender_idstring—
contentstring✓
is_internal_noteboolean—Default false
attachment_urlsstring[]—

OtpSession base44/entities/OtpSession.jsonc

Time-limited OTP exchange letting a support agent request, and a client approve, temporary account access.

FieldTypeRequiredDescription
ticket_idstring✓
organisation_idstring✓
saas_product_idstring✓
requesting_agent_id, requesting_agent_name—
otp_codestring—Generated code sent to client
statusenum: pending, verified, active, expired, revoked—Default pending
expires_atdate-time—
verified_at, session_started_at, session_ends_at, session_ended_atdate-time—
end_reasonenum: timeout, manual, revoked—
verification_channelenum: email, in_app, both—
verified_viaenum: email, in_app—
verification_ipstring—

SlaPolicy base44/entities/SlaPolicy.jsonc

FieldTypeRequiredDescription
saas_product_idstring✓
namestring✓
tierenum: starter, growth, pro, enterprise✓
first_response_hoursnumber—Default 24
resolution_hoursnumber—Default 72
priority_overridesobjectPer-priority response/resolution hours for critical/high/medium/low
service_credit_percentnumber—Credit on breach
is_activeboolean—Default true

2.4 Billing & Revenue

Payment base44/entities/Payment.jsonc

FieldTypeRequiredDescription
saas_product_idstring✓
organisation_idstring✓
organisation_namestring—
amountnumber✓
currencystring—Default GBP
statusenum: paid, pending, failed, refunded, overdue—Default pending
gatewayenum: stripe, direct_debit, bank_transfer, other—Default stripe
billing_cycleenum: monthly, annual—Default monthly
stripe_payment_intent_id, stripe_invoice_id, stripe_subscription_idstring—
invoice_number, invoice_pdf_urlstring—
descriptionstring—
payment_datedate-time—
due_datedate—
retry_count, next_retry_date—Dunning
refund_reasonstring—
subscription_plan_idstring—
billing_period_start, billing_period_enddate—
is_encryptedboolean—Default true
payment_method_last4, payment_method_brandstring—
is_lateboolean—Default false
days_overduenumber—Default 0

CreditNote base44/entities/CreditNote.jsonc

FieldTypeRequiredDescription
organisation_idstring✓
saas_product_idstring✓
original_payment_id, original_invoice_numberstring—
credit_note_numberstring—
amountnumber✓
currencystring—Default GBP
reasonenum: refund, billing_error, goodwill, cancellation, other✓
statusenum: issued, applied, void—Default issued
stripe_credit_note_idstring—
issued_by_id, issued_by_name—
notesstring—

PaymentGateway base44/entities/PaymentGateway.jsonc

Configurable additional gateways (PayPal, Square, Adyen, etc.) managed in Settings → OTP & Payment Config.

FieldTypeRequiredDescription
namestring✓
typeenum: stripe, paypal, square, authorize.net, adyen, wix_payments, other✓
api_key, secret, publishable_keystring—
webhook_url, webhook_secretstring—
statusenum: active, inactive, test_mode—Default inactive
is_primaryboolean—Default false
configurationobjectmerchant_id, client_id, environment (sandbox/production)

DunningPolicy base44/entities/DunningPolicy.jsonc

FieldTypeRequiredDescription
saas_product_idstring✓
namestring✓
max_retriesnumber—Default 3
retry_daysnumber[]—Default [1,3,5]
suspend_after_daysnumber—Default 14
email_template_1, email_template_2, email_template_finalstring—
is_activeboolean—Default true

UsageRecord base44/entities/UsageRecord.jsonc

Usage metrics for metered billing plans, reported via the reportUsage function.

FieldTypeRequiredDescription
organisation_idstring✓
saas_product_idstring✓
subscription_plan_idstring—
metricstring✓api_calls, storage_gb, active_users, …
quantitynumber✓
unitstring—calls, GB, users
period_start, period_enddate✓
reported_bystring—API key or system
overagenumber—Units beyond included_units

2.5 Compliance & Audit

GdprRequest base44/entities/GdprRequest.jsonc

FieldTypeRequiredDescription
organisation_idstring✓
saas_product_idstring✓
request_typeenum: data_access, data_erasure, data_portability, rectification, objection✓
statusenum: received, in_review, in_progress, completed, rejected—Default received
requested_by_name, requested_by_emailstring—
detailsstring—
assigned_to_id, assigned_to_name—
due_datedate—GDPR: response within 30 days
completed_atdate-time—
resolution_notesstring—

TaxValidation base44/entities/TaxValidation.jsonc

Immutable audit record of each VAT validation (VIES or manual).

FieldTypeRequiredDescription
organisation_idstring—
saas_product_idstring—
vat_numberstring✓
country_codestring—ISO 3166-1 alpha-2
is_validboolean✓
validation_sourceenum: vies, stripe, manual—Default vies
validated_name, validated_addressstring—Returned by VIES
validation_datedate-time—
request_identifierstring—VIES audit identifier

ComplianceCert base44/entities/ComplianceCert.jsonc

FieldTypeRequiredDescription
saas_product_idstring✓
cert_typeenum: soc2_type1, soc2_type2, iso27001, iso27017, iso27018, gdpr, hipaa, pci_dss, fedramp✓
statusenum: active, in_progress, expired, not_started—Default not_started
issuerstring—Auditor / certification body
valid_from, valid_untildate—
document_urlstring—
notesstring—

AuditLog base44/entities/AuditLog.jsonc

Append-only event log. Written by backend functions for every significant action.

FieldTypeRequiredDescription
saas_product_id, organisation_id, ticket_id, otp_session_idstring—Context ids
actor_id, actor_namestring—
actor_typeenum: admin, agent, finance, system, client—
event_typestring✓e.g. onboarding_initiated, vat_validation, payment_overdue
event_descriptionstring✓Human-readable
metadataobject—Structured detail
ip_addressstring—

2.6 Security / Encryption

EncryptedData base44/entities/EncryptedData.jsonc

Stores AES-256-GCM ciphertext plus IV, salt, auth tag. Created by encryptData, decrypted by decryptData.

FieldTypeRequiredDescription
organisation_idstring✓
saas_product_idstring✓
data_typeenum: ticket, payment, document, configuration, message, custom✓
source_entity, source_entity_idstring—Back-reference to origin record
encrypted_datastring✓Hex ciphertext
ivstring✓Hex IV
saltstring✓Hex salt
auth_tagstring✓Hex GCM auth tag
key_versionnumber—Default 1
encrypted_by_idstring—
created_at, last_accessed_atdate-time—
access_countnumber—Default 0

EncryptedDataKey base44/entities/EncryptedDataKey.jsonc

Per-org, per-key-type encryption key record. Keys are derived from ENCRYPTION_MASTER_KEY via scrypt/PBKDF2.

FieldTypeRequiredDescription
organisation_idstring✓
saas_product_idstring✓
key_typeenum: org_data, tickets, payments, documents, api_credentials✓
encrypted_keystring✓Derived key material reference
key_versionnumber—Default 1
created_by_idstring—
created_at, last_rotated_atdate-time—
statusenum: active, revoked—Default active

2.7 Knowledge Base

KbCategory base44/entities/KbCategory.jsonc

FieldTypeRequiredDescription
saas_product_idstring✓
namestring✓
descriptionstring—
sort_ordernumber—Default 0

KbTopic base44/entities/KbTopic.jsonc

FieldTypeRequiredDescription
saas_product_idstring✓
saas_product_namestring—Denormalised
category_id, category_namestring—
titlestring✓
summarystring—Plain-text snippet for search
bodystring—Rich-text HTML (Quill)
tagsstring[]—
statusenum: draft, published, archived—Default draft
versionnumber—Incremented on publish
sort_ordernumber—Default 0
author_namestring—
published_atdate-time—
published_by_namestring—
view_countnumber—Default 0

KbVersion base44/entities/KbVersion.jsonc

Immutable snapshot of a topic each time it is published — enables version history.

FieldTypeRequiredDescription
topic_idstring✓
saas_product_idstring✓
versionnumber✓
titlestring✓
bodystring✓HTML snapshot
published_by_namestring—
published_atdate-time—

2.8 CRM & Notifications

OrganisationInteraction base44/entities/OrganisationInteraction.jsonc

FieldTypeRequiredDescription
organisation_idstring✓
saas_product_idstring✓
interaction_typeenum: call, email, meeting, note, other✓Default note
summarystring✓
outcome_sentimentenum: positive, neutral, negative—Default neutral
interaction_datedate-time—
created_by_id, created_by_name—

SurveyResponse base44/entities/SurveyResponse.jsonc

FieldTypeRequiredDescription
organisation_idstring✓
saas_product_idstring✓
survey_typeenum: nps, csat, ces—Default nps
scorenumber✓NPS 0-10, CSAT 1-5, CES 1-7
commentstring—
triggerenum: post_resolution, periodic, onboarding, manual—Default periodic
ticket_idstring—For post-resolution surveys
respondent_name, respondent_email—

Notification base44/entities/Notification.jsonc

FieldTypeRequiredDescription
recipient_user_idstring✓
saas_product_idstring—
typeenum: new_ticket, ticket_update, ticket_resolved, otp_request, otp_verified, payment_failed, sla_breach, system✓
titlestring✓
messagestring✓
link_typeenum: ticket, organisation, payment, otp_session—
link_idstring—
is_readboolean—Default false
is_email_sentboolean—Default false

Document base44/entities/Document.jsonc

FieldTypeRequiredDescription
organisation_idstring✓
saas_product_idstring—
file_namestring✓
file_urlstring✓
file_typestring—
file_size_kbnumber—
uploaded_by_id, uploaded_by_name—
descriptionstring—
categoryenum: contract, invoice, identity, technical, other—Default other

3. Backend Functions

Backend functions live in base44/functions/<name>/entry.ts and run on the Deno runtime. They are invoked from the client via base44.functions.invoke('name', payload) or reached externally over HTTP (e.g. Stripe webhooks). Each function creates a client with createClientFromRequest(req), authenticates via base44.auth.me() (except public endpoints), and uses base44.asServiceRole to bypass user context where needed.

Shared modules

base44/shared/paymentGateway.ts abstracts Stripe customer/subscription/tax creation across functions. base44/shared/kbToken.ts signs/verifies HMAC Knowledge Base access tokens.

3.1 Onboarding Lifecycle

FunctionAuthPurpose &amp; Key Logic
initiateOnboardingadmin / organisations writeCreates an Organisation (status prospect) + OnboardingWorkflow (stage 1/8) from company + plan details. Validates plan belongs to product. Computes MRR from plan price &amp; billing cycle. Writes AuditLog. Re-checks TeamMember organisations write permission.
sendOnboardingInviteadminSends the onboarding invite email to the primary contact, advances workflow to invite_sent.
signContractadmin / client (session)Records contract signature on the OnboardingWorkflow (contract_signed, stage 4), stores signed document.
setupPaymentclient (session_token)Called from the Client Portal. Validates ClientPortalSession, creates Stripe customer + subscription via paymentGateway abstraction, sets workflow to payment_verified (stage 6), org to trial, creates a pending Payment, calculates tax, then invokes generateInvoice. Writes AuditLog as actor_type client.
activateSubscriptionadminFinal activation: workflow → active (stage 8), org → active, sets subscription dates, provisions config.
notifyOnboardingStagesystem/adminSends stage-transition notification emails to the client contact.
notifyOnboardingStageChangesystem/adminNotifies internal team when an onboarding stage changes.

3.2 Billing & Payments

FunctionAuthPurpose &amp; Key Logic
generateInvoiceadmin / payments writeBuilds a branded A4 PDF invoice server-side with jsPDF (header, bill-to, line items, tax, totals, bank details, footer). Embeds CompanyProfile logo. Calculates tax via calculateTax. Uploads the PDF via Core.UploadFile, stores invoice_number/due_date/invoice_pdf_url on the Payment, creates a Document record, and notifies the finance team. Idempotent — returns existing invoice if already generated. Re-checks TeamMember payments write permission.
sendInvoiceReminderadmin/scheduledSends a reminder email 15 days before an invoice due date using the product reminder template.
checkOverduePaymentsadmin/scheduledScans pending payments with past due_date, marks them overdue (status=overdue, is_late, days_overdue), notifies finance team, writes AuditLog. Scheduled daily at 09:00.
notifyPaymentFailedentity (Payment update)Notifies finance team when a payment status becomes failed.
notifyPaymentOverdueentity (Payment update)Notifies finance team when a payment becomes overdue.
notifyOverduePaymententity (Payment update)Additional overdue notification (older variant).
stripeWebhookpublic (Stripe signature)Verifies Stripe webhook signature with STRIPE_WEBHOOK_SECRET. Handles invoice.payment_succeeded (→ paid), invoice.payment_failed (→ failed, retry_count+1, next_retry in 3 days), customer.subscription.updated (maps subscription status to payment status). Uses asServiceRole.
testGatewayadminTests a PaymentGateway connection (action=test_connection).

stripeWebhook event handling

switch (event.type) {
  case 'invoice.payment_succeeded':  // Payment → paid, store payment_date + intent/invoice ids
  case 'invoice.payment_failed':     // Payment → failed, retry_count++, next_retry_date = +3 days
  case 'customer.subscription.updated': // map {active:paid, past_due:pending, unpaid:pending,
                                        //      canceled:refunded, incomplete:pending}
}

3.3 Tax

FunctionAuthPurpose &amp; Key Logic
validateVatNumberadminValidates a VAT number via the EU VIES REST API for EU member states (falls back to format check for non-EU or VIES errors). Stores an immutable TaxValidation record, updates Organisation.vat_validated + vat_number, writes AuditLog. Returns validated name/address.

3.4 Support & Tickets

FunctionAuthPurpose &amp; Key Logic
notifyNewTicketentity (Ticket create)Notifies support admins/agents when a ticket is created.
notifyTicketAssignedadmin/systemNotifies an agent when a ticket is assigned to them.
notifyTicketUpdateentity (Ticket update)Notifies relevant parties on ticket updates.
notifyTicketStatusChangeadmin/systemNotifies on status transitions (e.g. resolved, closed).
assignTicketAgentadminAssigns a ticket to an agent, updates assigned_agent_id/name.
requestScreenShareAccessagentCreates an OtpSession (status pending) requesting temporary client account access for a ticket; sends OTP code to the client contact via notifyOTPRequest.
verifyScreenShareOTPclientVerifies the OTP code submitted by the client; if valid, activates the OtpSession (status active) for the configured session duration.
notifyOTPRequestsystemSends the OTP request email to the client contact with the code and expiry.

3.5 Client Portal

FunctionAuthPurpose &amp; Key Logic
clientPortalAuthpublicTwo actions: login (password) — verifies ClientUser password_hash (SHA-256 of salt+id+password), checks org not suspended/churned, issues an 8h ClientPortalSession; magic_link — issues a 24h session and emails a magic link. Portal URL origin derived from CompanyProfile.website.
createPortalSessionpublicLegacy magic-link issuer: verifies email matches org primary contact, blocks suspended/churned orgs, creates a 7-day support session, emails the link.
setClientPasswordclient (token)Sets/updates a ClientUser password using a reset token; hashes and stores password_hash, sets has_set_password.

3.6 Organisation & Customer Health

FunctionAuthPurpose &amp; Key Logic
calculateOrgHealthadmin/scheduledRecalculates health_score (0-100) for all active/trial orgs: starts at 100, −20 per overdue/failed payment (max −40), −15 if &gt;3 open tickets, −15/−30 for &gt;30/60 days inactive. Maps to health_status (≥70 healthy, ≥40 at_risk, else critical). Updates Organisation. Scheduled daily at 02:00.
notifyOrgStatusadmin/systemNotifies on organisation status changes.
notifyOrganisationStatusChangeadmin/systemNotifies internal team when an org status changes (e.g. suspended, churned).
syncOrgAccessadminSynchronises accessible_organisation_ids / access scoping for a team member.
linkTeamMemberOnLoginsystemOn login, links a platform User to a TeamMember record by email.

3.7 Knowledge Base

FunctionAuthPurpose &amp; Key Logic
generateKbTokenadminGenerates a signed HMAC test access token for a product + user email using the product kb_secret, so the team can verify the public KB wiring.
draftKbTopicadminCreates/updates a draft KbTopic (status draft).
publishKbTopicadminPublishes a KbTopic: sets status published, increments version, creates an immutable KbVersion snapshot, sets published_at/by.
getKbContentpublic (token)Public endpoint serving KB content to authenticated end-users of a product. Verifies the HMAC token signed with the product kb_secret; enforces that the user is an active, authenticated user of the product.

3.8 Security & System

FunctionAuthPurpose &amp; Key Logic
encryptDataadminEncrypts arbitrary JSON with AES-256-GCM. Derives a per-org key from ENCRYPTION_MASTER_KEY via scrypt. Returns ciphertext + IV + salt + auth_tag + key_version. Creates an EncryptedDataKey record on first use.
decryptDataadminDecrypts an EncryptedData record: re-derives the key from ENCRYPTION_MASTER_KEY + stored salt via PBKDF2 (100k iterations, SHA-256), verifies the GCM auth tag, returns plaintext JSON.
checkUserPermissionadminServer-side permission check helper — verifies a user has a required module level.
reportUsagepublic (API key)Records a UsageRecord for metered billing (metric, quantity, period). Called by product systems.
generateContractadminGenerates a contract document for an onboarding workflow.

3.9 Function Invocation Patterns

From the client (admin)

const res = await base44.functions.invoke('validateVatNumber', {
  organisation_id, vat_number, country_code
});
// res.data holds the JSON response

From a backend function (service role)

await base44.asServiceRole.functions.invoke('generateInvoice', { payment_id: payment.id });

External HTTP (Stripe webhook)

Register in Stripe at https://quantyxsolutions.base44.app/functions/stripeWebhook, subscribing to invoice.payment_succeeded, invoice.payment_failed, customer.subscription.updated.

4. Frontend & Routing

The frontend is a React SPA. src/App.jsx is the router and hosts all platform wrappers (AuthProvider, QueryClientProvider, BrowserRouter, Toaster). Routes are split into public Client Portal routes and authenticated admin routes wrapped by <AppLayout>.

4.1 Route Map

PathComponentGuard / Notes
/portal/loginClientPortalLoginPublic — client portal entry
/portal/dashboardClientPortalDashboardPublic — token auth
/portal/tickets/:idClientPortalTicketDetailPublic — token auth
/portal/onboardClientPortalOnboardingPublic — onboarding flow
/portal/set-passwordClientPortalSetPasswordPublic — token-based
/kb/:productIdKbPublicPublic — HMAC token-gated KB
/, /dashboard, /revenue-analyticsDashboardHubAppLayout — tabs: Overview / Product / Revenue
/organisationsOrganisationsAppLayout — organisations module
/organisations/:idOrganisationProfileAppLayout — multi-tab org detail
/tickets, /tickets/:idTickets / TicketDetailAppLayout — tickets module
/payments, /credit-notesBillingHubPermissionGuard payments — tabs: Payments / Credit Notes
/gdpr-requestsGdprRequestsAppLayout
/notificationsNotificationsAppLayout
/customer-relationshipsCustomerSuccessPermissionGuard organisations
/team, /team/:idSettingsHub / TeamMemberProfilePermissionGuard settings (admin)
/settings, /settings/products/:idSettingsHub / ProductDetailPermissionGuard settings
/onboarding, /onboarding/successOnboarding / OnboardingSuccessAppLayout
/knowledge-base, /knowledge-base/:idKnowledgeBase / KnowledgeBaseProductPermissionGuard knowledge_base
/master-documentationMasterDocumentationAppLayout — this page
*PageNotFound

4.2 Application Shell

FileResponsibility
src/components/layout/AppLayout.jsxDefines AppProviders (loads user, products, notification count; wraps PermissionsProvider) and the AppLayout shell (Sidebar + TopBar + Outlet). Handles access-pending and idle-timeout states.
src/components/layout/Sidebar.jsxCollapsible nav, product switcher, permission-filtered nav items, company logo from CompanyProfile.
src/components/layout/TopBar.jsxProduct context, search, notification bell with unread count, profile dropdown, role badge.
src/components/layout/TabHub.jsxGeneric tabbed hub wrapper used by DashboardHub / BillingHub / SettingsHub.
src/components/layout/DashboardHub.jsxTabs: GlobalDashboard / Dashboard / RevenueAnalytics.
src/components/layout/BillingHub.jsxTabs: Payments / CreditNotes.
src/components/layout/SettingsHub.jsxTabs: Settings / Team (Team tab only for settings admins).

4.3 Key Pages

PageDescription
GlobalDashboardPortfolio-level overview: MRR/ARR, revenue trends, product snapshots, operational alerts, product health table. Permission-filtered.
DashboardPer-product analytics: KPIs, revenue &amp; subscriber charts, recent tickets, top orgs, renewals.
RevenueAnalyticsMRR/ARR/NRR/GRR, churn, MRR movement, tier breakdown, 90-day renewal pipeline.
OrganisationsSearchable/filterable list of subscriber orgs with status, plan, MRR, health.
OrganisationProfileMulti-tab org detail: Overview, Billing, Tickets, Documents, Users, Interactions, Usage, Tax, Client Portal Preview, Lifecycle. In-place edit, suspend/churn actions, VAT validation, document upload.
Tickets / TicketDetailTicket list + Kanban; detail with conversation thread, OTP access panel, screen-share panel, SLA timer.
PaymentsRevenue summary, trend chart, searchable payment table with row expansion, invoice PDF download, CSV export.
CreditNotesIssue/track credit notes with KPIs and status lifecycle.
Onboarding8-step wizard: company details → product/plan → review → submit (calls initiateOnboarding).
CustomerSuccessCRM: health stats, at-risk table, recent interactions feed, survey feedback.
GdprRequestsGDPR request queue with 30-day deadlines, status workflow, creation form.
KnowledgeBase / KnowledgeBaseProductKB admin: categories, topics, Quill editor, version drawer, publish flow.
SettingsTabbed: Company Profile, SaaS Products, Email Templates, Invoice Templates, OTP &amp; Payment Config, SLA Policies, Dunning Policies, Compliance.
TeamTeam member list, invite with role templates, PermissionEditor for granular per-product access.
ClientPortal*Client-facing portal: login, dashboard, ticket detail, onboarding, set-password. Token-based.
KbPublicPublic KB view for end-users, HMAC token-gated per product.

4.4 Component Catalog

DirectoryComponents
ui/StatusBadge, StatCard, SlaTimer + shadcn primitives (button, card, dialog, table, tabs, select, etc.)
tickets/OtpAccessPanel, ScreenSharePanel, TicketKanban
organisation/UsageTab, OrgUsersTab, ClientPortalPreviewTab, RelationshipTab, TaxValidationTab, SentimentSelector, LifecycleTimeline, HealthSignalsCard, InteractionLogPanel
crm/CrmHealthStats, RecentInteractionsFeed, AtRiskTable
customer-success/SurveyFeedbackTab
dashboard/PortfolioRevenueChart, SubscriberStatusDonut, TierBreakdownCharts, ProductSnapshotCard, OperationalAlerts, ProductMixCharts, ProductHealthTable, MrrMovementChart
settings/CompanyProfileSettings, SlaPoliciesTab, DunningPoliciesTab, ComplianceCertsTab
products/ProductTierBuilder, ProductPlansTab
templates/EmailPreview, InvoicePreview
kb/KbVersionDrawer, KbSearch, KbTopicViewer, KbTopicEditor, KbEditor
docs/DocPrimitives, DocOverview, DocDataModel, DocBackend, DocFrontend, DocAutomations, DocIntegrations, DocCompliance, DocDeployment (this document)

4.5 State & Data Fetching

  • AppContext (in AppLayout) — current user, products list, current product, unread notification count.
  • PermissionsContext — resolved permissions, canAccessModule, canAccessOrganisation, canAccessSettingsSection, getModuleLevel.
  • AuthContext — auth loading/error states, login redirect.
  • Entities are read with base44.entities.<Name>.list/filter/get; realtime via .subscribe() (used for notifications and ticket messages).
  • @tanstack/react-query is available for query caching; most pages use local state + direct SDK calls.

Conventions

Imports use the @/ alias. Pages/components are default-exported. Tailwind classes are literal strings. Icons come from lucide-react. Charts use solid lines only.

5. Automations

Automations run backend functions automatically — on a schedule, on entity record changes, or on connector webhook events. They are managed via the Base44 dashboard or the automation tools. The app currently runs seven active automations.

5.1 Scheduled Automations

NameFunctionSchedulePurpose
Daily Customer Health CalculationcalculateOrgHealthEvery day at 02:00Recalculates health_score/health_status for all active &amp; trial organisations.
Daily Overdue Payment CheckcheckOverduePaymentsEvery day at 09:00Flags pending payments past their due_date as overdue, notifies finance, writes audit log.
Daily Invoice RemindersendInvoiceReminderEvery day at 08:00Sends payment-reminder emails 15 days before an invoice due date.

5.2 Entity-Triggered Automations

NameFunctionEntityEventPurpose
Notify Admins on New TicketnotifyNewTicketTicketcreateNotifies support admins/agents when a ticket is created.
Notify Agent on Ticket UpdatenotifyTicketUpdateTicketupdateNotifies the assigned agent on ticket updates.
Notify Payment FailednotifyPaymentFailedPaymentupdateNotifies finance team when a payment status becomes failed.
Notify Overdue PaymentnotifyOverduePaymentPaymentupdateNotifies finance team when a payment becomes overdue.

No connector automations active

No OAuth connectors are currently authorized, so there are no connector-webhook automations. The Stripe payment flow uses a raw webhook (stripeWebhook) registered directly in Stripe, not a connector automation.

6. Integrations & Environment

6.1 Core Integrations (built-in)

Always available via base44.integrations.Core.<Endpoint>:

EndpointUse in Quantyx
InvokeLLMLLM calls (optional features). Supports file_urls and add_context_from_internet (Gemini models only). Optional model selection.
SendEmailTransactional emails — onboarding invites, OTP requests, invoice reminders, overdue notices, magic links. Reaches registered users always; non-registered addresses require a paid plan + custom domain.
UploadFileUploads generated invoice PDFs and client documents to storage; returns a file_url.
UploadPrivateFileUploads to private storage (returns file_uri for signed URLs).
CreateFileSignedUrlCreates time-limited signed download URLs for private files.
GenerateImageAI image generation.
GenerateSpeechTTS audio generation.
GenerateVideoAI video generation.
TranscribeAudioAudio transcription (Whisper).
ExtractDataFromUploadedFileExtracts structured data from CSV/XLSX/JSON/PDF/images.

6.2 Stripe (Payments)

Stripe is the primary payment gateway, accessed through the shared base44/shared/paymentGateway.tsabstraction (createCustomer, createSubscription, calculateTax,formatCurrency). The stripeWebhook function receives Stripe events over HTTP.

Stripe setup steps

  • Set STRIPE_SECRET_KEY and STRIPE_WEBHOOK_SECRET as environment variables (Base44 dashboard → Settings → Environment Variables).
  • Register the webhook endpoint in Stripe at https://quantyxsolutions.base44.app/functions/stripeWebhook.
  • Subscribe to invoice.payment_succeeded, invoice.payment_failed, customer.subscription.updated.
  • Use sk_test_... keys for development, sk_live_... for production; re-register the webhook per environment.

Optional stripe_tax_enabled on each SaasProduct enables automatic VAT/GST via Stripe Tax; plan tax_code maps to Stripe Tax product tax codes.

6.3 EU VIES (VAT Validation)

The validateVatNumber function calls the EU VIES REST API (ec.europa.eu/taxation_customs/vies/rest-api/check-vat-number) for EU member states, falling back to a format check for non-EU or unreachable VIES. Results are stored in TaxValidation and reflected on the Organisation.

6.4 Environment Variables / Secrets

VariableRequired byPurpose
STRIPE_SECRET_KEYstripeWebhook, setupPayment, generateInvoice (via paymentGateway)Stripe API authentication
STRIPE_WEBHOOK_SECRETstripeWebhookVerifies Stripe webhook signatures
ENCRYPTION_MASTER_KEYencryptData, decryptDataMaster secret from which per-org AES-256-GCM keys are derived (scrypt/PBKDF2)

Where to set secrets

Secrets are set in the Base44 dashboard → Settings → Environment Variables, never in code or entity fields.

6.5 Available App Connectors (not yet connected)

The platform supports OAuth connectors (Google Workspace, Slack, GitHub, Salesforce, HubSpot, Notion, Jira, Linear, etc.) but none are currently authorized. When needed, use get_connectors_info → request_oauth_authorization (shared) or register_workspace_connector (app-user/BYO).

7. Security & Compliance

Quantyx is designed to handle sensitive client organisational data and support regulated SaaS products. This section documents the full compliance posture across access control, encryption, GDPR, OTP-gated access, audit logging, and data classification.

7.1 Authentication & Session Security

  • Admin Portal — Base44-owned auth (token-based sessions, email verification). The app never implements its own auth backend.
  • Idle timeout — useIdleTimeout warns at 25 min and force-logs-out at 30 min (SessionTimeoutWarning).
  • Client Portal — token-based sessions (ClientPortalSession): 8h for password login, 24h for magic link, 7h for legacy createPortalSession. Sessions carry an IP address and can be revoked.
  • Client passwords — SHA-256 hashed with a per-user salt (user id); stored in ClientUser.password_hash. has_set_password gates login.
  • Suspended/churned orgs — portal login and session creation are blocked for suspended/churned organisations.

7.2 Role-Based Access Control (RBAC)

Access is enforced in two layers — frontend gates and backend re-checks — so a crafted client request cannot bypass permissions.

Permission model

  • Each staff user maps to a TeamMember with a role_template (super_admin, support_agent, finance, custom) and one or more permission_sets.
  • Each permission set grants a level (none | read | write | admin) per module: dashboard, organisations, tickets, payments, otp_access, settings, knowledge_base. The highest level across sets wins.
  • accessible_organisation_ids scopes which client orgs a user can see (empty = all).
  • accessible_settings_sections scopes which Settings tabs are visible (empty = all).
  • Platform users with role='admin' are super admins (bypass all gates).

Enforcement points

LayerMechanism
Frontend routesPermissionGuard wraps protected routes; redirects on insufficient access.
Frontend data/UIusePermissions() filters nav, lists, and actions; canAccessOrganisation scopes records.
Backend functionsinitiateOnboarding, generateInvoice, etc. re-check TeamMember module level before acting.
Access-pendingAuthenticated users with no active TeamMember (and not platform admin) see AccessPendingScreen.

Row-Level Security

Entities use Base44's default authenticated access (no per-entity RLS rules are declared). Tenancy isolation is enforced at the application layer: frontend org scoping + backend permission re-checks + the accessible_organisation_ids filter. If stricter DB-level isolation is later required, RLS rules can be added per entity under the rls key in each schema.

7.3 Data Encryption at Rest

Sensitive client data is encrypted with AES-256-GCM (authenticated encryption) via the encryptData/decryptData functions.

  • Key derivation — a 256-bit key is derived per organisation + key-type from ENCRYPTION_MASTER_KEY using scrypt (encryptData) / PBKDF2 with 100,000 iterations and SHA-256 (decryptData).
  • Key records — EncryptedDataKey tracks per-org keys (status active/revoked, key_version, last_rotated_at) for key rotation.
  • Ciphertext record — EncryptedData stores encrypted_data (hex), iv, salt, auth_tag, key_version, plus an access_count and back-reference to the source entity.
  • Integrity — the GCM auth tag is verified on decryption, detecting any tampering.
  • Flagging — Ticket.is_encrypted and Payment.is_encrypted mark records whose sensitive payload is encrypted.

Production hardening

The current implementation derives keys on demand from the master secret. For full production hardening, store the derived key encrypted at rest in EncryptedDataKey.encrypted_key (wrapped by a KMS-managed master key) and rotate ENCRYPTION_MASTER_KEY with dual-key overlap during rotation.

7.4 GDPR & Data Subject Rights

The GdprRequest entity tracks data-subject requests with a statutory 30-day response deadline.

Request typeRight
data_accessRight of access (Art. 15)
data_erasureRight to be forgotten (Art. 17)
data_portabilityData portability (Art. 20)
rectificationRectification (Art. 16)
objectionObjection (Art. 21)
  • Each request has a status workflow (received → in_review → in_progress → completed/rejected), an assignee, a due_date (30 days), and resolution_notes.
  • The GdprRequests admin page surfaces overdue and imminent-deadline requests.
  • Organisation.data_classification (standard | sensitive | restricted) flags the sensitivity of stored data to prioritise handling.

7.5 OTP-Gated Account Access

Support agents can request temporary access to a client's account via a time-limited OTP exchange — the client must explicitly approve.

Agent (in TicketDetail) → requestScreenShareAccess
   creates OtpSession (status=pending), generates otp_code
   → notifyOTPRequest emails code to client contact
Client (via portal/email) → verifyScreenShareOTP
   verifies code → OtpSession status=active
   session window = product.otp_session_duration_minutes (default 30)
Expiry → status=expired (end_reason=timeout)
Agent/manual revoke → status=revoked
  • OTP expiry: SaasProduct.otp_expiry_minutes (default 15) — how long the code is valid.
  • Session duration: SaasProduct.otp_session_duration_minutes (default 30) — how long access stays active after approval.
  • Verification channel (email | in_app | both) and IP address are recorded for audit.
  • Every OTP event is written to AuditLog.

7.6 Audit Logging

The AuditLog entity is an append-only event trail. Backend functions write to it for every significant action.

FieldPurpose
actor_typeadmin / agent / finance / system / client
actor_id, actor_nameWho performed the action
event_typee.g. onboarding_initiated, vat_validation, payment_overdue, payment_setup_completed
event_descriptionHuman-readable summary
metadataStructured detail (ids, amounts, plan, etc.)
saas_product_id, organisation_id, ticket_id, otp_session_idContext ids
ip_addressWhere available

Examples of audited events: onboarding initiation, VAT validation, payment setup completion, payment overdue marking, invoice generation.

7.7 Compliance Certifications

The ComplianceCert entity tracks each product's certification posture: soc2_type1/type2, iso27001/27017/27018, gdpr, hipaa, pci_dss, fedramp, with status (active | in_progress | expired | not_started), issuer, validity window, and document URL. Managed in Settings → Compliance.

7.8 Knowledge Base Access Control

End-user KB access is token-gated. The getKbContent public endpoint verifies an HMAC token signed with the product's kb_secret, ensuring only authenticated, active users of a product can read its KB. generateKbToken (admin-only) mints test tokens. KB topic edits are versioned via KbVersion snapshots on publish.

7.9 Data Classification Summary

ClassificationMeaningHandling
standardRoutine business dataDefault access controls
sensitivePersonal or confidential dataEncrypted at rest (EncryptedData), access scoped
restrictedRegulated / high-risk dataEncryption + strict org scoping + audit on every access

8. Deployment & Operations

8.1 Published Application

The app is published at https://quantyxsolutions.base44.app. For external webhook URLs (e.g. Stripe), use https://quantyxsolutions.base44.app/functions/<functionName>. From inside app code, invoke functions through the SDK (base44.functions.invoke(...)), not an absolute URL.

8.2 Custom Domain

A custom domain can be connected for the public-facing surfaces. The clientPortalAuth function derives the portal magic-link origin from CompanyProfile.website (falling back to the platform domain), so updating the website field in Settings → Company Profile updates the magic-link base URL. For links a user clicks in the UI, prefer the connected custom domain.

8.3 Local Development

# install dependencies
npm install

# run the dev server (Vite)
npm run dev

# build for production
npm run build

The project is Vite + React (ESM). Use @/ import aliases. Backend functions run on the Deno runtime and are edited in base44/functions/*/entry.ts.

8.4 Environment Setup Checklist

StepWhereDetail
Set STRIPE_SECRET_KEYBase44 → Settings → Env Varssk_test_... or sk_live_...
Set STRIPE_WEBHOOK_SECRETBase44 → Settings → Env Varswhsec_... from Stripe webhook endpoint
Set ENCRYPTION_MASTER_KEYBase44 → Settings → Env VarsStrong random secret for AES key derivation
Register Stripe webhookStripe Dashboard → Developers → Webhookshttps://quantyxsolutions.base44.app/functions/stripeWebhook
Configure CompanyProfileSettings → Company ProfileCompany name, logo, address, bank details, payment_terms_days, website (portal origin)
Create SaasProduct(s)Settings → SaaS ProductsName, API base, OTP callback, billing config, kb_secret
Create SubscriptionPlansProduct detail pageTiers, pricing, Stripe price IDs, tax codes
Invite team membersTeam pageRole template + per-product permission sets
Set SLA &amp; Dunning policiesSettings → SLA / DunningPer product/tier

8.5 Operational Automations (always-on)

  • calculateOrgHealth — daily 02:00 — keeps health scores fresh.
  • checkOverduePayments — daily 09:00 — flags overdue invoices.
  • sendInvoiceReminder — daily 08:00 — 15-day pre-due reminders.
  • Entity automations fire on Ticket create/update and Payment update (see §5).

8.6 Monitoring & Maintenance

  • Audit trail — query AuditLog for any action's actor, time, and metadata.
  • Notifications — the in-app bell + Notifications page surface system and finance alerts; unread count is realtime-subscribed in AppProviders.
  • Automation health — check last_run_status and consecutive_failures via the automations tools.
  • Key rotation — rotate ENCRYPTION_MASTER_KEY with overlap; EncryptedDataKey.key_version supports versioned decryption.

8.7 Extending the App

  • New entity — add base44/entities/<Name>.jsonc (full JSON schema, no placeholders); access via base44.entities.<Name>.
  • New backend function — add base44/functions/<name>/entry.ts; reuse shared logic in base44/shared/; test with test_backend_function.
  • New page — add src/pages/<Name>.jsx, import + add a <Route> in src/App.jsx, and a sidebar nav item in Sidebar.jsx.
  • New automation — use create_automation (scheduled / entity / connector).
  • New connector — get_connectors_info → authorize or register, then build connector-backed features.

8.8 Known Limitations & Future Hardening

  • RLS is application-layer only; add DB-level RLS rules if regulatory requirements demand enforced row isolation.
  • Encryption keys are derived on demand from the master secret; wrap derived keys with a KMS-managed master key for full production hardening.
  • Stripe is the only connected payment processor; additional gateways are configurable via PaymentGateway records and the testGateway function.
  • No OAuth connectors are connected yet; the platform supports them when needed.