Looking for a FastAPI Boilerplate for User Management and Validation
Asked by
+notice the comma!
Hey everyone! I'm currently developing a responsive web app using React, and I'm on the hunt for a FastAPI boilerplate that meets certain criteria or is easily adaptable to include them. Specifically, I need the following features:
1. User registration and authentication routes.
2. Integration with a MySQL database, including tables for users and access tokens (like UUID).
3. Request validation that allows me to specify required parameters and set limitations based on the database (like VARCHAR(30) for a user's first name).
4. The capability to mark routes as requiring authentication or not (possibly through decorators).
5. Support for different user levels, where some routes require users to have specific levels stored as integers in the users table.
6. Models that can be easily extended for the frontend.
I'd really appreciate any recommendations or insights! I've gone through tons of boilerplates, but none of them fit my needs perfectly.
Answers
I created a project that includes almost all the features you're looking for, though it's currently tailored for Postgres rather than MySQL. You might want to check it out: [fastapi-forge](https://github.com/mslaursen/fastapi-forge). Youโll need to tweak it a bit to fit your needs, though.
Reply to this answer
Have you looked into [FastAPI-users](https://fastapi-users.github.io/fastapi-users/latest/)? It might cover a lot of your requirements and save you some time.
Reply to this answer
You can find what you need easily enough. Are you just coding for the vibe or actually digging deep into it?
Reply to this answer
I recommend just building this from scratch. With all the FastAPI extensions available and using Pydantic and SQLAlchemy, you can accomplish 90% of what you need by learning as you go. Using a boilerplate might complicate things more than it helps. Plus, the FastAPI docs are super helpful for customizing your app while you develop your understanding.
Reply to this answer
Add your answer
Answers are reviewed before publication.
plumbing vent stack: No need to come off like that... Itโd help if you shared some useful resources instead.
13mm lens cap: "You can find this anywhere" doesnโt help; you didnโt even link to anything.