File size: 4,821 Bytes
21cac8a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# Getting Started with UX Analyst AI

This guide will help you set up and run UX Analyst AI locally in just a few minutes.

## πŸ“‹ Prerequisites

1. **Node.js 18+** - [Download here](https://nodejs.org/)
2. **Google Gemini API Key** - [Get one here](https://makersuite.google.com/app/apikey)

## πŸš€ Quick Setup

### 1. Get Your Gemini API Key

1. Visit [Google AI Studio](https://makersuite.google.com/app/apikey)
2. Sign in with your Google account
3. Click "Create API Key"
4. Copy the generated key (starts with `AIza...`)

### 2. Clone and Install

```bash
# Clone the repository
git clone <repository-url>
cd ux-analyst-ai

# Install all dependencies (backend + frontend)
npm run install:all
```

### 3. Configure Environment

```bash
# Copy the environment template
cp .env.example .env

# Edit the .env file and add your API key
# Replace 'your_gemini_api_key_here' with your actual key
```

Your `.env` file should look like:
```bash
GEMINI_API_KEY=AIzaSyC1234567890abcdefghijklmnopqrstuvwxyz
```

### 4. Test Gemini Integration (Optional)

```bash
# Test that your API key works
cd backend
node test-gemini.js
```

You should see:
```
πŸŽ‰ All tests passed! Gemini integration is working correctly.
```

### 5. Start the Application

```bash
# Start both backend and frontend
npm run dev
```

This will start:
- **Backend API** on http://localhost:3000
- **Frontend** on http://localhost:5173

### 6. Try Your First Analysis

1. Open http://localhost:5173 in your browser
2. Enter any website URL (try `https://example.com`)
3. Click "Start UX Analysis"
4. Watch the real-time progress!

## πŸ”§ Development Commands

```bash
# Install all dependencies
npm run install:all

# Start both backend and frontend
npm run dev

# Start only backend (port 3000)
npm run dev:backend

# Start only frontend (port 5173)
npm run dev:frontend

# Build frontend for production
npm run build

# Run backend tests
npm test
```

## 🐳 Docker Setup (Alternative)

If you prefer Docker:

```bash
# Build frontend first
cd frontend && npm run build && cd ..

# Set your API key
export GEMINI_API_KEY=your_api_key_here

# Run with Docker Compose
docker-compose up -d

# Access at http://localhost:3000
```

## 🎯 What You Can Analyze

The UX Analyst AI can analyze any public website and provides:

- **Visual Design Assessment** - Typography, color, layout critique
- **Accessibility Analysis** - WCAG compliance checking
- **Usability Review** - Navigation, user flow, and UX patterns
- **Mobile Responsiveness** - Cross-device experience evaluation
- **Performance Insights** - Visual performance indicators

## πŸ” Understanding the Analysis

The system captures screenshots across different device sizes and uses Gemini's vision capabilities to:

1. **Analyze Visual Hierarchy** - How well the design guides user attention
2. **Check Accessibility** - Color contrast, text size, interactive elements
3. **Evaluate Usability** - Navigation clarity, content organization
4. **Assess Mobile Experience** - Layout adaptation and touch-friendliness
5. **Generate Recommendations** - Prioritized, actionable improvement suggestions

## πŸ“Š Analysis Types

- **Quick Analysis (~1 minute)** - Basic UX overview with key insights
- **Comprehensive Analysis (~3 minutes)** - Full UX + accessibility audit with detailed recommendations

## 🚨 Troubleshooting

### Common Issues

**"GEMINI_API_KEY not found"**
- Make sure you copied `.env.example` to `.env`
- Verify your API key is correctly set in the `.env` file
- Don't include quotes around the API key

**"API_KEY_INVALID"**
- Double-check your API key from Google AI Studio
- Ensure you have Gemini API access enabled

**Screenshots not loading**
- Check that the `data/screenshots` directory exists
- Ensure sufficient disk space
- Try analyzing a different website

**Analysis stuck at "Capturing Screenshots"**
- Some websites block automated access
- Try a different URL
- Check your internet connection

### Getting Help

1. **Check the logs** - Look at the browser console and terminal output
2. **Test Gemini integration** - Run `node backend/test-gemini.js`
3. **Verify environment** - Visit http://localhost:3000/api/health

## πŸ’‘ Tips for Best Results

1. **Use public websites** - Private or login-required sites won't work
2. **Try well-known sites first** - Test with sites like `https://github.com` or `https://stackoverflow.com`
3. **Wait for completion** - Analysis takes 1-3 minutes depending on the type
4. **Check multiple viewports** - Enable desktop, tablet, and mobile for comprehensive analysis

## πŸŽ‰ You're Ready!

You now have UX Analyst AI running locally. Try analyzing your own website or any site you're curious about. The AI will provide detailed, actionable feedback to improve user experience and accessibility.

Happy analyzing! πŸš€