8000 GitHub - tastolini/casa: Self-hosted, open-source brand case study generator · GitHub
[go: up one dir, main page]

Skip to content
tastoliniPublic

About

Self-hosted, open-source brand case study generator

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

Casa

A designer-directed, AI-assisted brand case study generator.

Casa takes a brand's finished assets — logo, colors, fonts, brief, moodboards — and produces a complete, exportable case study in minutes. Claude Opus 4.7 directs the art direction and narrative; Gemini's Nano Banana Pro generates photographic mockups. You refine, edit, and export — SVG / PNG / PDF / zip, ready for Figma or Behance.

Self-hosted. Open-source. BYOK (bring your own API keys). No accounts, no database, no cloud — everything lives on your disk.


Why this exists

Brand designers spend more time presenting work than designing it. A Behance case study for a completed identity takes 4–12 hours on top of the actual design: logo lockups, construction grids, color palette spreads, typography specimens, dozens of mockups, narrative copy.

Casa doesn't template that work — it has Claude make actual art-direction decisions about your brand, and has the designer direct and refine. Claude picks which mockups to propose, writes the tagline in your voice, drafts the interview answers; you edit, swap, reorder, and ship.


Features

Plan → Generate → Curate → Export

  • Opus 4.7 brief parser. Paste a paragraph; Claude extracts category, positioning, audience, adjectives, tone. Merges with any explicit inputs you provide.
  • Logo type classification. Tell Casa whether your mark is a wordmark, lettermark, symbol, emblem, combination, or abstract. Claude filters which templates make sense (no construction grid for a pure wordmark) and the plan generator weights frame mix accordingly.
  • Art direction + frame plan. Claude commits to a specific aesthetic (not "could feel like") and proposes a 10–18 frame sequence. Inline-editable, drag-to-reorder, regenerate-with-guidance.
  • Phase 1 coded visuals. Nine templates × three variants each, rendered server-side via Satori → SVG. Cover (editorial / masthead / bottom-anchored), logo hero (centered / lockup-trio / offset-corner), construction grid (renders the brand mark as a no-fill bezier wireframe with anchor dots — looks like Illustrator/Figma's vector-edit mode), scale test, logo variations, color palette (with HEX + RGB + HSL), typography specimen (true type-only — Aa + alphabet + pangram waterfall, no brand-name reuse), brand attributes (vertical stack / four-up grid / single-word principle), and closing spread (signoff / asymmetric / credits page).
  • Claude reads your moodboards. Brand + case-study moodboards are downscaled with sharp + JPEG-encoded and prepended to the plan / parse-brief / proposal / mockup-prompt calls so art direction commits to what's actually in the imagery instead of generic descriptors. Originals on disk are untouched (Gemini still reads them at full quality during AI frame generation). Per-image upload cap on moodboards is 5MB.
  • Brand-aware per-template copy. Optional "Design rationale" + 4-question interview section feed a Claude frame-copy call that emits per-template copy blocks (eyebrow / header / body / footer) for every coded frame. Construction reads "Built on a 7-unit baseline" with a real one-sentence rationale instead of "A = 1x · CLEAR = 1A". Templates fall back to today's strings when a field is absent.
  • Per-frame variant picker. Each coded library card exposes A/B/C variant chips. Picking a variant re-renders just that frame and busts the asset cache so the new render shows immediately.
  • Phase 2 AI mockups. Pluggable image-provider layer with Gemini Nano Banana Pro + Nano Banana 2 shipping. Hero-first rule: the first product render is clean and isolated so subsequent mockups reference it. Mockup prompts use literal-quoted strings for any URL / email / signage text so the model renders the exact characters instead of hallucinating.
  • No-branding first pass. Phase 2's first-pass renders (Nano Banana Pro) are explicitly instructed to leave brand-mark areas blank — debossed, empty, unmarked — so no fictional logos or invented wordmarks land on the surface. The brand mark is composited later via Nano Banana 2's edit pass or the manual editor. Negatives include logo, brand mark, made-up logo, branded text to suppress drift.
  • Brand contact info on visuals. Optional website + contact email fields are passed verbatim into mockup prompts that need them (business cards, billboards, web frames) and persisted on the project manifest.
  • Custom proposals with reference images. "Add your own idea" accepts a free-text prompt plus per-frame reference image uploads — Claude builds a structured proposal and the queue passes those refs to the image model alongside the brand moodboard. Panel stays visible after the initial batch, with an explicit aspect-ratio picker (default sourced from the project's deliverable format) and an "Add & generate" button that drafts the proposal and queues a single-frame render in one click.
  • Sample showcase shipped in the repo. Homepage carousel rotates eight curated frames (mix of coded + AI) from the bundled "Hooped" sample every 2s — pauses on hover, honors prefers-reduced-motion, dot pagination. The "See the sample project →" CTA opens /sample, a static walkthrough of the same project's brief, inputs, plan, and library so a fresh clone has a working demo without needing API keys.
  • Per-image controls. Two-mode prompt editor: "Describe change" (Claude translates the delta into a new prompt) or "Edit prompt" (designer edits the full Gemini prompt directly, with an optional "Refine with Claude" toggle). Plus an "Add logo" edit pass that takes a designer-uploaded raster (PNG/JPG/WebP) of the mark and asks Nano Banana 2 to composite it into the rendered scene, "Why this didn't work" Claude critique with vision, and revert-to-previous.
  • Manual layer editor. Canvas-based compositing (react-konva) with scale, rotate, two-triangle affine perspective warp, opacity, blend modes, editable text, and basic shape primitives (rectangle, ellipse, line) with fill / stroke / corner-radius controls.
  • Coded frames open editable. Every coded library card opens in the editor as discrete text / shape / image layers, and the editor decomposer respects the variant the designer picked — opening variant B of color-palette gives the hierarchy-mosaic layout (large primary + stacked secondary/accent/neutral with HEX/RGB/HSL), variant C gives the list format, etc. All 24 (template, variant) pairs have layered decomposers across cover-hero, logo-hero-centered, logo-construction (grid / crosshair / boxed-spec), logo-scale-test (horizontal / context-list / diagonal-descent), logo-variations (3-up / hero-plus-four / 2×2 mosaic), color-palette, typography-specimen (giant-glyph / pairing / waterfall), and closing-spread.
  • Edit project info anytime. A full edit panel on the project page lets you revise everything you originally entered — brief, logo type, website / contact, tone-of-voice sample, colors, Google + custom fonts, brand moodboard, case-study moodboard, people references, and tagged existing assets — with delete and upload affordances per item. Saves through one atomic multipart PATCH.
  • Narrative interview. Four questions, Claude drafts first-person answers in your voice from brief + tone sample + art direction. Skippable.
  • Copy generator. Tagline, positioning paragraph, and closing line — banned-word list enforced (no "crafted," no "elevated"). Lands on the closing-spread frame.
  • Library view. Grid + list toggle, drag-to-reorder, include/exclude per frame, variants grouped under parent concepts.
  • Case-study preview. Four deliverable formats live-switchable: Behance scroll, presentation deck (16:9), social carousel (1:1), PDF guidelines (A4 portrait).
  • Export. Zip bundle with SVG (named groups, editable text for Figma), PNG, JPEG (adjustable quality), and PDF.
  • Generation queue. Server-side, persisted on the project manifest — tab-close doesn't kill a batch. Client polls progress, cost preview per image, cancel any time.
  • Provider fallback. Configure a primary image provider + optional fallback. If the primary errors (quota, rate limit), the queue retries against the fallback once before failing.
  • Logo recolor for contrast. Templates auto-tint the logo to contrast each frame's background — handles fill / stroke attributes, named colors (black/white), inline style="fill:...", and CSS rules inside <style> blocks, so monochrome SVGs stay visible on dark or light fields.
  • Light + dark theme with a persistent toggle in the corner. Dark mode is WCAG-AA-audited (≥ 4.5:1 body contrast); palette is blue-forward (#3300FF) with a sparingly-used warm accent (#FF3F00) reserved for experimental flags.
  • Usage meter. Per-project and all-time spend tracked on each project manifest and surfaced on the homepage. Tracks both Gemini image cost and Claude token cost (Opus 4.7 list rate, computed from each response's usage block).
  • Keyboard shortcuts. G/L switch grid/list, E opens export, P opens preview, ? shows help. Esc closes any modal. ⌘Z / ⌘⇧Z undo / redo in the editor.
  • Project delete from the homepage. Filesystem-first — every project is a folder you can cd into; teams share via synced folders (Dropbox, Drive, Figma Desktop sync).

What ships today

Area Status
Plan generation + review ✅
Logo-type-aware template filtering ✅
9 coded templates × 3 variants each (incl. brand attributes) ✅
Claude reads brand + case-study moodboards (vision) ✅
Per-template grounded copy generation (frame-copy) ✅
Optional Design Rationale + Interview section in form ✅
Per-frame variant picker (A/B/C) in library ✅
Editable coded frames in editor (all 9 × 3 variants) ✅
Logo-construction frame as no-fill bezier wireframe with anchors ✅
Claude token cost on the usage meter ✅
Editor shape primitives (rect / ellipse / line) ✅
Phase 2 AI mockups (Gemini) ✅
Persistent "Add your own idea" + per-deliverable aspect default ✅
Custom proposals with reference image uploads ✅
Two-mode prompt editor (describe / direct + Claude refine) ✅
No-branding first pass + raster-upload "Add logo" edit ✅
Logo recolor for contrast (named colors / styles / CSS) ✅
Manual canvas editor ✅
Library grid/list + variant drawer ✅
Interview + copy generator ✅
Preview mode (all 4 formats) ✅
Export (SVG/PNG/JPEG/PDF zip) ✅
Full project-info editor (colors / fonts / moodboards / refs) ✅
Light / dark theme with toggle, WCAG-AA dark mode ✅
Usage meter ✅
Provider fallback plumbing ✅
Replicate / OpenAI adapters 🟡 Stubs only
Figma plugin companion 🟡 v1.1
Claude placement suggestions for existing assets 🟡 v1.1
Multi-step undo across editor ✅
Undo across plan / library actions 🟡 Variant revert only
User accounts / multi-user ❌ Out of scope

Requirements

  • Node.js 20 LTS or newer
  • Anthropic API key — claude-opus-4-7 access. Get one at console.anthropic.com.
  • Google Gemini API key — for Nano Banana Pro (gemini-3-pro-image-preview) + Nano Banana 2 (gemini-3.1-flash-image-preview). Get one at aistudio.google.com/apikey. Billing must be enabled — the free tier has 0 quota for the image preview models.
  • Platform: macOS, Linux, or Windows 10+. Tested on all three.

Installation

# 1. Clone
git clone https://github.com/YOUR-USERNAME/casa.git
cd casa

# 2. Install
npm install

# 3. Configure keys
cp .env.example .env.local
# Edit .env.local — paste your Anthropic + Gemini keys

# 4. Run
npm run dev

Open http://localhost:3000.

That's it. Projects persist to ./projects/<slug>/ on disk. Settings live in ./settings.json. Point projectsRoot in Settings at a synced folder if you want team access via Dropbox / Drive.

Environment variables

.env.local at the project root:

# Required — Claude Opus 4.7 for planning, interview, copy, critique
ANTHROPIC_API_KEY=sk-ant-...

# Required — Gemini for image generation and editing
GEMINI_API_KEY=...

Keys are read server-side only and never shipped to the client. See CLAUDE.md §3.


Usage

  1. New project. Drop an SVG logo, type a brand name, pick a logo type, write a paragraph brief. Optionally expand for colors, fonts (Google or custom upload), brand + case-study moodboards (Claude reads both, 5MB each), tone-of-voice sample, website, contact email, design rationale, and the four-question interview section.
  2. Plan review. Claude returns art direction + a 10–18 frame plan, filtered against the logo type. Edit any frame inline, drag to reorder, remove frames, regenerate the whole plan with guidance, or approve. Need to add a moodboard image or fix the brief? Hit "Edit project info" — it's a full mirror of the new-project form.
  3. Narrative interview (optional). Four questions in a side panel. Claude drafts answers — edit, skip, or leave blank.
  4. Phase 1 generation. Coded visuals render in parallel via Satori in seconds. You're now in the Library.
  5. Variant selection. Each coded card has an A/B/C chip group — pick the variant that fits the art direction; the frame re-renders in place.
  6. Phase 2 proposals. Claude's AI-frame suggestions appear as checkboxes with confidence flags and cost per image. Select, set aspect ratios per-frame, add your own ideas (with optional reference image uploads) in free text, click Generate.
  7. Refine. Under each frame: prompt editor (describe a delta or edit the prompt directly with optional Claude refinement), "Add logo" edit pass, open in the manual editor, "Why this didn't work" Claude critique, revert. Every coded frame opens in the editor as editable layers (text, image, shape) — closing the editor with Back returns you straight to the library.
  8. Curate. Toggle include/exclude, drag to reorder, pick a deliverable format, Preview.
  9. Export. Pick formats (SVG + PNG + JPEG + PDF), adjust JPEG quality, get a zip. Done.

Keyboard: G grid, L list, E export, P preview, ? help, Esc close. In the editor: ⌘Z / ⌘⇧Z undo / redo.


Tech stack


Architecture

/app
  /api
    /claude          Opus 4.7 endpoints (parse-brief, plan, interview, copy, frame-copy, critique, variant-prompt, enhance-prompt, proposal)
    /image           Provider-agnostic generate + edit routes
    /render          Satori template rendering
    /export          Zip / PDF bundling
    /projects        CRUD (multipart PATCH), queue, assets, plan/frames/variant patch, per-frame render
    /settings        Settings read/write
  /(routes)          new, projects/[slug], .../library, .../editor, .../preview, settings
/components
  /ui                shadcn primitives
  /app               Hand-written components (plan-review, library-view, preview-view, editor, panels, project-info-editor, theme provider/toggle)
  /templates         Eight coded-visual React templates (SVG output)
/lib
  /anthropic.ts              Claude SDK client
  /image-providers/          ImageProvider interface, registry, gemini + stubs
  /prompts/                  System prompts + tool schemas per Claude call
  /projects.ts               Filesystem project CRUD, atomic writes
  /queue.ts                  Server-side generation queue with hero-first + fallback
  /editor-decompose.ts       Coded-frame → editor-layers translator (all 9 templates × 3 variants)
  /template-eligibility.ts   Maps logo type → eligible coded templates
  /claude-vision.ts          Sharp resize + JPEG re-encode helper for moodboards passed to Claude
  /interview-questions.ts    Shared INTERVIEW_QUESTIONS const (no SDK dep)
  /sample-project.ts         Hardcoded "Hooped" sample — drives homepage carousel + /sample showcase
/public
  /sample/                   PNGs bundled with the repo for the carousel + showcase
  /settings.ts               Settings persistence
  /export.ts                 Zip bundler
  /deliverable-formats.ts    Behance/deck/carousel/pdf layout map
  /cost.ts                   Provider pricing + formatter
  /fonts.ts                  Google + custom font loader for Satori
  /google-fonts.ts           Curated Google-Fonts dropdown list
  /types.ts                  Shared domain types

Key constraints are documented in CLAUDE.md:

  • All API keys server-side (no NEXT_PUBLIC_* keys)
  • Filesystem-only persistence — no database
  • No auth — single-user local-first (team access via synced folders)
  • All image generation through getActiveProvider() — no direct SDK imports from routes/components
  • Library is the single source of truth; case study is a computed view
  • Structured output for every Claude call via tool-use (no free-text JSON parsing)
  • Hero-first image generation (clean isolated product render → reference for subsequent mockups)

Scope

Ships in MVP (per PRD.md §5.1): full plan → Phase 1 → Phase 2 → refine → library → preview → export loop. Single-user, self-hosted, BYOK.

Deferred to v1.1:

  • Figma plugin companion (current export produces SVG with named <g> groups that import into Figma as editable)
  • Real Replicate + OpenAI adapters behind the existing ImageProvider interface (stubs present, fallback plumbing live)
  • Per-project provider override
  • Claude placement suggestions for uploaded existing assets
  • Multi-step undo across plan + library actions (editor already has it)
  • Hosted version with auth / multi-user

Out of scope (per PRD.md §5.3): replacing Figma workflow, brand creation from scratch, client-collab tooling, becoming "a design platform."


Development

npm run dev     # Next.js dev server on :3000
npm run build   # production build
npm run lint    # ESLint

Before marking anything "done":

  • TypeScript compiles (npm run build passes)
  • ESLint clean (npm run lint passes)
  • Works with a fresh npm install on a clean checkout
  • Works with only .env.local configured — no hidden config steps
  • No API keys logged or echoed in any response

Full coding standards and conventions are in CLAUDE.md. Product spec is in PRD.md. The Windows + Claude Code dev environment walkthrough is in SETUP.md.


Contributing

Issues and PRs welcome. Areas where help is especially useful:

  • Real Replicate + OpenAI image provider adapters behind the existing contract in lib/image-providers/
  • Additional coded-visual templates in components/templates/ (with matching decomposers in lib/editor-decompose.ts so they stay editable in the manual editor)
  • A Figma plugin companion that ingests the export bundle
  • Crop UI for uploaded reference images
  • Multi-step undo across plan + library actions (editor stack already exists in components/app/editor/store.ts)

Keep PRs focused and read CLAUDE.md before submitting — it has the project's non-negotiable constraints.


License

MIT. See LICENSE if present, or assume MIT until one lands.


Acknowledgements

Built for the Claude Code Hackathon with Opus 4.7. Image generation courtesy of Google's Gemini Nano Banana Pro / Nano Banana 2. UI primitives from shadcn/ui. Typography by Geist.

About

Self-hosted, open-source brand case study generator

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0