Skip to content

[Backend] Structured Groq cover letter analysis with response caching #16

@Gbangbolaoluwagbemiga

Description

@Gbangbolaoluwagbemiga

Context

Every analysis call hits Groq fresh with no caching — repeated requests for the same cover letter re-run inference.

What needs to be done

  1. Structured output — return typed JSON:
    ```ts
    interface CoverLetterAnalysis {
    relevance_score: number; // 0-100
    communication_clarity: number; // 0-100
    timeline_feasibility: number; // 0-100
    red_flags: string[];
    summary: string; // ≤ 100 words
    }
    ```
    Use Groq's `response_format: { type: 'json_object' }`.

  2. Cache in Supabase — SHA-256(cover_letter + job_id) → store result, expire after 24h

  3. Graceful degradation — if Groq down, return partial response, not 500

Acceptance criteria

  • Typed JSON response matching interface
  • Cache hit on identical input (verifiable in logs)
  • Supabase migration for `cover_letter_cache` table

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendNode.js / Express / Supabase workenhancementNew feature or improvementperformanceSpeed or gas/cost optimization

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions