• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
paulkinlan

paulkinlan

tracey-mctraceface

Do a drawing and see it with Gemini Flash 2.5 image gen
Public
Like
1
tracey-mctraceface
Home
Code
3
backend
1
frontend
4
README.md
Branches
1
Pull requests
Remixes
History
Environment variables
1
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
8/27/2025
Viewing readonly version of main branch: v88
View latest version
README.md

Trace AI

A minimal drawing application where AI automatically generates artwork beneath your sketches as you draw.

Features

  • 🎯 Canvas-Focused: Clean, minimal interface focused purely on the drawing experience
  • πŸ” Basic Auth Protected: Secure access with username/password authentication
  • πŸ“ Configurable Canvas Size: Choose from 512x512, 768x768, or 1024x1024 pixels
  • ✨ Auto-Generation: AI generates artwork automatically as you draw
  • 🎭 Exact Size Matching: Canvas and AI output are exactly the same dimensions
  • πŸ”„ Toggle Views: Switch between sketch overlay and pure AI artwork
  • πŸ’Ύ Direct Save: Save the AI-generated artwork directly
  • ⚑ Responsive Drawing: Low-latency drawing with Ink API support
  • 🌈 Colorful Generation Feedback: Beautiful multi-color glow effects when AI is generating new artwork

Project Structure

β”œβ”€β”€ backend/
β”‚   └── index.ts             # API endpoint with Gemini integration
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ index.html           # Minimal HTML interface
β”‚   β”œβ”€β”€ app.js              # Main application logic
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ drawing-canvas.js # Canvas Web Component with size control
β”‚   β”‚   └── control-panel.js  # Minimal control panel
β”‚   └── style.css           # Clean, minimal styles
└── README.md

Setup

  1. Set the API Key: Add your Google Gemini API key as an environment variable in Val Town:

    • Go to your Val Town settings
    • Add GEMINI_API_KEY with your Google AI Studio API key
    • Get your API key from: https://aistudio.google.com/app/apikey
  2. Set Basic Auth Credentials: Add Basic Auth environment variables in Val Town:

    • Add BASIC_AUTH_USERNAME with your desired username
    • Add BASIC_AUTH_PASSWORD with your desired password
    • These credentials will be required to access the application and API
  3. Access the Application: The application will be available at the HTTP endpoint URL provided by Val Town

    • You'll be prompted for username and password when accessing the site

Usage

  1. Select Size: Choose your preferred canvas size (512x512, 768x768, or 1024x1024)
  2. Draw: Start sketching - AI automatically generates artwork underneath
  3. Toggle: Use "Show AI Only" to see the pure AI artwork or your sketch overlay
  4. Save: Click "Save" to download the AI-generated image

Controls

  • Clear: Remove all drawing and generated artwork
  • Show AI Only / Show Sketch: Toggle between views
  • Save: Download the current AI-generated artwork
  • Canvas Size: Change the canvas dimensions

Keyboard Shortcuts

  • Ctrl/Cmd + N: Clear the canvas
  • Ctrl/Cmd + S: Save the generated image

Technical Details

  • Frontend: Vanilla JavaScript with Web Components, Tailwind CSS
  • Backend: Deno runtime on Val Town with Hono framework
  • AI Model: Google Gemini 2.5 Flash Image Preview
  • Canvas: HTML5 Canvas with optimized 2D context for low latency
  • Generation Feedback: Colorful visual effects including rainbow glow cycling through pink, purple, blue, green, yellow, and orange tones, plus a matching colorful spinner in the loading indicator
  • Accessibility: Respects prefers-reduced-motion for users who prefer minimal animations
FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
Β© 2026 Val Town, Inc.