Generate realistic handwritten pages from your own handwriting datasets.
This project has two parts:
projects/- Python pipeline (extractor, renderer, API server)frontend/- React + TypeScript web app (upload, compose, tune, preview, download)
There are now two backend tracks inside projects/:
api_server.py- the current local MVP backend used by the existing frontendbackend/- a new production-oriented FastAPI scaffold for hosted multi-user development
- You upload handwriting grid images (alphabet and optional coding symbols).
- The extractor converts grids into glyph datasets.
- The renderer composes text using those glyphs.
- The web app lets you tune rendering behavior and export PNG pages.
Handwritten Notes Generator/
frontend/ # React UI (Vite)
projects/
api_server.py # Python HTTP API
backend/ # Production-ready FastAPI scaffold
backend_runtime/ # Generated runtime data for backend/ (ignored)
extractor.py # Grid -> glyph dataset extraction
renderer.py # Glyph dataset -> rendered page
handwriting_samples/ # Input alphabet grid images
coding_symbol_samples/ # Input coding symbols grid images
glyph_sets/ # Extracted datasets
output/ # Rendered PNG outputs
backgrounds/ # Page backgrounds (ruled/plain)
- Python 3.10+ recommended
- Packages:
numpyopencv-pythonpillow
For the new hosted backend scaffold, also install:
fastapiuvicornpython-multipartpydantic
Install:
pip install numpy opencv-python pillowFor the production backend scaffold:
pip install -r projects/requirements-production.txt- Node.js 18+ recommended
- npm
This is the older local backend flow. It is still useful for legacy pipeline testing, but the current React frontend is now wired to projects/backend/.
Open two terminals.
cd projects
python api_server.pyDefault API URL:
http://localhost:8001
Optional custom port:
$env:HANDWRITING_PORT="8010"
python api_server.pycd frontend
npm install
npm run devIf you want the current frontend experience, start the hosted backend foundation below instead of api_server.py, then open the Vite URL shown in terminal (usually http://localhost:5173).
Optional API base override:
$env:VITE_API_BASE="http://127.0.0.1:8000"
npm run devThis is now the main multi-user backend path for the hosted app frontend.
cd projects
uvicorn backend.main:app --reloadAPI base:
http://127.0.0.1:8000/api/v1
Browser entry:
http://127.0.0.1:8000/-> redirects to docs
Auth default:
- local email/password auth is enabled by default
- sign up or sign in from the frontend UI
Hosted auth options:
HANDWRITING_AUTH_MODE=jwtfor a generic OIDC/JWT providerHANDWRITING_AUTH_MODE=supabasefor Supabase JWTs- configure issuer/audience/JWKS or a shared JWT secret in:
projects/backend/.env.example
Optional dev auth fallback:
X-Dev-User-Id: demo-userX-Dev-User-Email: demo-user@local.dev
Config template:
projects/backend/.env.example- production template:
projects/backend/.env.render.supabase.r2.example - frontend production template:
frontend/.env.production.example
- Use an 8x8 alphabet grid image.
- Upload from frontend in Datasets section, or place images in:
projects/handwriting_samples/
- Use a 6x5 symbols grid image.
- Upload from frontend in Datasets section, or place images in:
projects/coding_symbol_samples/
When extraction runs, datasets are created under:
projects/glyph_sets/<handwriting-set>/...projects/glyph_sets/coding_symbols/<coding-set>/...
Debug overlays are saved in each output dataset folder as:
detected_grid_debug.png
When using projects/backend/, user data is stored in:
- uploads:
projects/backend_runtime/uploads/<user-id>/... - glyph datasets:
projects/backend_runtime/glyph_sets/<user-id>/... - renders:
projects/backend_runtime/renders/<user-id>/... - metadata DB:
projects/backend_runtime/app.db
Hosted render retention:
- only the newest
3renders are kept per user - older renders are deleted automatically when a new render is created
Hosted backgrounds:
- every user always starts with the default background:
projects/backgrounds/ruled.png
- every user can keep up to
1custom uploaded background
Hosted queue mode:
- local default: in-process worker threads
- hosted option: Celery + Redis
- worker command:
celery -A backend.celery_app.celery_app worker --loglevel=infoFrom projects/api_server.py:
GET /- health ({"status":"ok"})GET /api/defaults- frontend default render options + feature flagsGET /api/datasets- available dataset listPOST /api/extract- upload grid image and extract datasetPOST /api/render- render page using current text/options/datasets
From projects/backend/:
GET /-> redirects to/docsGET /api/v1/healthGET /api/v1/defaultsPOST /api/v1/auth/signupPOST /api/v1/auth/loginPOST /api/v1/auth/logoutGET /api/v1/meGET /api/v1/datasetsPOST /api/v1/datasets/uploadPATCH /api/v1/datasets/{dataset_id}DELETE /api/v1/datasets/{dataset_id}GET /api/v1/backgroundsPOST /api/v1/backgrounds/uploadPATCH /api/v1/backgrounds/selectDELETE /api/v1/backgrounds/{background_id}GET /api/v1/rendersPOST /api/v1/rendersGET /api/v1/renders/{render_id}/fileDELETE /api/v1/renders/{render_id}
- Assignment mode: Simple / Coding
- Dataset cards with rename/delete/status
- Background cards with default/custom switching
- Compose area with multiline support
- Basic and advanced render controls
- Exact character tuning (per-character override controls)
- Large preview + PNG download
- Render history with preview/download/delete
- Light and dark theme support
cd frontend
npx tsc -bcd frontend
npm run lintpython -m py_compile projects/renderer.py projects/extractor.py projects/api_server.py- Confirm API is running:
http://localhost:8001should return{"status":"ok"}
- Restart both backend and frontend after code changes.
- Hard refresh browser
- Restart
npm run dev
- Restart Python API to load latest renderer/backend logic.
- Confirm
GET /api/defaultsreturns feature support for char overrides.
- Upload at least one alphabet grid or add sample images to:
projects/handwriting_samples/
- Re-run extraction through UI or API.
projects/main.pyis an older script and not the primary runtime path.- The legacy local MVP path is
api_server.py. - The current hosted/frontend auth path is
projects/backend/+ frontend. projects/backend/is the new hosted foundation and currently reuses the existingextractor.pyandrenderer.pypipeline under the hood.
- Wire a hosted auth provider into
projects/backend/auth.py - Move in-process background jobs to an external worker/queue service
- Add dataset selection per render instead of using all completed datasets
- Add dataset quality scoring and bad-glyph detection UI
- Add one-click export profiles (exam style, coding style, neat style)