Architecture & Multi-Tenancy
How TTF unifies identity, database isolation, real-time sockets, and Cloudflare edge frontends across 15+ apps.
High-Level Topology
Time To Future runs a hub-and-spoke SaaS architecture:
- Edge Web Frontends: React 19 + Vite apps (plus
glintly-ui) deployed globally on Cloudflare Workers Assets with SSR prerendering for public/SEO surfaces. - Native Mobile Apps: Expo / React Native apps for TTF HRMS Mobile and TTF Mail Mobile consuming the same REST APIs.
- Unified Master Backend: Node.js / Express 5 (
master-backend) exposing modular service routers under/api/*, Socket.IO for real-time DG Messenger events, and central SSO (/api/sso/*).
Multi-Tenant Data Isolation
Every enterprise resource in the shared database carries an indexed companyId discriminator enforced at the query and middleware layer:
- Authenticated JWTs bind the caller to their
userId,companyId, androle. - Controllers scope reads and writes by
req.user.companyId— cross-tenant queries are impossible even if a caller alters a document ID in a request URL. - Dedicated single-tenant deployments are available for Enterprise Cloud customers.
Shared Identity vs. Isolated App Accounts
- Core Suite (
HRMS,Client Deck,Task Deck,Mail,Messenger): Share the centralUsermodel and Sign in with TTF OAuth2 + PKCE (trust: 'first_party'). - Developer Console (
console.timetofuture.com): Uses an isolatedDeveloperaccount model so external developers can manage third-partySsoClientapps without ever accessing TTF company data. - Formx (
formx.timetofuture.com): Supports dedicated Formx accounts under/api/forms/authalongside origin-open public submission endpoints (/api/forms/public/:token/submit).
Last updated on
