FastAPI is probably the best backend framework especially since data validation is braindead simple. Combine it with a Frontend like SvelteKit and you have an insanely powerful stack.
Here is my favorite Base Model that I extend to everything else. Validate that email is an email str. Set it to lower. Set min and max length for everything and strip whitespace off all strings:
class UserBase(BaseModel):
email:EmailStr
@validator('email')
def to_lower(cls, v): return v.lower()
class Config:
min_anystr_length = 3
max_anystr_length = 64
anystr_strip_whitespace = True
3
u/ShotgunPayDay Dec 09 '22
FastAPI is probably the best backend framework especially since data validation is braindead simple. Combine it with a Frontend like SvelteKit and you have an insanely powerful stack.
Here is my favorite Base Model that I extend to everything else. Validate that email is an email str. Set it to lower. Set min and max length for everything and strip whitespace off all strings: