chaidocs
AI Pitch Deck

Chapters

Suraj Kumar Jha 10 pages 2 min read Updated Sep 7, 2026
On this page
  1. AI Pitch Deck Builder Overview
  2. High-Level System Architecture
  3. Project Setup & Environment Secrets
  4. Database Schema with Prisma
  5. Structuring Output with Zod
  6. AI Agent & Two-Way Guardrails
  7. Slide Imagery via ImageKit CDN
  8. Background Orchestration with Inngest
  9. Clean & Fast API Routes
  10. Frontend Polling & Slide Carousel

AI Pitch Deck Builder Overview

01 A founder typing an idea on a laptop screen that magically expands into an organized row of visual presentation slides.
Notes
Turn a raw business idea into a ready-to-pitch presentation deck in seconds. Got an idea for a 'Blinkit for fresh filter coffee'? Just enter the prompt. AI crafts the narrative, generates custom slide graphics, and saves everything. The result is delivered as an interactive, swipeable deck ready for Shark Tank.

High-Level System Architecture

02 End-to-end flowchart from Browser to Next.js API, branching to Inngest background queue, OpenAI, ImageKit CDN, and Neon Postgres.
Notes
User submits a startup prompt via a Next.js App Router frontend. Lightweight API route creates a pending record and triggers a background event. Inngest orchestrates OpenAI agents to write content and create slide images. Images are hosted on ImageKit, deck data is saved in Postgres, and UI polls for completion.

Project Setup & Environment Secrets

03 A terminal running 'pnpm dev' positioned beside a locked digital vault representing local environment variables.
Notes
Modern Next.js 16 bootstrap using pnpm, TypeScript, Tailwind CSS, and shadcn/ui. Database powered by Neon Postgres with Prisma ORM for type-safe queries. Keep API keys for OpenAI, ImageKit, and Inngest strictly inside `.env`. Treat your `.env` secrets like your UPI PIN—never push them to public GitHub!

Database Schema with Prisma

04 Database schema diagram showing a 1-to-many relationship between a master 'Deck' table and child 'Slide' items with status indicators.
Notes
Parent-child data model: One Deck row connects to multiple Slide rows. Deck tracks startup idea, title, and lifecycle: PENDING → GENERATING → COMPLETE or FAILED. Slide stores order index, slide title, bullet points, and ImageKit CDN URL. Prisma migrations manage schema updates effortlessly on Neon serverless Postgres.

Structuring Output with Zod

05 A digital stencil filtering erratic AI text into neatly shaped, structured JSON blocks labeled title, content, and imagePrompt.
Notes
Raw AI prompts can produce unpredictable, messy text that breaks frontends. Zod schema acts like a strict blueprint, forcing AI to return structured JSON. Enforces exactly 5 to 8 slides, each containing a title, bullet points, and image prompt. Guarantees that frontend components always receive clean, predictable data.

AI Agent & Two-Way Guardrails

06 Two shield icons flanking an AI brain: Shield 1 blocks short user inputs, Shield 2 reviews slides before approving the final output.
Notes
Input Guardrail: Discards vague prompts (like typing just 'hi') before wasting API tokens. Prompts must be at least 20 characters describing a realistic startup concept. Pitch Deck Agent: Generates slide headlines and arguments matching the Zod schema. Output Guardrail: An automated quality-checker agent inspects slides before saving.

Slide Imagery via ImageKit CDN

07 An AI illustration prompt converting into a clean graphic, uploading to an ImageKit cloud icon, and returning a fast HTTPS link.
Notes
Each slide receives a tailored image prompt generated by the AI agent. OpenAI creates clean business illustrations matching the startup's theme. Generated image buffers upload directly to ImageKit CDN in a dedicated folder. Dev tip: Toggle placeholder images locally to test UI without spending API credits.

Background Orchestration with Inngest

08 A step-by-step horizontal progress tracker with checkmarks moving from 'load-deck' to 'run-agent', 'generate-images', and 'mark-complete'.
Notes
Generating 6+ slides with high-res artwork takes 30+ seconds—too long for a standard API call. Inngest handles the entire workflow asynchronously step-by-step in the background. Breaks generation into atomic steps: load deck, run agent, create images, and save records. Provides automatic retries: if one slide image fails, the whole deck does not crash.

Clean & Fast API Routes

09 A user hitting an API endpoint and immediately receiving a 201 Created ticket while a background worker picks up the job.
Notes
API routes stay thin and fast because heavy AI generation runs in the background. POST /api/decks validates input length, saves a PENDING deck, and emits an Inngest event. Instantly responds with HTTP 201 so the user interface never freezes. GET /api/decks/[id] returns the latest status, error messages, and completed slides.