Documentation
Documentation
Everything you need to build with ZGNAL.AI — from quick start to API reference.
Quick Start
Get running in 4 steps
Clone, install, configure, and start generating infographics locally.
git clone https://github.com/Neens6655/zignal-infographic-lab.git cd zignal-infographic-lab
npm installcp .env.example .env.local # Add your Google API key GOOGLE_API_KEY=your_gemini_api_key_here
npm run dev # Open http://localhost:3000
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
| Variable | Required | Description |
|---|---|---|
GOOGLE_API_KEY | Yes | Gemini API key for text analysis and image generation |
NEXT_PUBLIC_SUPABASE_URL | No | Supabase project URL for auth and storage |
NEXT_PUBLIC_SUPABASE_ANON_KEY | No | Supabase anonymous key for client-side auth |
EXA_API_KEY | No | Exa API key for web search in research stage |
FIRECRAWL_API_KEY | No | Firecrawl key for deep content extraction |
Project Structure
Codebase layout
Key directories and files in the project.
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
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.
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)
Input Formats
Supported inputs
The pipeline accepts multiple content formats. All inputs are normalized to plain text before entering the analysis stages.
| Format | Endpoint | Details |
|---|---|---|
| Raw Text | POST /api/generate | Paste directly into the content field. Max 15,000 characters. |
| Web URL | POST /api/extract-url | Extracts article content via Cheerio. Strips nav, ads, boilerplate. |
| YouTube Video | POST /api/extract-video | Fetches transcript from YouTube/Vimeo/Loom URLs. |
| POST /api/extract-file | Parses text from PDF documents. Max 10MB. | |
| DOCX | POST /api/extract-file | Extracts text from Word documents. Max 10MB. |
| PPTX | POST /api/extract-file | Extracts slide text from PowerPoint files. Max 10MB. |
| TXT / MD / CSV / JSON | POST /api/extract-file | Plain text and structured formats. Max 10MB. |
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 ID | Category | Best For |
|---|---|---|
executive-institutional | Professional | Corporate reports, board decks |
bold-graphic | Creative | Social media, marketing materials |
deconstruct | Experimental | Art direction, editorial spreads |
neo-bauhaus | Geometric | Technical docs, architecture |
data-ink | Analytical | Data-heavy content, research |
swiss-minimal | Minimal | Clean presentations, summaries |
retro-terminal | Tech | Developer content, changelogs |
paper-craft | Organic | Education, storytelling |
blueprint | Technical | Engineering, specifications |
neon-dark | Bold | Gaming, entertainment, tech |
editorial-serif | Editorial | Long-form articles, essays |
gradient-mesh | Modern | Startup pitches, product launches |
isometric | 3D | Process flows, system architecture |
collage | Mixed media | Creative briefs, mood boards |
watercolor | Artistic | Lifestyle, wellness, culture |
pixel-grid | Retro | Gaming, nostalgia, tech history |
monochrome | Minimal | Professional, elegant, timeless |
pop-art | Bold | Marketing, social media, campaigns |
line-art | Illustrative | Explainers, tutorials, guides |
glassmorphism | Modern | SaaS, apps, product features |
Layouts
| Layout ID | Category | Best For |
|---|---|---|
bento-grid | Grid | Multi-section content, dashboards |
hub-spoke | Radial | Central concept with branches |
dashboard | Grid | KPIs, metrics, data summaries |
timeline | Linear | Chronological events, history |
comparison | Split | Versus, pros/cons, before/after |
pyramid | Hierarchy | Priority levels, funnels |
flowchart | Process | Step-by-step workflows |
magazine | Editorial | Article summaries, digests |
cards | Grid | Feature lists, team bios |
kanban | Columns | Status boards, categorization |
mind-map | Radial | Brainstorms, topic exploration |
split-screen | Binary | Two-sided arguments, A/B |
hero-stack | Vertical | Single narrative, storytelling |
quadrant | Matrix | 2x2 frameworks, positioning |
accordion | Vertical | FAQ, expandable sections |
mosaic | Irregular | Photo-heavy, visual stories |
sidebar | Asymmetric | Main content + supporting data |
circular | Radial | Cycles, recurring processes |
waterfall | Cascading | Sequential dependencies |
infographic-strip | Vertical | Social media stories, scrolling |
Export Formats
Download & share
Every generated infographic can be exported in four formats. Share directly to X, LinkedIn, or WhatsApp from the result viewer.
| Format | Type | Use Case |
|---|---|---|
| PNG | Lossless | Social media, presentations, highest quality |
| JPEG | Compressed | Web, email, smaller file size |
| Document | Print, reports, archival | |
| PPTX | Editable | PowerPoint decks, further editing |
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.
# 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.
# 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
Contributing
How to contribute
Workflow
# 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
anytypes - 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/reactfor animations
Adding a New Style
# 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
# Run before opening a PR npm run lint # ESLint npm run build # TypeScript + Next.js build
Deployment
Ship to production
Recommended deployment target is Vercel. Push to GitHub and it auto-deploys.
Vercel Deployment
# 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
https://zgnal.aiNeed help? Open an issue on GitHub or reach out to the maintainers.