Skip to content

Repository files navigation

🎨 Cosy

Content Easy — Lightning-fast template-based image generation in Rust

Render carousel, OG images, and marketing visuals from JSON + SVG templates at ~50ms/slide. No browser. No Chromium. Single binary.


Why Cosy?

CanvaBannerbearCosy
SpeedManual2-5s/render~50ms/render
DependencyBrowser/AppBrowser-basedNone (pure Rust)
ScriptableNoYes (API)Yes (CLI + API)
Self-hostedNoNoYes
Price$15/mo$49-149/moTBD

How It Works

Template (SVG + JSON schema) → minijinja token replacement → resvg render → PNG
  1. Define a template: SVG file + JSON schema (brand fields + slide fields)
  2. Fill the template: JSON data input (brand info + per-slide content)
  3. Render: Cosy renders PNG in ~50ms per slide

Quick Start

# Build
cargo build --release
# List templates
cosy templates
# Render single image
cosy render --template stat-card --data input.json --output cover.png --scale 2
# Output defaults to 2x (retina) — pass --scale 1 for exact template dimensions.# Images (bg_image, logo) accept local paths or https URLs (SSRF-guarded in cosy serve).# Render with inline JSON
cosy render --template stat-card --json '{"brand":{"brand_name":"CodeCora"},"slides":[{"stat_number":"127%","stat_label":"Revenue Growth"}]}' --output cover.png
# Start HTTP API server (open, no auth — dev only)
cosy serve --port 3000
# Start with bearer token auth
cosy serve --port 3000 --token mysecretkey
# or: COSY_API_KEY=mysecretkey cosy serve --port 3000

HTTP API

# Health check (always public)
curl http://localhost:3000/api/health
# List templates (requires auth if token is set)
curl -H "Authorization: Bearer mysecretkey" \
http://localhost:3000/api/templates
# Render via API (requires auth if token is set)
curl -o output.png -X POST http://localhost:3000/api/render \
-H "Content-Type: application/json" \
-H "Authorization: Bearer mysecretkey" \
-d '{"template":"stat-card","scale":2,"data":{"brand":{"brand_name":"CodeCora"},"slides":[{"stat_number":"127%","stat_label":"Revenue Growth"}]}}'

Authentication

When COSY_API_KEY is set (via env var or --token flag), all API endpoints except /api/health require an Authorization: Bearer <token> header. Requests without a valid token receive 401 Unauthorized. If no key is configured, auth is disabled (development mode).

Docker

# Pull from GHCR
docker pull ghcr.io/codecoradev/cosy:latest
# Run with auth
docker run -d \
-p 3000:3000 \
-e COSY_API_KEY=mysecretkey \
--name cosy \
ghcr.io/codecoradev/cosy:latest
# Or use docker-compose
cp .env.example .env # edit COSY_API_KEY
docker compose up -d

Template Structure

templates/
├── stat-card/
│ ├── template.svg # SVG with {{ tokens }}
│ └── schema.json # Field definitions
├── twitter-quote/
│ ├── template.svg
│ └── schema.json
└── ... # 18 templates included

Documentation

Built-in Templates (18)

TemplateSizeUse Case
stat-card1080×1080Single statistic highlight
twitter-quote1200×675Twitter/X quote card
linkedin-card1200×627LinkedIn post image
dev-quote1080×1080Developer quote (code snippet)
instagram-story1080×1920Instagram/Snapchat story
youtube-thumb1280×720YouTube thumbnail
github-readme800×600GitHub README banner
tiktok-quote1080×1200TikTok quote card
newsletter-header1200×400Email newsletter header
podcast-cover1080×1080Podcast episode cover
event-banner1920×1080Event/webinar banner
testimonial1080×1350Customer testimonial
checklist1080×1350Tips/checklist carousel
comparison1080×1350Before/after comparison
announcement1200×630Product announcement
carousel-default1080×1350Generic carousel slide
og-image1200×630Open Graph meta image
social-quote1080×1080General social media quote

License

Business Source License 1.1 (BSL-1.1). See LICENSE.

Copyright © 2026 PT Azfirazka Digital Kreatif

About

Cosy (Content Easy) — Rust template-based image generation. Lightning-fast SVG->PNG rendering for marketing visuals.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages