# AI User Simulator — System Design & Architecture
# Overview
AI User Simulator is a browser interaction platform that simulates how a real first-time user experiences a website.
The system is designed around:
- modular architecture
- rapid iteration
- scalability
- low operational complexity
- future extensibility
The product must initially optimize for:
- fast shipping
- useful feedback
- smooth interaction replay
- simple architecture
The architecture should avoid:
- premature microservices
- over-engineering
- unnecessary abstractions
The system should remain:
- developer-friendly
- highly modular
- easy to iterate rapidly
---
# Core Architecture Philosophy
## 1. Simple First, Scalable Later
The architecture should:
- work well as a small product
- scale incrementally
- avoid massive rewrites later
Initial architecture:
- modular monolith
Future architecture:
- service separation only when needed
---
## 2. Two-Model Architecture
The platform uses two separate AI systems:
---
## Model 1 — Interaction Agent
Purpose:
- interact with website
- simulate user behavior
- decide next actions
Responsibilities:
- click buttons
- fill forms
- scroll pages
- navigate website
- explore flows
- generate interaction reasoning
Characteristics:
- fast
- cheap
- iterative
- action-oriented
Preferred models:
- Qwen
- DeepSeek
- Llama
- small open-source reasoning models
This model should optimize for:
- speed
- cost efficiency
- interaction continuity
---
## Model 2 — Report Generator
Purpose:
- analyze interaction history
- analyze screenshots
- generate UX insights
- summarize friction points
- create actionable reports
Responsibilities:
- UX review
- onboarding analysis
- friction analysis
- usability explanation
- timeline generation
- improvement suggestions
Preferred model:
- Gemini 2.5 Flash / Pro
This model should optimize for:
- reasoning quality
- multimodal understanding
- structured output
- human-like feedback
---
# High-Level System Architecture
```txt
Frontend (Next.js)
↓
API Gateway Layer
↓
Session Manager
↓
Browser Interaction Engine (Playwright)
↓
Interaction Agent Model
↓
Event + Screenshot Storage
↓
Report Generator Model
↓
Frontend Replay + Report UI- Next.js
- React
- TailwindCSS
- shadcn/ui
- Framer Motion
Frontend handles:
- URL submission
- prompt selection
- live interaction display
- replay timeline
- report rendering
- loading states
- interaction visualization
The frontend should feel:
- alive
- interactive
- cinematic
- minimal
- modern
NOT:
- dashboard-heavy
- enterprise-style
- analytics-focused
Acts as orchestration layer between:
- frontend
- browser engine
- models
- storage
- create sessions
- start browser agents
- stream interaction updates
- store logs
- trigger report generation
- return replay data
/app/api
/session
/run
/report
/replay- Playwright
Responsible for:
- browser control
- page navigation
- screenshots
- DOM extraction
- interaction execution
Each session must:
- run isolated
- use separate context
- avoid leaking cookies/sessions
Observe page
↓
Extract interactive elements
↓
Build simplified page context
↓
Send to interaction model
↓
Receive next action
↓
Execute action
↓
Capture screenshot + logs
↓
RepeatActs as simulated user brain.
This layer decides:
- what to click
- what feels confusing
- where to navigate
- what action to try next
The model should NOT directly control raw browser APIs.
Instead:
Playwright = executor
LLM = decision makerInstead of exposing:
- raw DOM
- full HTML
- massive token contexts
Create simplified interaction objects.
Example:
[
{
"id": 1,
"type": "button",
"text": "Get Started",
"position": "top-right"
},
{
"id": 2,
"type": "input",
"placeholder": "Email"
}
]This reduces:
- token cost
- hallucinations
- instability
The model prompt should enforce:
You are a first-time user exploring a website.
Your goal:
- understand the product
- attempt onboarding
- identify confusing experiences
- behave naturally
You are NOT a QA tester.
You are NOT a developer.
You are an impatient first-time user.Every interaction must be logged.
- page visited
- button clicked
- text entered
- hesitation moments
- reasoning
- screenshots
- timestamps
- errors
{
"timestamp": 12,
"action": "click",
"target": "Get Started",
"reasoning": "Trying to begin onboarding flow"
}Visual replay and report analysis.
Capture:
- initial landing page
- post interaction states
- errors
- onboarding pages
- final state
Avoid:
- screenshot every millisecond
Instead:
- event-based screenshots
Capture after:
- clicks
- navigation
- forms
- scroll milestones
The report model receives:
- interaction timeline
- screenshots
- interaction reasoning
- page metadata
- friction events
Generate:
- UX summary
- friction analysis
- emotional interpretation
- onboarding feedback
- actionable improvements
- Overall Experience
- What Worked Well
- Friction Points
- Timeline Analysis
- Top Improvements
Reports must:
- feel human
- stay concise
- avoid fake AI jargon
Use:
- PostgreSQL
Optional:
- Supabase
id
url
prompt
status
created_at
completed_atid
session_id
timestamp
action
target
reasoning
screenshot_urlid
session_id
summary
friction_points
improvements
created_atUse:
- WebSockets or
- Server-Sent Events (SSE)
Stream:
- live browser state
- interaction thoughts
- replay events
- progress updates
This creates:
- engagement
- trust
- interactivity
The replay system is one of the most important features.
Displays:
- chronological events
- timestamps
- observations
Displays:
- screenshots
- interactions
- navigation progression
Displays:
- AI reasoning
- confusion
- expectations
- frustrations
Scale only after:
- validated demand
- real usage
- clear bottlenecks
Possible future separation:
Frontend Service
Interaction Service
Replay Service
Report Service
Analytics ServiceBut initially:
- keep monolithic
As traffic grows:
Use:
- Redis + BullMQ
For:
- browser job queues
- report generation queues
- screenshot processing
Browser automation is expensive.
Future scaling:
- browser pooling
- browser workers
- distributed Playwright nodes
Possible future tools:
- Browserless
- Playwright Cluster
Use expensive models ONLY where necessary.
Use for:
- navigation
- clicking
- exploration
- interaction loops
Use for:
- final report generation
- multimodal reasoning
- screenshot analysis
This architecture significantly reduces costs.
Prevent:
- localhost access
- internal network access
- malicious URLs
- SSRF attacks
Each browser context must:
- remain isolated
- clear cookies/session
- terminate cleanly
The interface should feel:
- futuristic
- minimal
- fluid
- cinematic
- premium
Inspired by:
- Vercel
- Linear
- Perplexity
- modern AI products
- dark mode first
#09090B#7C3AEDPurple/violet accent for:
- actions
- highlights
- interaction glow
#06B6D4Cyan accent for:
- active states
- live interactions
Primary:
#FAFAFASecondary:
#A1A1AARecommended:
- Inter
- Geist
- Satoshi
The UI should feel:
- smooth
- reactive
- lightweight
Animations:
- subtle
- fast
- meaningful
Avoid:
- flashy effects
- excessive motion
- heavy gradients
Contains:
- hero text
- URL input
- quick prompts
- CTA button
Minimal layout.
Split layout:
- browser replay
- interaction timeline
This is the main product experience.
Contains:
- summary
- friction points
- improvements
- replay timeline
Every major feature should be isolated.
Example:
- replay module
- report module
- interaction module
Do NOT:
- microservice too early
- optimize too early
- abstract unnecessarily
The architecture exists to:
- support iteration
- support speed
- support learning
Not to appear technically impressive.
The real success metric is:
- repeated usage
- builders testing repeatedly
- founders improving UX based on reports
NOT:
- vanity metrics
- AI complexity
- feature count
This product is NOT:
- a static analyzer
- an SEO checker
- an enterprise UX suite
This product IS:
An AI-powered first-time user simulator.The replay experience is the product.
The report is secondary.
The emotional realization:
“Users probably struggle here too.” is the core value delivered.