Skip to main content

Documentation

Documentation

Everything you need to build with ZGNAL.AI — from quick start to API reference.

Sentinel
Oracle
Architect
Compliance
Assembler
Renderer
Provenance

Quick Start

Get running in 4 steps

Clone, install, configure, and start generating infographics locally.

1Clone the repository
bash
git clone https://github.com/Neens6655/zignal-infographic-lab.git
cd zignal-infographic-lab
2Install dependencies
bash
npm install
3Set up environment
bash
cp .env.example .env.local
# Add your Google API key
GOOGLE_API_KEY=your_gemini_api_key_here
4Start development
bash
npm run dev
# Open http://localhost:3000
Edit “Quick Start” on GitHub

Installation

Prerequisites & Environment

Requirements and environment variable configuration.

Prerequisites

  • Node.js 18+ — Required runtime
  • npm or bun — Package manager
  • Google API Key — For Gemini text + image generation

Environment Variables

VariableRequiredDescription
GOOGLE_API_KEYYesGemini API key for text analysis and image generation
NEXT_PUBLIC_SUPABASE_URLNoSupabase project URL for auth and storage
NEXT_PUBLIC_SUPABASE_ANON_KEYNoSupabase anonymous key for client-side auth
EXA_API_KEYNoExa API key for web search in research stage
FIRECRAWL_API_KEYNoFirecrawl key for deep content extraction
Edit “Installation” on GitHub

Project Structure

Codebase layout

Key directories and files in the project.

bashFile tree
src/
  app/
    page.tsx                    # Landing page + generator
    chat/                       # Conversational interface
    dashboard/                  # User history
    (pages)/                    # Info pages (about, docs, pricing)
    api/
      generate/route.ts         # POST - main generation (SSE)
      improve-prompt/route.ts   # POST - enhance brief
      extract-file/route.ts     # POST - PDF/DOCX parsing
      extract-url/route.ts      # POST - web scraping
      extract-video/route.ts    # POST - YouTube transcripts
      catalog/route.ts          # GET  - presets/layouts/styles
      jobs/[id]/route.ts        # GET  - poll job status
      jobs/[id]/stream/route.ts # GET  - SSE progress stream
  components/
    generator/                  # ContentInput, OptionsPanel, ResultViewer
    chat/                       # Chat interface components
    ui/                         # Radix-based primitives (Button, Card, etc.)
  hooks/
    use-generate.ts             # Generation state machine
    use-chat.ts                 # Chat management
  lib/
    pipeline.ts                 # 7-stage Gemini pipeline (THE CORE)
    engine.ts                   # API client
    constants.ts                # Presets, ratios, limits
    references/                 # 41 prompt reference files
      base-prompt.md            # Text rendering rules (DO NOT MODIFY)
      layouts/                  # 20 layout definitions
      styles/                   # 20 style definitions
Edit “Project Structure” on GitHub

Pipeline Architecture

Seven stages. One pipeline.

Each generation passes through seven sequential stages. Click any node to see the function name, model used, and input/output types.

All stages run inline on Vercel serverless functions. The full pipeline source is in src/lib/pipeline.ts.

Edit “Pipeline Architecture” on GitHub

API Reference

Endpoints

All API routes are Next.js Route Handlers. The main generation endpoint streams SSE events; all others return JSON.

Base URL: https://zgnal.ai (production) or http://localhost:3000 (development)

Edit “API Reference” on GitHub

Input Formats

Supported inputs

The pipeline accepts multiple content formats. All inputs are normalized to plain text before entering the analysis stages.

FormatEndpointDetails
Raw TextPOST /api/generatePaste directly into the content field. Max 15,000 characters.
Web URLPOST /api/extract-urlExtracts article content via Cheerio. Strips nav, ads, boilerplate.
YouTube VideoPOST /api/extract-videoFetches transcript from YouTube/Vimeo/Loom URLs.
PDFPOST /api/extract-fileParses text from PDF documents. Max 10MB.
DOCXPOST /api/extract-fileExtracts text from Word documents. Max 10MB.
PPTXPOST /api/extract-fileExtracts slide text from PowerPoint files. Max 10MB.
TXT / MD / CSV / JSONPOST /api/extract-filePlain text and structured formats. Max 10MB.
Edit “Input Formats” on GitHub

Styles & Layouts

20 styles x 20 layouts

400+ unique combinations. Set preset: "auto" to let the pipeline choose the best pairing for your content, or specify both explicitly.

See the visual gallery for previews of each style.

Styles

Style IDCategoryBest For
executive-institutionalProfessionalCorporate reports, board decks
bold-graphicCreativeSocial media, marketing materials
deconstructExperimentalArt direction, editorial spreads
neo-bauhausGeometricTechnical docs, architecture
data-inkAnalyticalData-heavy content, research
swiss-minimalMinimalClean presentations, summaries
retro-terminalTechDeveloper content, changelogs
paper-craftOrganicEducation, storytelling
blueprintTechnicalEngineering, specifications
neon-darkBoldGaming, entertainment, tech
editorial-serifEditorialLong-form articles, essays
gradient-meshModernStartup pitches, product launches
isometric3DProcess flows, system architecture
collageMixed mediaCreative briefs, mood boards
watercolorArtisticLifestyle, wellness, culture
pixel-gridRetroGaming, nostalgia, tech history
monochromeMinimalProfessional, elegant, timeless
pop-artBoldMarketing, social media, campaigns
line-artIllustrativeExplainers, tutorials, guides
glassmorphismModernSaaS, apps, product features

Layouts

Layout IDCategoryBest For
bento-gridGridMulti-section content, dashboards
hub-spokeRadialCentral concept with branches
dashboardGridKPIs, metrics, data summaries
timelineLinearChronological events, history
comparisonSplitVersus, pros/cons, before/after
pyramidHierarchyPriority levels, funnels
flowchartProcessStep-by-step workflows
magazineEditorialArticle summaries, digests
cardsGridFeature lists, team bios
kanbanColumnsStatus boards, categorization
mind-mapRadialBrainstorms, topic exploration
split-screenBinaryTwo-sided arguments, A/B
hero-stackVerticalSingle narrative, storytelling
quadrantMatrix2x2 frameworks, positioning
accordionVerticalFAQ, expandable sections
mosaicIrregularPhoto-heavy, visual stories
sidebarAsymmetricMain content + supporting data
circularRadialCycles, recurring processes
waterfallCascadingSequential dependencies
infographic-stripVerticalSocial media stories, scrolling
Edit “Styles & Layouts” on GitHub

Export Formats

Download & share

Every generated infographic can be exported in four formats. Share directly to X, LinkedIn, or WhatsApp from the result viewer.

FormatTypeUse Case
PNGLosslessSocial media, presentations, highest quality
JPEGCompressedWeb, email, smaller file size
PDFDocumentPrint, reports, archival
PPTXEditablePowerPoint decks, further editing
Edit “Export Formats” on GitHub

Configuration

Project configuration

next.config.ts

Security headers and Content Security Policy are configured in the Next.js config. Image domains are whitelisted for Supabase and external sources.

bash
# Key settings in next.config.ts
# - Security headers (X-Frame-Options, CSP, etc.)
# - Image optimization domains
# - Serverless function timeout (60s for generation)
# - Output: standalone (for Docker) or default (Vercel)

Tailwind CSS v4

This project uses Tailwind CSS v4 with CSS-first configuration. Design tokens are defined in globals.css using @theme {}, not a JavaScript config file.

bash
# globals.css — design tokens
# @theme {
#   --color-gold: #D4A84B;
#   --color-bg: #0A0A0B;
#   --color-surface: #111113;
#   --font-mono: 'IBM Plex Mono', monospace;
#   --font-sans: 'IBM Plex Sans', sans-serif;
# }

Fonts

Two fonts loaded from Google Fonts via next/font/google:

  • IBM Plex Mono — Headings, labels, code, navigation
  • IBM Plex Sans — Body text, descriptions, paragraphs
Edit “Configuration” on GitHub

Contributing

How to contribute

Workflow

bash
# 1. Fork the repository on GitHub
# 2. Clone your fork
git clone https://github.com/YOUR_USERNAME/zignal-infographic-lab.git

# 3. Create a feature branch
git checkout -b feature/your-feature-name

# 4. Make changes and commit
git add .
git commit -m "feat: describe your change"

# 5. Push and open a Pull Request
git push origin feature/your-feature-name
# Open PR at https://github.com/Neens6655/zignal-infographic-lab/pulls

Code Conventions

  • TypeScript strict mode everywhere — no any types
  • Tailwind CSS v4 with CSS-first config — no tailwind.config.js
  • Server Components by default, "use client" only when necessary
  • No barrel imports — import directly from the source file
  • Framer Motion via motion/react for animations

Adding a New Style

bash
# 1. Create the style reference file
# src/lib/references/styles/your-style-name.md

# 2. Follow the structure of existing style files:
#    - Color palette (primary, secondary, accent, bg, text)
#    - Typography specs (heading, body, caption fonts + sizes)
#    - Composition rules (spacing, alignment, density)
#    - Example visual description

# 3. Register in constants
# Add to STYLES array in src/lib/constants.ts

# 4. Test generation with the new style
npm run dev
# Generate an infographic with style: "your-style-name"

Adding a New Layout

Same process as styles: create src/lib/references/layouts/your-layout.md, register in constants.ts, test generation.

Quality Checks

bash
# Run before opening a PR
npm run lint          # ESLint
npm run build         # TypeScript + Next.js build
Edit “Contributing” on GitHub

Deployment

Ship to production

Recommended deployment target is Vercel. Push to GitHub and it auto-deploys.

Vercel Deployment

bash
# 1. Connect GitHub repo to Vercel
# 2. Set environment variables in Vercel dashboard:
#    GOOGLE_API_KEY (required)
#    NEXT_PUBLIC_SUPABASE_URL (optional)
#    NEXT_PUBLIC_SUPABASE_ANON_KEY (optional)

# 3. Push to deploy
npm run build         # Verify build passes locally
git push origin main  # Triggers auto-deploy on Vercel

Post-Deploy Checklist

1Verify the live URL loads: https://zgnal.ai
2Test one generation end-to-end on production
3Check Vercel function logs for runtime errors
4Verify all environment variables are set in Vercel dashboard
5No console errors on page load (check browser DevTools)

Need help? Open an issue on GitHub or reach out to the maintainers.

Edit “Deployment” on GitHub