DEV Community

Cover image for GroqTales: Building an AI‑Native Storytelling Engine on Monad (and Why I Need Your Help)
Mantej Singh
Mantej Singh

Posted on

GroqTales: Building an AI‑Native Storytelling Engine on Monad (and Why I Need Your Help)

You think “Write a noir heist set in a neon Delhi, mint it on‑chain, split royalties with my co‑writer, and don’t make me touch a smart contract.”
That’s the experience we’re trying to build with GroqTales.

Most NFT projects treated lore as marketing copy. The PFPs got all the liquidity; the writers got a Notion doc and a “thanks fam”.

So we asked: what if the **story* was the first‑class asset?*

And what if AI + on‑chain rails made it fast to create, fair to share, and transparent to curate?

This post is the story of how we’re building that — and where you can plug in as a contributor.


TL;DR – What is GroqTales?

GroqTales is an AI‑powered, on‑chain storytelling platform:

  • You describe a story (or go full control‑freak with an advanced “Pro Panel” of ~70 knobs).
  • Groq models generate a structured screenplay‑like narrative in seconds.
  • We pair it with AI‑generated visuals to feel like a comic / graphic novel.
  • You mint it as an NFT on Monad, with collaborators and royalty splits encoded in the CollabStory Protocol.

Try the current build here:

👉 Live site: groqtales.xyz

👉 Repo: IndieHub25/GroqTales

👉 Contributors page: Top contributors

From here on, I’m going to walk you through the tech, not the hype.


The Pro Panel: an AI “Story Engine”, not just a text box

The obvious implementation would be a single prompt field and a “Generate” button.

We didn’t do that.

Instead, we built a Pro Panel UI that turns story generation into a structured system:

  • 9 logical categories (Story Structure, Characters, World, Tone & Style, Theme, Model Settings, Visual, Length, Advanced).
  • ~70 parameters persisted in a Zustand store with localStorage.
  • A grid of genre cards (Fantasy, Noir, Cyberpunk, Romance, etc.) that act more like story presets than mere labels.
  • A dossier‑style layout with animated “page turns” so power‑users don’t drown in sliders.

Rough shape of the state:

// src/store/proPanelStore.ts
type ProParameters = {
  storyStructure: { /* plot arcs, pacing, act structure, resolution… */ };
  characters: { /* archetypes, POV, ensemble vs solo… */ };
  world: { /* era, tech level, magic system toggles, location presets… */ };
  toneStyle: { /* humor vs grim, sentence cadence, narrative voice… */ };
  theme: { /* core moral questions, genre blends… */ };
  modelSettings: {
    modelSelection: string;
    temperature: number;
    maxTokens: number;
    topP: number;
    topK: number;
    frequencyPenalty: number;
    presencePenalty: number;
    repetitionPenalty: number;
    stopSequences: string[];
  };
  visual: { /* prompts for panels, camera angles, mood boards… */ };
  length: { /* reading time, beats per act, chapter count… */ };
  advanced: { /* safety rails, structural constraints, output schema… */ };
};
Enter fullscreen mode Exit fullscreen mode

On top of this we built:

  • Presets (built‑in and user‑defined) that snapshot the entire parameter tree.
  • Import / export flows using JSON (so you can share a “Cyberpunk Heist” config in Discord).
  • Validation using Zod schemas to keep the Groq API calls sane.
  • Accessible controls (labels, keyboard nav, aria semantics) so this isn’t just “pretty sliders”.

The Pro Panel isn’t “UX sugar” — it’s our contract for generating consistent, remixable stories.


The AI Stack: talking to Groq like an engine, not a toy

Under the hood, the Pro Panel drives a backend service that:

  1. Receives { prompt, title, proConfig } at /api/groq.
  2. Validates proConfig against strict Zod schemas.
  3. Compiles a system prompt that encodes:
    • The genre & tone.
    • Scene structure and beats.
    • Character arcs and constraints.
    • Safety requirements (no jailbreaking your way into garbage).
  4. Calls the Groq chat completions endpoint with hardened settings.
  5. Runs output checks before we accept the story.

Conceptually:

// lib/groq-service.ts
export async function generateStoryWithProConfig(
  prompt: string,
  proConfig: ProParameters,
  options: { title?: string }
) {
  const { sanitizedPrompt, title } = sanitizeAndValidate(prompt, options.title);

  const systemPrompt = buildProPanelSystemPrompt(proConfig, title);
  const userPrompt = buildUserPrompt(sanitizedPrompt, proConfig);

  const requestBody = {
    model: proConfig.modelSettings.modelSelection,
    messages: [
      { role: 'system', content: systemPrompt },
      { role: 'user', content: userPrompt },
    ],
    temperature: proConfig.modelSettings.temperature,
    max_tokens: proConfig.modelSettings.maxTokens,
    // top_p, top_k, etc…
  };

  const response = await fetch('https://api.groq.com/openai/v1/chat/completions', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.GROQ_API_KEY!}`,
      'Content-Type': 'application/json',
    },
    signal: AbortSignal.timeout(15_000), // don’t hang forever
    body: JSON.stringify(requestBody),
  });

  const data = await response.json();
  const story = extractAndValidateStory(data);

  return story;
}
Enter fullscreen mode Exit fullscreen mode

The frontend never deals with raw “AI spaghetti”. It gets back structured story data that downstream components (comic renderer, NFT minter, etc.) can rely on.


On‑chain: Monad + CollabStory Protocol

The second pillar: a story is an NFT, not a random JSON blob on some server.

We’re integrating Monad as the base chain for story minting. Design goals:

  • 1 story = 1 NFT.
  • Each NFT references:
    • A story content hash (text + metadata).
    • A visual bundle hash (art panels).
    • A list of contributors with weights (writer, editor, artist, prompt engineer…).
  • Royalties are split automatically based on those weights.

At a high level, the CollabStory Protocol spec looks like:

// Pseudocode-ish
struct ContributorShare {
  address contributor;
  uint96 bps; // basis points, sum must = 10_000
}

struct StoryMetadata {
  bytes32 storyHash;   // keccak256 of canonical story JSON
  bytes32 artHash;     // keccak256 of panel assets bundle
  string  genre;
  string  title;
}

function mintStory(
  StoryMetadata metadata,
  ContributorShare[] memory shares
) external returns (uint256 tokenId);
Enter fullscreen mode Exit fullscreen mode

On the AI side, we’re responsible for:

  • Producing a canonical JSON representation of the story (no “oops we changed a field, hash doesn’t match”).
  • Verifying that the set of contributors and shares is valid before hitting the chain.
  • Exposing a UX where non‑crypto‑native writers don’t have to think about any of this.

If you’re into smart contracts, royalty standards, or Monad tooling, there’s a lot of low‑level surface here to help design and implement.


Curation: AIgent Curators instead of black‑box feeds

Ranking content is where most creator platforms quietly betray their users.

We want to experiment with AI‑powered curators whose decisions are:

  • Transparent (inputs + scoring dimensions are inspectable).
  • Logged on‑chain (or at least hash‑committed).
  • Tunable per community (e.g., “give me weird experimental horror” vs “keep it PG‑13 fantasy”).

Early idea for a curator agent:

  • Ingest story metadata + text + engagement stats.
  • Compute scores along dimensions:
    • Originality (novelty vs training‑corpus‑like).
    • Genre fit (does this actually feel like “Noir Heist” or just generic copypasta?).
    • Structural coherence (beats, arcs, resolution).
    • Community signals (likes, completions, forks/remixes).
  • Emit a ranking + explanation.

This is still mostly design + plumbing territory — perfect for contributors who enjoy ML evaluation, ranking systems, or on‑chain indexing.


Developer Experience: how it all fits together

High‑level architecture as it stands:

  • Frontend

    • Next.js App Router.
    • Shadcn UI + a custom noir/comic theme.
    • Pro Panel + Story Input as client components backed by Zustand.
    • Accessibility passes (labels, aria, focus states) guided by automated review.
  • Backend

    • Route handlers under /app/api/*:
    • /api/groq for story generation with Pro Panel config.
    • (Planned) /api/story endpoints for persistence, remixing, and publishing.
    • lib/groq-service.ts acting as the AI “engine” layer.
    • Supabase client for user/session‑adjacent data.
  • Infra / Tooling

    • Type‑safe schemas with Zod.
    • Tailwind config extended for noir/comic visuals.
    • CodeRabbit driving automated review suggestions (a11y, security, timeouts).
    • Open‑source friendly defaults (no secrets in repo, env‑driven config).

You can browse the code and open issues here:

👉 GroqTales GitHub repo


Where I need help (a.k.a. why I’m posting this on DEV)

This is open source by design. I don’t want this to become “yet another closed AI content farm”.

If any of these sound like your thing, you can make a real dent:

  1. AI / Prompt Engineering

    • Help evolve the Pro Panel schemas.
    • Design better system prompts for genre‑specific outputs.
    • Build evaluators to detect low‑quality or derivative stories.
  2. Smart Contracts / Monad

    • Formalize and implement the CollabStory Protocol.
    • Explore meta‑transactions / gasless flows for non‑crypto writers.
    • Help design NFT metadata for richly linked stories + panels.
  3. Frontend / UX

    • Polish the Pro Panel (performance, keyboard flow, mobile layout).
    • Build a reader experience that feels like turning comic pages, not scrolling a blog.
    • Improve accessibility beyond “bare minimum passes”.
  4. DevEx / Tooling

    • CI pipelines, linting, and automated tests for the AI and contract layers.
    • Better presets import/export flows.
    • Docs and examples (e.g., “build your own curator agent on top of GroqTales data”).

How to get involved

  1. Explore the platform

    Open groqtales.xyz and poke around the Pro Panel. Break it. See where it feels clunky or magical.

  2. Star & watch the repo

    Stars genuinely help surface the project to other builders:

    👉 Star IndieHub25/GroqTales

  3. Pick an issue and ship a PR

    • Check the issues board in the repo (we’re tagging good first issues, UI/UX, AI, and Web3 tasks).
    • Comment that you’re taking something so we don’t collide.
    • Open a focused PR with a clear description and testing notes — we’re using templates and automated review to keep quality high.
  4. Propose experiments

    Want to try a new model, a different chain, or a wild curator idea? Open a discussion or issue. This is meant to be a playground, not a walled garden.


If you’ve ever looked at an NFT drop and thought, “the art is cool but the story deserved better” — GroqTales is my attempt to fix that.

Writers, prompt‑engineers, and devs shouldn’t be NPCs in the creator economy.

They should be main characters with on‑chain receipts.

If that resonates, come build with us. 🔧📚

Top comments (0)