/fastapi-services-oauth2

Structuring FastAPI applcation using 3-tier design pattern

Primary LanguagePythonMIT LicenseMIT

fastapi-services-oauth2

This repository provides an approach on how to effectively structure a FastAPI application with multiple services using 3-tier design pattern, integrate it with Postgres backend, and implement straightforward OAuth2 Password authentication flow using Bearer and JSON Web Tokens (JWT).

Read the tutorial for more details.

How to install

Clone this repository and install using pip.

$ pip install --editable .

How to run

Configure the relevant DSN string to your Postgres backend database in .env file, or provide it from the environment variable MYAPI_DATABASE__DSN.

To run the application use following.

$ uvicorn app.main:app

or

$ MYAPI_DATABASE__DSN=postgresql://... uvicorn app.main:app

License

MIT License (see LICENSE).