Go to file
Jeff Emmett 1aec028c52 feat: switch to RunPod proxy for Gemini image generation
- Use RunPod serverless endpoint (US-based) to bypass EU geo-restrictions
- Add RUNPOD_API_KEY and RUNPOD_GEMINI_ENDPOINT_ID env vars
- Add fallback to direct Gemini API if RunPod not configured
- Endpoint ID: ntqjz8cdsth42i

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 22:10:13 -05:00
.github/workflows ci: add GitHub Action to build and push Gemini proxy image 2025-12-18 21:39:26 -05:00
backlog chore: initialize backlog for task tracking 2025-12-15 18:46:57 -05:00
examples feat: add prompt-to-print web app at zine.jeffemmett.com 2025-12-18 17:55:39 -05:00
runpod-proxy feat: add RunPod serverless proxy for Gemini API 2025-12-18 21:33:33 -05:00
src feat: add timestamped filenames and --name flag for print layouts 2025-12-15 19:16:46 -05:00
web feat: switch to RunPod proxy for Gemini image generation 2025-12-18 22:10:13 -05:00
worker feat: add progress bar UI and styled placeholder images 2025-12-18 21:09:25 -05:00
.gitignore feat: add prompt-to-print web app at zine.jeffemmett.com 2025-12-18 17:55:39 -05:00
Dockerfile feat: add prompt-to-print web app at zine.jeffemmett.com 2025-12-18 17:55:39 -05:00
README.md feat: add prompt-to-print web app at zine.jeffemmett.com 2025-12-18 17:55:39 -05:00
docker-compose.yml feat: switch to RunPod proxy for Gemini image generation 2025-12-18 22:10:13 -05:00
package-lock.json feat: add QR code generator for zine CTAs 2025-12-15 19:11:38 -05:00
package.json feat: add prompt-to-print web app at zine.jeffemmett.com 2025-12-18 17:55:39 -05:00

README.md

MycroZine

A toolkit for creating print-ready mycro-zines - 8-page mini folded zines that fit on a single 8.5" x 11" sheet.

What is a MycroZine?

A mycro-zine is a tiny, foldable magazine made from a single sheet of paper. When folded correctly, it creates an 8-page booklet perfect for:

  • Punk zines and manifestos
  • Educational mini-guides
  • Event programs
  • DIY instructions
  • Art projects

Features

  • Single-page print layout: All 8 pages arranged on one 8.5" x 11" sheet (2 cols x 4 rows)
  • High-resolution output: 300 DPI for crisp printing
  • Prompt templates: Ready-to-use prompts for AI content/image generation
  • Multiple styles: punk-zine, minimal, collage, retro, academic
  • US Letter & A4 support: Works with common paper sizes

Installation

npm install

Usage

CLI - Create Print Layout

# Using example pages
npm run example

# Or specify your own 8 pages
node src/layout.mjs page1.png page2.png page3.png page4.png page5.png page6.png page7.png page8.png

# With custom output path
node src/layout.mjs page1.png ... page8.png --output my_zine_print.png

Programmatic API

import { createPrintLayout } from 'mycro-zine';

// Create print-ready layout from 8 page images
await createPrintLayout({
  pages: [
    'page1.png', 'page2.png', 'page3.png', 'page4.png',
    'page5.png', 'page6.png', 'page7.png', 'page8.png'
  ],
  outputPath: 'my_zine_print.png',
  background: '#ffffff'
});

Prompt Templates (for AI generation)

import { getContentOutlinePrompt, getImagePrompt, STYLES, TONES } from 'mycro-zine/prompts';

// Generate content outline prompt
const outlinePrompt = getContentOutlinePrompt({
  topic: 'The Undernet',
  style: 'punk-zine',
  tone: 'rebellious',
  sourceContent: 'Reference text here...'
});

// Generate image prompt for a page
const imagePrompt = getImagePrompt({
  pageNumber: 1,
  zineTopic: 'The Undernet',
  pageOutline: {
    title: 'THE UNDERNET',
    keyPoints: ['Own your data', 'Run local servers'],
    hashtags: ['#DataSovereignty', '#Mycopunk'],
    imagePrompt: 'Bold cover with mycelial network imagery...'
  },
  style: 'punk-zine'
});

Print Layout

The output is a single PNG image arranged for traditional mini-zine folding:

┌──────────┬──────────┬──────────┬──────────┐
│    1↺    │    8↺    │    7↺    │    6↺    │  Top row (upside down)
│  (cover) │  (cta)   │          │          │
├──────────┼──────────┼──────────┼──────────┤
│    2     │    3     │    4     │    5     │  Bottom row (right side up)
│          │          │          │          │
└──────────┴──────────┴──────────┴──────────┘

Paper: 11" x 8.5" landscape (US Letter rotated)
Panel size: 7cm x 10.8cm (~2.76" x 4.25")
Total: 3300 x 2550 pixels at 300 DPI

Folding Instructions

After printing, fold your zine:

  1. Fold in half along the long edge (hotdog fold) - brings top row to bottom
  2. Fold in half again along the short edge
  3. Fold once more to create a small booklet shape
  4. Unfold completely and lay flat
  5. Cut the center slit - cut along the middle crease between pages 3-6 and 4-5
  6. Refold and push - fold hotdog style, then push the ends together so the cut opens into a booklet
  7. Flatten - pages should now be in order 1→2→3→4→5→6→7→8

Examples

See the examples/undernet/ directory for a complete 8-page zine about The Undernet project.

Styles

Style Description
punk-zine Xerox texture, high contrast B&W, DIY collage, hand-drawn typography
minimal Clean lines, white space, modern sans-serif, subtle gradients
collage Layered imagery, mixed media textures, vintage photographs
retro 1970s aesthetic, earth tones, groovy typography, halftone patterns
academic Diagram-heavy, annotated illustrations, infographic elements

Web App

MycroZine includes a full web application at zine.jeffemmett.com that allows anyone to create zines through a browser interface.

Features

  • Text or voice input - Describe your zine concept naturally
  • AI-powered generation - Gemini generates outlines and page images
  • Interactive refinement - Adjust any page with feedback
  • Shareable links - Share your zine with a unique URL
  • Print-ready download - 300 DPI PNG for home printing

Local Development

# Install web dependencies
npm run web:install

# Create .env.local in web/ directory
cp web/.env.example web/.env.local
# Edit web/.env.local and add your GEMINI_API_KEY

# Start development server
npm run web:dev

Visit http://localhost:3000 to use the app locally.

Docker Deployment

# Build and start the container
GEMINI_API_KEY=your-key docker compose up -d --build

# View logs
docker compose logs -f

# Stop
docker compose down

The docker-compose.yml includes Traefik labels for automatic HTTPS routing.

Deployment to Netcup

  1. Push to Gitea: git push origin main
  2. SSH to Netcup: ssh netcup
  3. Pull and deploy:
    cd /opt/websites/mycro-zine
    git pull
    export GEMINI_API_KEY=$(cat ~/.gemini_credentials)
    docker compose up -d --build
    
  4. Add to Cloudflare tunnel if not already configured

Integration with Gemini MCP

This library is designed to work with the Gemini MCP Server for AI-powered content and image generation:

  1. Use getContentOutlinePrompt() with gemini_generate for zine planning
  2. Use getImagePrompt() with gemini_generate_image for page creation
  3. Use createPrintLayout() to assemble the final print-ready file

License

MIT