Public
Like
1
tracey-mctraceface
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.
Viewing readonly version of main branch: v126View latest version
A minimal drawing application where AI automatically generates artwork beneath your sketches as you draw.
- π― 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
βββ 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
-
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_KEYwith your Google AI Studio API key - Get your API key from: https://aistudio.google.com/app/apikey
-
Set Basic Auth Credentials: Add Basic Auth environment variables in Val Town:
- Add
BASIC_AUTH_USERNAMEwith your desired username - Add
BASIC_AUTH_PASSWORDwith your desired password - These credentials will be required to access the application and API
- Add
-
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
- Select Size: Choose your preferred canvas size (512x512, 768x768, or 1024x1024)
- Draw: Start sketching - AI automatically generates artwork underneath
- Toggle: Use "Show AI Only" to see the pure AI artwork or your sketch overlay
- Save: Click "Save" to download the AI-generated image
- 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
Ctrl/Cmd + N: Clear the canvasCtrl/Cmd + S: Save the generated image
- 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-motionfor users who prefer minimal animations