{"id":28542638,"url":"https://github.com/petrgazarov/fastapi-app","last_synced_at":"2026-03-09T07:31:54.475Z","repository":{"id":172154220,"uuid":"648922465","full_name":"petrgazarov/FastAPI-app","owner":"petrgazarov","description":"Example app using FastAPI, asyncio, SQLModel, Celery, Alembic and Supertokens","archived":false,"fork":false,"pushed_at":"2024-07-29T02:19:35.000Z","size":689,"stargazers_count":106,"open_issues_count":0,"forks_count":8,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-12-07T23:59:28.512Z","etag":null,"topics":["alembic","asyncio","celery","fastapi","pydantic","python3","sqlmodel","supertokens"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/petrgazarov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-06-03T07:58:04.000Z","updated_at":"2025-11-16T05:22:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"cf609374-db9a-4fb0-9d27-4fd3c6360747","html_url":"https://github.com/petrgazarov/FastAPI-app","commit_stats":null,"previous_names":["petrgazarov/fastapi-app"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/petrgazarov/FastAPI-app","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petrgazarov%2FFastAPI-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petrgazarov%2FFastAPI-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petrgazarov%2FFastAPI-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petrgazarov%2FFastAPI-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/petrgazarov","download_url":"https://codeload.github.com/petrgazarov/FastAPI-app/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petrgazarov%2FFastAPI-app/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30287425,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T02:57:19.223Z","status":"ssl_error","status_checked_at":"2026-03-09T02:56:26.373Z","response_time":61,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alembic","asyncio","celery","fastapi","pydantic","python3","sqlmodel","supertokens"],"created_at":"2025-06-09T20:35:00.943Z","updated_at":"2026-03-09T07:31:54.440Z","avatar_url":"https://github.com/petrgazarov.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FastAPI App\n\nThis is a small app that I built while learning Python and FastApi. It allows to create documentations (shared schemas + screenshots) from tracking events. It also serves as a backend for an interface that lets a user register, sign in, set some settings and view documentations.\n\nWhile building this app, I spent the most time learning the best practices of accomplishing common tasks in the FastAPI ecosystem. I tried out various libraries and arrived at the following list that I think work well together:\n\n- FastAPI + Asyncio\n- SQLModel for data models and validation\n- Celery for background tasks\n- Alembic for migrations\n- Supertokens for user authentication\n- Mypy for type checking\n- Make for running commands\n\nAdditionally, the codebase showcases the following things:\n\n- Multiple FastAPI apps in one project\n- Alembic auto-generating migrations from model files\n- Celery tasks communicating through an SQS FIFO queue\n- AWS S3 integration for storing images\n- Loggers that print SQL queries and other useful information\n- Error handler middlewares\n- CORS middleware\n- Two separate types of authentication (static auth token for an internal endpoint + Supertokens for user authentication)\n- Dependencies management using Poetry\n- And more.\n\n## Inspiration\n\nI took a ton of inspiration from the following articles and projects:\n\n[Abstracting FastAPI Services](https://camillovisini.com/article/abstracting-fastapi-services/)\n\n[grillazz/fastapi-sqlalchemy-asyncpg](https://github.com/grillazz/fastapi-sqlalchemy-asyncpg)\n\n[The ultimate async setup: FastAPI, SQLModel, Alembic, Pytest](https://medium.com/@estretyakov/the-ultimate-async-setup-fastapi-sqlmodel-alembic-pytest-ae5cdcfed3d4)\n\n## Project structure\n\nThe project is organized into the following directories and files:\n\n| Directory/File Name | Description                                                                          |\n| ------------------- | ------------------------------------------------------------------------------------ |\n| background_tasks/   | Celery tasks                                                                         |\n| crud/               | CRUD operations                                                                      |\n| db/                 | Alembic migrations                                                                   |\n| models/             | model files that combine data models and Pydantic schemas                            |\n| schemas/            | Pydantic schemas for things other than data models (e.g. api requests and responses) |\n| services/           | business logic                                                                       |\n| subapps/            | FastAPI apps with each file containing a separate app                                |\n| utils/              | utility functions                                                                    |\n| celery.py           | Celery app                                                                           |\n| config.py           | Pydantic settings                                                                    |\n| database.py         | SQLAlchemy database engine and session                                               |\n| dependencies.py     | FastAPI dependencies                                                                 |\n| main.py             | main project file                                                                    |\n\n## Running the project\n\n### Prerequisites\n\n- Python 3.10\n- Supertokens account\n- GitHub OAuth app (SuperTokens uses GitHub OAuth but that can easily be changed for another OAuth provider)\n- AWS Account, an S3 bucket and an SQS queue\n- PostgreSQL database\n\n### Steps\n\n1. Clone the repo\n2. Change `sqlalchemy.url` in `alembic.ini` to point to your database\n3. Use commands in Makefile to install dependencies and run migrations\n4. Rename `.env.example` to `.env` and fill in the values\n5. Run `make server` and `make worker` to start the web server and the Celery worker\n\n\n## Pre-Commit Setup\n\nIf you are using this project then pre-commit setup would be very helpful for checking your codebase. In short, pre-commit is a tool that allows developers to define and apply automated checks to their code before they commit it to a version control system. You can find more info [here](https://pre-commit.com).\n\n\n```commandline\npre-commit install\n\n# for the first time, run on all files\npre-commit run --all-files\n```\n\n## License\n\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetrgazarov%2Ffastapi-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpetrgazarov%2Ffastapi-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetrgazarov%2Ffastapi-app/lists"}