Skip to content

Latest commit

 

History

History
53 lines (37 loc) · 1.43 KB

README.md

File metadata and controls

53 lines (37 loc) · 1.43 KB

Pydantic forms example

This repository contains a working example of a FastAPI application with the pydantic forms frontend and backend modules working together. It shows how you can use the pydantic forms pypy module on top of pydantic models to automatically generate forms on the frontend using the pydantic forms npm module that ask for user input. It also show validation and processing of the user input.

Installation

This example application creates as FastApi application to serve as a backend for a react frontend.

backend

To install using a virtual environment:

$ cd backend
$ python -m venv env
$ source env/bin/activate
$ pip install -r requirements.txt
$ fastapi dev main.py

Visit http://127.0.0.1:8000/docs to view the api documentation

frontend

$ cd frontend
$ npm i
$ npm run dev

Visit http://127.0.0.1:3000 to view the generated form

Contributing

When setting up this repo to contribute initialize the pre-commit hooks using pre-commit (eq. brew install pre-commit). For installing prec

$ pre-commit install

Publishing to npm

This repository is also used to publish the pydantic forms ui package to NPM. <TODO: Publish instructions>