-
-
Judoscale
Save 47% on cloud hosting with autoscaling that just works. Judoscale integrates with Django, FastAPI, Celery, and RQ to make autoscaling easy and reliable. Save big, and say goodbye to request timeouts and backed-up task queues.
-
full-stack-fastapi-template
Full stack, modern web application template. Using FastAPI, React, SQLModel, PostgreSQL, Docker, GitHub Actions, automatic HTTPS and more.
I would encourage you to take a look at this repo: https://github.com/tiangolo/full-stack-fastapi-postgresql This is a boilerplate of an application made with fastapi, prepared by the creator of the fastapi himself. You can even set it up yourself locally and have a look how it’s organised. I know it has a lot of different services included, but I find the fastapi part itself to be well thought. Inside the api directory you can notice another folder named api_v1, so you can have multiple versions of your API routes when needed, with the general code in other places that is more generic and can be reused in all your different API versions. The schemas are separated from the models and models itself have different classes depending on what you would actually like to do with the data. The migrations are managed with alembic based on schemas rather than models itself. The settings are a python class that implicitly reads the .env file in your project’s directory. And many, many other interesting patterns to explore. Too much to write in one comment to be honest.
-
The last suggestion is down at the bottom you have to use linters. I would recommend adding pre-commit hooks to run those linters. You'll still need to include linters in your CICD pipeline, but if you can setup a pre-commit config and include it in the readme's development instructions, people can catch these issues before they make the initial commit and before wasting CICD cycles. This tip is more for structured organizations - when we onboard a new developer, we pretty much make it one of their first tasks to setup their environment, then make a useless change and merge request so they can validation the pre-commit linters, the pipeline, etc. The MR/PR itself will get closed, but should provide a view of the process.
-
Regarding 16. I had lots of issues with Background Tasks when using Middleware. As in https://github.com/tiangolo/fastapi/issues/3859. Has this been fixed? Doesn't look like it