A React app that turns SQL CREATE TABLE statements into a runnable Python
FastAPI REST application. Paste your schema (tables, columns, primary keys and
foreign-key relationships) and get back SQLAlchemy models, Pydantic schemas, and
per-table CRUD routers — downloadable as a .zip.
🔗 Live demo: https://joeyvigil.github.io/sql-to-rest/
- Pragmatic
CREATE TABLEparser (MySQL / PostgreSQL / SQLite dialects) - Detects primary keys,
NOT NULL,UNIQUE, defaults,AUTO_INCREMENT/SERIAL - Inline and table-level
FOREIGN KEY ... REFERENCES→ SQLAlchemy relationships - Generation options — target SQLite / PostgreSQL / MySQL, and choose sync or async SQLAlchemy (the right driver, engine, session, and route handlers are emitted for each combination)
- Pagination (optional) — list endpoints return a
{ items, total, skip, limit }envelope via a genericPage[T] - Docker (optional) —
Dockerfile,.dockerignore, and adocker-compose.ymlthat adds a Postgres/MySQL service when relevant - pytest suite (optional) — generated smoke tests that run against a throwaway SQLite database
- ER diagram view that visualizes the parsed tables and their relationships
- Syntax highlighting — a CodeMirror SQL editor for input and highlighted Python output
- Generates a complete FastAPI project:
app/database.py,app/models.py,app/schemas.py- one CRUD router per table (
list / get / create / update / delete) app/main.py,requirements.txt,.env.example,README.md
- Live preview with file tree, copy-to-clipboard, and zip download
npm install
npm run devOpen the printed local URL.
npm run build
npm run previewsrc/lib/sqlParser.ts parses the SQL into a small schema model
(src/types.ts). src/lib/generator.ts walks that model and emits the FastAPI
source files, which the UI renders and zips up via JSZip.

