HandWrite turns your own letterforms into a downloadable TrueType font. Draw letters with a finger, stylus, or trackpad, or upload a clear photo of handwritten letters. The app builds a .ttf file in the browser for review and download, without an account or saved uploads.
- Lets you draw letters directly in the browser without a printed template.
- Accepts phone photos, including common formats such as JPEG, PNG, WEBP, HEIC, and HEIF.
- Normalizes uploads to JPEG before analysis.
- Uses a stateless Next.js API route to ask Gemini for alphabet glyph locations.
- Generates the font in a Web Worker so tracing and OpenType serialization do not block the upload UI.
- Supports uppercase and lowercase glyph extraction when both are present.
- Shows a font preview only after a real
.ttfhas been generated.
- Next.js 16 App Router
- React 19
- TypeScript
- Tailwind CSS 4
- Bun
- Gemini API through
@google/genai opentype.jsfor font creationimagetracerjsfor raster-to-vector tracing
Install dependencies:
bun installCreate .env.local and add a Gemini API key:
GEMINI_API_KEY=your_api_key_hereFor production, configure Redis-backed upload limiting with either Upstash Redis or Vercel KV-compatible REST variables:
UPSTASH_REDIS_REST_URL=your_redis_rest_url
UPSTASH_REDIS_REST_TOKEN=your_redis_rest_tokenRun the development server:
bun run devOpen http://localhost:3000.
bun run dev # Start the local development server
bun run build # Create a production build
bun run start # Start the production server
bun run lint # Run ESLint
bun run test # Run Bun tests with the project test setupsrc/app/
page.tsx Home page
home-spotlight.tsx Pointer-following background letter reveal
draw/ Direct drawing and font-generation UI
upload/ Upload, analysis, generation, and review UI
api/extract/analyze/ Stateless Gemini analysis route
src/lib/extraction/ Gemini response schemas and extraction constants
src/lib/font/ Glyph tracing, font generation, and worker code
src/lib/images/ Upload normalization helpers
src/lib/server/ Server-only environment helpers
src/test/ Test setup
Project references:
- The user chooses to draw letters in the browser or upload a photo.
- The drawing path records the user's strokes and sends them straight to font generation.
- The photo path normalizes the image to JPEG and sends it to
/api/extract/analyzefor Gemini glyph detection. - The browser starts a Web Worker to trace the captured glyphs and build a
.ttf. - The UI displays the generated font preview and download action.
- The app does not persist uploads or generated fonts.
GEMINI_API_KEYstays on the server and is never exposed to browser code.- Production analysis uploads are capped at three valid photos per client IP.
- Font fidelity depends on the photo: clear lighting, dark ink, and separated letters produce better glyphs.
