Features

AI Features

The CRM uses AI to speed up repetitive tasks — parsing project descriptions, generating proposals, and suggesting pricing. All AI features gracefully fall back to regex parsing when no API key is configured.

Natural Language Project Parsing

Type a project description in plain English and the AI extracts structured data: client name, project type, budget, hourly rate, and estimated duration. This saves you from manually filling out every field on the create-project form.

Natural language parsing
// Natural language project parsing
// Input: "Build a marketing site for Acme Corp, budget around 12k,
//         should take about 6 weeks, hourly at $150/hr"

// AI extracts structured data:
{
  name: "Marketing Site for Acme Corp",
  client: "Acme Corp",
  type: "HOURLY",
  budget: 12000,
  hourlyRate: 150,
  estimatedDuration: "6 weeks",
  description: "Build a marketing website"
}

The extracted data pre-fills the project form. You can review and edit before saving.

AI Proposal Generation

When creating a proposal, click "Generate with AI" to get three pricing tiers automatically. The AI considers the project scope, your historical rates, and industry benchmarks to produce realistic options.

Generated proposal tiers
// AI-generated proposal with 3 tiers
// The AI considers project scope, market rates, and your history

Option A — Basic ($8,000)
  Core marketing pages (Home, About, Contact, Blog)
  Mobile-responsive design
  2-week delivery, 1 revision round

Option B — Standard ($14,000)
  Everything in Basic, plus:
  CMS integration (headless WordPress or Sanity)
  SEO optimization and analytics setup
  4-week delivery, 2 revision rounds

Option C — Premium ($22,000)
  Everything in Standard, plus:
  Custom animations and interactions
  A/B testing setup
  Performance optimization (Core Web Vitals)
  6-week delivery, unlimited revisions
  • *Each tier includes scope, timeline, and revision policy
  • *Pricing uses anchoring — the premium tier makes the standard tier look reasonable
  • *All generated content is editable before sending to the client

Pricing Suggestions

The AI analyzes your completed projects to suggest rates for new work. It looks at your effective hourly rate across similar project types and compares it to market benchmarks.

Pricing suggestion engine
// Pricing suggestion engine
// Analyzes your historical data to suggest rates

interface PricingSuggestion {
  suggestedRate: number;   // Based on your avg effective rate
  marketRate: number;      // Industry benchmark (if available)
  confidence: "low" | "medium" | "high";
  reasoning: string;
}

// Example output:
// "Based on 12 completed projects, your effective hourly rate
//  averages $142/hr. For this project type (marketing site),
//  your rate has been $155/hr. Suggested: $160/hr."

Suggestions appear as a tooltip when you focus the rate or budget fields on the project form.

Fallback to Regex

If no OPENAI_API_KEY is configured, the app falls back to regex-based parsing. It extracts budget amounts, hourly rates, project types, and durations using pattern matching. Less smart, but works offline and is free.

src/lib/ai/fallback.ts
// Regex fallback when no OpenAI API key is set
function parseProjectWithRegex(input: string) {
  const budgetMatch = input.match(
    /\$([\d,]+(?:\.\d{2})?)|([\d]+)\s*k\b/i
  );
  const rateMatch = input.match(
    /\$([\d]+)\s*\/\s*(hr|hour)/i
  );
  const typeMatch = input.match(
    /\b(hourly|fixed|flat\s*fee|retainer)\b/i
  );
  const durationMatch = input.match(
    /(\d+)\s*(weeks?|months?|days?)/i
  );

  return {
    budget: budgetMatch ? parseBudget(budgetMatch) : null,
    hourlyRate: rateMatch ? parseFloat(rateMatch[1]) : null,
    type: typeMatch ? mapType(typeMatch[1]) : "FIXED",
    duration: durationMatch
      ? `${durationMatch[1]} ${durationMatch[2]}`
      : null,
  };
}

How it decides: The app checks for OPENAI_API_KEY at runtime. If present, AI features are enabled. If missing, regex fallback is used automatically with no configuration needed.

Configuration

To enable AI features, add your OpenAI API key to your environment:

.env.local
# .env.local
OPENAI_API_KEY="sk-..."

# Optional: specify model (defaults to gpt-4o-mini)
OPENAI_MODEL="gpt-4o-mini"

Related pages