Groq JSON Client

By (author)Mutashim Mohsin

Tech stack:
JS
Next.js
Node.js

Server-side Groq API helper that transforms raw client text into structured JSON. It enforces strict schemas grounds requirements in source text and f...
read more
AI Contributions:3
Published At:August 12, 2026
Files Included:1 file(s)
Updated At:October 23, 2026

Read Me

Groq JSON Client

Server-side helper for calling the Groq API and enforcing structured JSON responses. Powers ScopeFlow's project analysis: a raw client message in, a validated analysis object out.

Usage

import { analyzeProjectFromClientMessage } from "../code-gigs/groq-json-client";

const analysis = await analyzeProjectFromClientMessage("Build an app for...");

Returns an analysis object with:

{
  summary: "string",
  objectives: ["string"],
  targetUsers: ["string"],
  requirements: [
    {
      id: "string",
      title: "string",
      description: "string",
      category: "string",
      priority: "MUST_HAVE" | "SHOULD_HAVE" | "COULD_HAVE",
      confidence: "HIGH" | "MEDIUM",
      sourceText: "string",
    },
  ],
  ambiguities: ["string"],
  risks: ["string"],
  assumptions: ["string"],
  dependencies: ["string"],
}

Features

  • Strict JSON-only prompt at temperature: 0.2 (deterministic, low-hallucination).
  • Strips markdown fences and validates the parsed JSON.
  • Automatically retries once with a stricter prompt if the first response is invalid.
  • Grounds each requirement in a sourceText excerpt from the client message.

Environment variables

GROQ_API_KEY=your_groq_api_key
GROQ_MODEL=llama-3.3-70b-versatile   # optional, has a default

Requirements

  • groq-sdk
  • Server-only. This module reads GROQ_API_KEY and must never be imported from client components. Use it in Next.js Route Handlers or Server Actions.

Loading

Loading

Loading

More like this View all

Supabase Client

A lightweight, reusable Supabase client utility. Features a lazy singleton pattern for database access and includes custom error formatting to detect missing database schemas.

  • 0

    Ratings

  • 1

    Files

    • JS
    • TS
    • +3

    Tech stack

Gemini AI Agent Backend

A minimal Node.js backend foundation for building an AI agent with Google Gemini. Includes a CLI interface, Gemini service integration, environment-based API key configuration, and prompt handling.

  • 0

    Ratings

  • 6

    Files

    • JS
    • Node.js
    • +1

    Tech stack

Roman Urdu Order Parser: Text, Screenshot, Voice

Turn WhatsApp/Instagram order chats, chat screenshots and voice notes (English, Roman Urdu or mixed) into validated order JSON with per-field confidence. Gemini + zod, retries, fallback.

  • 0

    Ratings

  • 5

    Files

    • TS
    • Next.js
    • +2

    Tech stack