Home Page
Polen can automatically generate a home page for your GraphQL developer portal.
Overview
The home page is structured as a series of sections that work together to get your users going on their projects effeciently.
Each section is configurable but with sensible defaults that are often driven by project conventions like the presence of key files. Polen maximizes automation without blocking you from escaping into a custom setup.
Hero Section
Overview
Purpose
Pique your users's interest and give a solid sense about what the API is for.
Elements
- Title
- Tagline
- Image
- Primary and secondary call-to-action buttons
- Schema statistics
Image
Polen offers multiple ways to add a hero image to your home page:
- Convention-based - Add your own image file
- AI-generated - Let Polen create one for you based on your GraphQL schema
Convention-Based (Manual)
Polen looks for a hero.<format>
file in public/
where <format>
is one of svg
, png
, jpg
, jpeg
, or webp
.
Dimensions:
- Recommended: 1200x400px (3:1 aspect ratio)
- The image will scale responsively on all screen sizes
AI-Generated
Polen can automatically generate contextually relevant hero images by analyzing your GraphQL schema and using Pollinations AI - a free, open-source AI image generation service.
Quick Start: CLI Generation
Generate a hero image instantly with one command:
# Generate with automatic schema analysis
px polen hero-image
# Specify a style
px polen hero-image --style futuristic
# Provide custom prompt
px polen hero-image --prompt "Abstract network of glowing connections"
# Generate multiple variations
px polen hero-image --variations 3
The CLI will:
- Analyze your GraphQL schema
- Detect your API domain (e-commerce, social, analytics, etc.)
- Generate an appropriate image
- Save it as
public/hero.png
Configuration-Based Generation
Enable AI generation in your polen.config.ts
as a smart fallback for when you don't have a custom hero image:
import { defineConfig } from 'polen/polen'
export default defineConfig({
home: {
hero: {
heroImage: {
src: '/hero.png', // Use your custom image if it exists
ai: {
enabled: true, // Automatically generate if src doesn't exist
},
},
},
},
})
This is the recommended default configuration - it will use your custom hero image when available, and automatically generate one when needed.
If you want to always use AI generation without checking for a manual image:
export default defineConfig({
home: {
hero: {
heroImage: {
ai: {
enabled: true,
},
},
},
},
})
Customize the AI generation with additional options:
export default defineConfig({
home: {
hero: {
heroImage: {
src: '/hero.png', // Optional: your custom image
ai: {
enabled: true,
style: 'modern', // see Art Styles below
prompt: 'Custom visualization of my API', // optional
width: 1200,
height: 400,
},
},
},
},
})
How It Works
Schema Analysis: Polen analyzes your GraphQL schema to understand:
- Main types and entities
- Query/mutation patterns
- Domain context (e-commerce, social, analytics, etc.)
Prompt Generation: Based on the analysis, Polen generates an appropriate prompt:
- E-commerce APIs → marketplace/shopping themes
- Social APIs → network/connection themes
- Analytics APIs → data visualization themes
- Gaming APIs → adventure/gaming themes
Image Generation: The prompt is sent to Pollinations for generation
Art Styles
Choose from various art styles:
modern
- Clean design with subtle gradients (default)minimalist
- Flat design with simple shapesabstract
- Artistic representationtechnical
- Blueprint style with grid patternsvibrant
- Bright colors and dynamic compositionprofessional
- Corporate stylefuturistic
- Sci-fi aesthetic with neon accentsgradient
- Smooth gradient meshgeometric
- Angular shapes and patterns
Examples
E-commerce API:
// Schema with Product, Cart, Order types
// Generates marketplace-themed imagery
{
ai: {
enabled: true,
style: 'vibrant'
}
}
Analytics Dashboard:
// Schema with Metric, Report, Dashboard types
// Generates data visualization imagery
{
ai: {
enabled: true,
style: 'technical'
}
}
Custom Creative:
{
ai: {
enabled: true,
prompt: 'Abstract network of glowing connections representing GraphQL queries',
style: 'futuristic'
}
}
Performance
- Images are generated asynchronously during page load
- A loading skeleton is shown while generating
Troubleshooting
Image Not Generating:
- Check that
ai.enabled
is set totrue
- Verify your internet connection (required for Pollinations API)
- Check browser console for error messages
Custom Prompt Not Working: Ensure your prompt is descriptive and includes:
- Visual elements (not just concepts)
- Style descriptors
- "no text" to avoid text in images
Quick Start Section
Overview
Purpose
Give your user's an understanding of how to build against your API in practice.
Examples
(todo: link to /examples)
Features Grid Section
todo