P001 · Platform Foundation

The permanent foundation
for AIREx

AIREx is the Operating System for Vertical Real Estate. This is the enterprise architecture every future feature builds on — 18 core services, RLS-secured Postgres, canonical identity, and an API-first delivery model designed for 100M+ properties, organizations, users, AI jobs, and signals.

100M+
Properties
100M+
Signals
18
Core Services
15
User Roles
Layered Stack

A layered enterprise stack

Presentation
TanStack Start · React 19 · Tailwind v4 · component-driven · WCAG-aware · dark/light.
Application
Server functions, TanStack Router loaders, TanStack Query cache, request middleware.
Domain Services
18 core services exposing typed, versioned interfaces to every surface of AIREx.
API Gateway
Rate limiting, API keys, tenant scoping, audit logging, versioning (v1, v2 …).
Data & AI
Postgres with RLS · Storage · Realtime · Edge functions · Lovable AI models · vector search.
Security & Governance
Row-level policies · security-definer helpers · audit ledger · encrypted secrets · session management.
Core Services

18 reusable services

Property Service
Canonical AIREx Property ID and versioned parcel state.
Opportunity Service
Continuous opportunity discovery, scoring, and pipelining.
AIRScore Service
Multi-dimensional scoring with transparent weights.
Digital Twin Service
4D representations of every parcel and portfolio.
Reality Engine
Reasoning, causal analysis, and evidence graphs.
Signals Service
Personalized signal streams and morning briefings.
Autopilot Service
Rule-driven monitoring and autonomous triggers.
Forecast Service
P10/P50/P90 forecasting across markets and assets.
Trust Service
Verification, provenance, and certification.
Notification Service
Cross-channel delivery with per-user preferences.
Reporting Service
PDF, Excel, PowerPoint, and CSV generation.
Search Service
Universal, natural-language, and structured search.
User Service
Profiles, sessions, and preferences.
Organization Service
Multi-tenant orgs, memberships, and isolation.
Workflow Service
Approval chains, task management, and pipelines.
Document Service
Deal rooms, versioned files, and e-signatures.
Media Service
Images, video, and streaming intelligence.
API Gateway
Versioned, rate-limited, keyed access to all services.
Data Model

Foundational schema (live in Cloud)

Tables provisioned
organizationsid · name · slug · org_type · version · audit
organization_membersorg_id · user_id · member_role
profilesid → auth.users · display_name · avatar_url
user_rolesuser_id · role · organization_id
audit_logactor · action · resource · metadata · ip
Database principles
Normalized
One source of truth. No duplicated data.
UUIDs everywhere
Stable, globally unique identifiers.
Soft deletes
deleted_at, never destructive.
Audit history
Every mutation captured.
Versioned records
Optimistic concurrency & replay.
Tenant isolation
RLS scoped to org membership.
Indexed & FK-safe
Referential integrity enforced.
Row-level security
Policies on every public table.
Multi-Tenant

Organization isolation, by default

Every organization owns
Users
Projects
Reports
Workflows
Documents
Notifications
Portfolios
AI history
Signals
Deal rooms
15 user types
GuestRegisteredProperty OwnerBrokerDeveloperMunicipalityEngineerArchitectInvestorLenderConsultantUtilityTelecomAdministratorPlatform Admin
Stored in user_roles with a security-definer has_role() helper — never on profiles.
Security

Enterprise security posture

Row-Level Security
Enforced on every public.* table.
Role-based permissions
app_role enum + has_role() helper.
Audit logging
audit_log captures actor, action, resource, ip.
Session management
Supabase-managed sessions & refresh.
Rate limiting
At the API gateway, per-key and per-org.
Encrypted storage
At-rest encryption for all Cloud data.
Definition of Done

P001 · Foundation Ready

Architecture documented
Services organized
Database normalized
Navigation complete (canonical mega-menu)
Authentication working (email + Google)
Organization support working
Permissions working (has_role)
Documentation generated
No duplicate code
No regressions
Foundation ready for P002