Architecture

Overview of the html.ai platform architecture and services.

System Overview

html.ai is a multi-tenant B2B platform providing AI-powered UI personalization with cross-site identity tracking and data sharing between partner businesses.

Multi-Tenant Architecture

Complete data isolation with API key auth

Cross-Site Tracking

Global UIDs for unified user profiles

Real-Time Analysis

AI-powered behavioral identity detection

Data Sharing

Privacy-conscious partner data exchange

Services

The platform consists of 7 containerized services:

MongoDB

:27017

Primary database with persistent storage

AI Backend

:3000

FastAPI app with multi-agent AI system

Tracking Service

:3001

Cross-site identity sync domain

SDK Server

:8080

Nginx serving JavaScript SDK files

Dashboard

:8081

Admin UI for analytics and config

Demo Store

:8082

Example e-commerce integration

Marketing

:4000

Next.js landing page and docs

Docker Setup

# Start all services
docker-compose up -d

# View logs
docker-compose logs -f

# Stop services
docker-compose down

# With Gemini API key (for AI features)
GEMINI_API_KEY=your_key docker-compose up -d

Port Reference

27017MongoDB
3000API
3001Tracking
8080SDK
8081Dashboard
8082Demo
4000Marketing

Database

MongoDB collections for multi-tenant data storage:

businesses

Registered accounts with API credentials

events

Behavioral events from user interactions

users

User sessions per business

variants

Content variants shown with conversion tracking

global_users

Cross-site identity mappings

data_sharing_agreements

Partner sharing configurations

See scripts/mongo-init.js for indexes and demo data setup.