Skip to content

About

Free design.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

PureCanvas

A local-first vector design app in the browser. Draw on an infinite dot-grid canvas with text, images, lines, shapes, icons and freehand strokes, then export to SVG, PNG or WEBP (or copy a PNG straight to the clipboard).

Everything is stored locally in the browser via Dexie (IndexedDB) — projects autosave and reload where you left off. No account. Projects stay on the device. An AI edit is sent only when you, or an agent on the page, ask for one.

Features

  • Infinite canvas with an adaptive dot grid, pan (Space / middle-mouse), and zoom (Ctrl/⌘ + scroll, buttons, or Fit to view).
  • Tools in a floating right-hand rail: Select, Text, Image, Line, Shape, Icon, Pen. Hovering a tool expands its label; some tools reveal option rails (pen variants, shape kinds).
  • Select & transform: click or marquee select, then move, resize (8 grips) and rotate. Hold Shift to constrain (uniform scale / 45° snapping on lines / 15° rotation), Alt to scale from the center. On mobile a Uniform toggle replaces Shift for aspect-locked resizing.
  • Text with a rich set of Google Fonts; the box resizes independently of the font size, and text can overflow the box.
  • Images via file picker, drag-and-drop, or paste; double-click (or the properties panel) to crop — drag the frame edges and reposition the photo.
  • Lines with grips on both ends, optional arrowheads and adjustable weight.
  • Shapes: rectangle, ellipse, triangle, diamond, star, hexagon — hollow or filled, recolorable, with corner radius.
  • Icons from Lucide and Google Material Symbols, with searchable pickers.
  • Pen with pen, highlighter and eraser variants.
  • Export to SVG, PNG, WEBP or clipboard, on a theme / transparent / white / black background. Fonts and images are embedded in the output.
  • Projects: create, rename, delete and reopen from a local database.
  • Layers, undo/redo, keyboard shortcuts, and light/dark themes (dark by default).
  • Edit with AI: a small bottom-left chat that can read and change the current design, reorder layers, place content on individual slides, and search Pixabay for images. Edits stream in as the model writes them: an on-canvas cursor moves between targets while new objects fade in, removed ones fade out, and moves and resizes glide into place. On models that support vision it also sees a rendered picture of every slide in each message, and can ask for a closer view of a placed image. PureCanvas free uses OpenRouter (deepseek/deepseek-v4.1-flash-1017), limited to 10 requests a minute, 100 an hour, and 200 a day. You can turn AI off, or use your own OpenAI-compatible key. The design guidance sent with every request is editable in Settings and can be reverted to the default. Agents on the page can use the same edit format through window.purecanvas (see public/agents.txt).

Keyboard shortcuts

Shortcut Action
V T I L R O P Select / Text / Image / Line / Shape / Icon / Pen
P (repeated) Cycle pen → highlighter → eraser
E Eraser
Ctrl/⌘ + Z / Shift + Ctrl/⌘ + Z Undo / redo
Ctrl/⌘ + D Duplicate
Ctrl/⌘ + A Select all
Ctrl/⌘ + C / Ctrl/⌘ + V Copy / paste
Ctrl/⌘ + = / - / 0 Zoom in / out / reset
Delete / Backspace Delete selection
Esc Exit text editing, then clear selection
Arrow keys Nudge (hold Shift for a larger step)
Space (hold) Pan

Development

npm install
npm run dev      # start the dev server
npm run build    # type-check and build to dist/
npm run preview  # preview the production build

Deployment

The app is a static SPA and deploys to Vercel with no build configuration beyond the included vercel.json. Import the repository, and Vercel detects Vite, runs npm run build, and serves dist/. For production analytics, also connect an Upstash Redis database and set ANALYTICS_PASSWORD (see Analytics).

Stock image search is served by the api/pixabay.ts serverless function at /api/pixabay. Vercel checks the filesystem (including api/ functions) before applying rewrites, so those requests are never swallowed by the /(.*) -> /index.html SPA catch-all.

Environment variables

api/pixabay.ts reads its Pixabay API key from PIXABAY_KEY via process.env.PIXABAY_KEY. You must set PIXABAY_KEY as an environment variable in the Vercel project (Project Settings → Environment Variables) for the deployed proxy to work — without it the function returns HTTP 500 PIXABAY_KEY environment variable is not set. Set it for the environments you deploy to (Production, Preview, Development, as needed). Locally, put it in an untracked .env file (already in .gitignore — never commit it).

Edit with AI is served by api/ai/chat.ts at /api/ai/chat. The free path calls OpenRouter model deepseek/deepseek-v4.1-flash-1017 with OPENROUTER_API_KEY. AI_QUOTA_SECRET peppers the free-tier rate counters: a hash of that secret and the client IP, counted per minute (10), hour (100), and UTC day (200). The same hash is kept briefly when a client bursts, repeats one prompt, or sends on a fixed interval. The IP and the prompt are not stored. On Vercel the free path also needs the same Upstash Redis credentials as analytics. Without Redis or the secret in production, free chat returns an error and your own key still works. Local development counts free messages in memory when Redis is not configured. Own-key requests are forwarded and are not written to logs, Redis, or disk.

Analytics

PureCanvas ships a small first-party analytics system instead of a third-party script. It records pageviews, unique visitors, sessions, bounce rate, referrers, UTM campaigns, approximate country (from Vercel's CDN header), and device / browser type. No cookies and no IP addresses are stored.

The dashboard lives at /analytics and requires ANALYTICS_PASSWORD, which is read only on the server. A successful login sets a signed, HttpOnly session cookie (12 hours). Set ANALYTICS_SESSION_SECRET to a long random string to sign that cookie independently of the password.

Storage

Production uses Upstash Redis over its REST API. Add a free Upstash database through the Vercel Marketplace (Storage → Marketplace → Upstash Redis) and make sure the project has either pair of variables:

  • UPSTASH_REDIS_REST_URL / UPSTASH_REDIS_REST_TOKEN, or
  • KV_REST_API_URL / KV_REST_API_TOKEN (what the Vercel KV integration injects)

Custom prefixes from the Vercel integration are detected automatically. For example, a prefix of UPSTASH_REDIS_REST produces UPSTASH_REDIS_REST_KV_REST_API_URL / UPSTASH_REDIS_REST_KV_REST_API_TOKEN, which also works.

Each pageview is written by a single Lua script, so it costs one Redis command. Local development does not need Redis: events are written to .data/analytics-dev.json (gitignored) and the dashboard works at http://localhost:5173/analytics.

Environment separation

Analytics keys are namespaced by ANALYTICS_ENV, which falls back to VERCEL_ENV (production, preview, development). Preview deployments and local development therefore never write into production data. In a production build the browser tracker only runs on purecanvas.app / www.purecanvas.app; preview hostnames are ignored. vite preview also writes to the local file.

Privacy policy

/privacy is a short, plain-language policy linked from the bottom-right footer (and from the mobile welcome dialog). It describes the anonymous analytics, Pixabay image search, Edit with AI, and data retention.

Tech

Vite + React + TypeScript, Tailwind CSS v4 and shadcn/ui (Base UI), Zustand for state, Dexie for persistence, and a custom SVG rendering engine.

About

Free design.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Contributors

Languages