Appearance
AI Project Analyzer — Feature Documentation (EN)
Overview
AI Project Analyzer helps sellers create listings faster by analyzing a project link (website or repository) and auto‑populating the create‑listing form on /create-listing. Users can review and edit all fields before saving a draft or submitting for review.
Current Implementation:
- Mistral AI (blue theme) - Direct API integration with Mistral Large/Small
- n8n AI Agent (green theme) - Workflow automation via n8n webhook (deprecated in favor of Mistral)
The system uses Mistral AI as the primary analyzer with robust error handling and JSON parsing recovery mechanisms.
Key Capabilities
- Mistral AI: Direct AI analysis powered by Mistral Large/Small with automatic model fallback
- Robust Error Handling: JSON parsing recovery with 5-strategy truncation and fallback mechanisms
- Rate Limit Management: User-friendly 429 error messages with retry guidance
- Works with public websites and code repositories (GitHub/GitLab)
- Secure invocation via Supabase Edge Function with JWT verification
- Attractive, responsive UI with AI-futuristic loading animations and clear states
- Safe merge logic: preserves any user‑typed data, only fills missing fields
- Financial Defaults: Generates realistic market averages when specific data unavailable
Data Fields Auto‑Populated
The analyzer aims to fill the following groups (where information is publicly discoverable):
- Basic Information
- title/title_en/title_ro
- category (normalized slug from DB
listing_categories) - website_url
- Overview
- business_model (markdown)
- description (summary/overview)
- established_date (YYYY‑MM‑DD)
- number_of_customers (integer)
- Financial Data
- monthly_revenue (USD)
- monthly_profit (USD)
- price (from AI
sale_price) - allow_negotiation (boolean)
- price_reasoning (markdown)
- Traffic & Audience
- monthly_traffic
- target_audience (markdown)
- Business Details (markdown; structured accordions)
- Introduction: business_description, business_model, key_strengths, team_founder
- Business Details: included_assets, operations_time_required, technology_stack, financial_performance, expenses, growth_opportunities
- Conclusion & Motivation: reason_for_selling, benefits_for_buyer, risks_challenges, ideal_buyer_profile
- Resources & Technologies
- technologies (multi‑select; array of strings)
- included_assets (array of strings)
If data is not found, numeric fields default to 0 and strings to an empty string.
Architecture
Frontend Components
1. Mistral AI Analyzer (N8NAIProjectAnalyzer)
- Theme: Blue/Purple gradient with AI-futuristic animations
- Icon: CPU/Bot icons with orbiting particles
- Authentication: Requires JWT (from
useAuthcontext) - Endpoint:
https://nujcbrbtejvhuajfwgeo.supabase.co/functions/v1/analyze-project - Features:
- Accepts a project URL input
- Calls the Supabase Edge Function with the current user JWT
- Displays advanced loading animations with dynamic text
- Emits AI result back to parent via
onDataGeneratedcallback - Handles 429 (rate limit) errors with user‑friendly messages
- Comprehensive error handling and logging
- Maps AI response to FormData structure correctly
2. Legacy n8n AI Analyzer (Deprecated)
- Status: Deprecated in favor of Mistral AI
- Reason: CORS issues and complexity of external webhook management
- Replacement: All functionality moved to Mistral AI implementation
2. Form Integration (CreateListingContent)
- Renders Mistral AI analyzer for new listings only (not during edit)
- Merges AI data into
formDatausing safe, field‑by‑field mapping - Normalizes category to a valid slug from
listing_categories - Maps structured markdown sections into dedicated
description_*form fields (accordions) - Preserves user‑typed data (AI only fills empty fields)
- Comprehensive logging for debugging AI data flow
Backend
Mistral AI Backend (Supabase Edge Function)
functions/analyze-project- Verifies JWT (config
verify_jwt = true) - Validates URL input
- Builds optimized JSON‑only prompt for Mistral (max 3 sentences per field)
- Calls Mistral Chat Completions API with temperature 0.7
- Model Selection:
mistral-small-latest(with fallback tomistral-large-latest) - Token Optimization: Reduced
max_tokensto 1000 for efficiency - Robust JSON Parsing: 5-strategy truncation and repair logic
- Error Recovery: Fallback to minimal valid JSON if parsing fails
- Rate Limit Handling: User-friendly 429 error messages
- Financial Defaults: Generates market averages when data unavailable
- Timeout Management: 60-second timeout with AbortController
- Verifies JWT (config
Environment & Configuration
Mistral AI
- Secret:
MISTRAL_API_KEY(Supabase project secret) - Config:
supabase/config.toml[functions.analyze-project] verify_jwt = true
- Models:
mistral-small-latest(primary),mistral-large-latest(fallback) - Rate Limits: Handles 429 errors gracefully with user guidance
n8n Integration (Optional)
- Webhook URL:
https://n8n.10alert.com/webhook/95e9d69b-25c0-4642-bd84-9a52ad68f912 - Purpose: Admin notifications and listing events
- Configuration: Set as Supabase secrets
N8N_WEBHOOK_URL,N8N_WEBHOOK_CHAT,N8N_WEBHOOK_LISTING
How It Works (Step‑by‑Step)
Mistral AI Flow
- User opens
/create-listing(authenticated) - Enters a project URL in the AI analyzer card
- Clicks "Analyze Project" button
- Frontend displays AI-futuristic loading animation with dynamic text
- Frontend sends
POSTtofunctions/v1/analyze-projectwithAuthorization: Bearer <JWT> - Edge Function validates JWT and calls Mistral API
- Robust Processing: JSON parsing with 5-strategy recovery if needed
- Financial Defaults: Generates market averages for missing financial data
- Edge Function returns structured JSON response
- Frontend merges AI fields into form state (preserves user input)
- User reviews and edits populated fields as needed
- User saves draft or submits for review (existing flow unchanged)
Error Handling Flow
- 429 Rate Limit: User sees "Service is currently overloaded. Please try again in 10 minutes."
- JSON Parse Error: System attempts 5-strategy truncation and repair
- Complete Failure: Falls back to minimal valid JSON with "Unable to determine" values
- Timeout: 60-second timeout with user-friendly error message
API Contract
Request
json
{
"url": "https://example.com"
}Response (example; fields may be empty if data is unavailable)
json
{
"title": "Project Name",
"category": "saas",
"website_url": "https://example.com",
"business_model": "Markdown body...",
"description": "Overview paragraph...",
"established_date": "2023-01-01",
"number_of_customers": 1250,
"monthly_revenue": 15000,
"monthly_profit": 8500,
"sale_price": 125000,
"allow_negotiation": true,
"price_justification": "Markdown body...",
"monthly_traffic": 45000,
"target_audience": "Markdown body...",
"competitors": "Markdown list...",
"growth_opportunities": "Markdown body...",
"reason_for_selling": "Markdown body...",
"tech_stack": ["React", "Node.js", "PostgreSQL", "AWS"],
"included_resources": ["Codebase & Files", "Domain", "Analytics"],
"introduction": {
"business_description": "Markdown...",
"business_model": "Markdown...",
"key_strengths": "Markdown...",
"team_founder": "Markdown..."
},
"business_details": {
"included_assets": "Markdown...",
"operations_time_required": "Markdown...",
"technology_stack": "Markdown...",
"financial_performance": "Markdown...",
"expenses": "Markdown...",
"growth_opportunities": "Markdown..."
},
"conclusion_motivation": {
"reason_for_selling": "Markdown...",
"benefits_for_buyer": "Markdown...",
"risks_challenges": "Markdown...",
"ideal_buyer_profile": "Markdown..."
}
}Field Mapping Highlights
Category normalization
- AI returns a label (e.g., "SaaS"); frontend normalizes to slug and matches against DB
listing_categories.slug/name. - Fallback: empty string when no confident match is found (prevents invalid slugs).
- AI returns a label (e.g., "SaaS"); frontend normalizes to slug and matches against DB
Structured Description (accordions)
introduction.*→description_introduction_*business_details.*→description_content_*conclusion_motivation.*→description_conclusion_*
Technologies/Included Assets
tech_stack→technologies[]included_resources→included_assets[]
Financials
sale_price→priceprice_justification→price_reasoning(_en/_ro)
Security Considerations
- JWT verification enforced by Supabase (function‑level and in code)
- CORS configured for Supabase Functions endpoint
- No secrets in frontend; AI key stored as Supabase secret
- Defensive parsing: AI output must be valid JSON; otherwise a 500 error is returned
UX Notes
- Analyzer card is visible only for new listings (not during edit)
- Clearly communicates loading/progress and any errors
- Never overwrites existing user input; only fills blanks
Troubleshooting
Common Issues
404 Not Found
- Ensure the frontend calls the fully‑qualified Supabase Functions URL
- Check that Edge Function is deployed:
supabase functions deploy analyze-project
401 Invalid JWT
- User must be logged in; frontend sends
Authorization: Bearer <session.access_token> - Check if JWT has expired (logout and login again)
- User must be logged in; frontend sends
"Failed to parse AI analysis"
- System automatically attempts 5-strategy JSON repair
- Check Edge Function logs for detailed error information
- Verify Mistral API response contains valid JSON
429 Service tier capacity exceeded
- User sees friendly message: "Service is currently overloaded. Please try again in 10 minutes."
- System automatically switches to
mistral-small-latestmodel
Category remains empty
- AI label may not match DB category slug
- Check
listing_categoriestable for available slugs - Add missing category or adjust normalization logic
Price not populated
- Verify
sale_pricemapping topricefield - Check console logs for mapping debug information
- Verify
Debug Information
- Frontend Logs: Check browser console for AI data flow
- Edge Function Logs: Check Supabase dashboard for server-side errors
- Mapping Logs: Console shows
sale_price from AI,mapped price, etc.
Testing Checklist
Basic Functionality
- [ ] Public website URL analysis (e.g.,
https://windowsreport.com) - [ ] GitHub repository URL analysis
- [ ] Authentication required (redirects to login if not authenticated)
Data Population
- [ ] Basic Information: title, category (slug), website_url
- [ ] Financial Data: monthly_revenue, monthly_profit, price (sale_price)
- [ ] Structured Descriptions: introduction, business_details, conclusion_motivation
- [ ] Technologies: tech_stack array, included_assets array
- [ ] Business Details: established_date, number_of_customers, monthly_traffic
Error Handling
- [ ] 429 rate limit shows user-friendly message
- [ ] Invalid URLs show appropriate error
- [ ] JSON parsing errors are handled gracefully
- [ ] Timeout after 60 seconds
User Experience
- [ ] Loading animation displays correctly
- [ ] User-typed fields are preserved on re-analysis
- [ ] Form validation works with AI-populated data
- [ ] Only new listings show AI analyzer (not during edit)
Change Log (Feature)
v1.0.0 (Initial Release)
- Added AI Project Analyzer component with Mistral integration
- Implemented
analyze-projectEdge Function - Category slug normalization and structured mapping
v1.1.0 (Robust Error Handling)
- Added 5-strategy JSON parsing recovery
- Implemented rate limit handling with user-friendly messages
- Added financial defaults for missing data
- Enhanced logging for debugging
v1.2.0 (UI/UX Improvements)
- AI-futuristic loading animations with dynamic text
- Improved error states and user feedback
- Comprehensive field mapping with debug logging
- Deprecated n8n webhook in favor of Mistral AI
v1.3.0 (Production Ready)
- Fixed price mapping (
sale_price→price) - Optimized token usage and model selection
- Added timeout management with AbortController
- Enhanced error recovery mechanisms