Skip to content

A demonstration of best practices for a large FastAPI project

Notifications You must be signed in to change notification settings

apryor6/fastapi_example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example of a scalable FastAPI

The site

A sample project showing how to build a scalable, maintainable, modular FastAPI with a heavy emphasis on testing.

This is an example project using the structure proposed in this blog post., but with FastApi instead of Flask.

Running the app

Preferably, first create a virtualenv and activate it, perhaps with the following command:

virtualenv -p python3 venv
source venv/bin/activate

Next, run

pip install -r requirements.txt

to get the dependencies.

Next, initialize the database

invoke seed-db

Type "Y" to accept the message (which is just there to prevent you accidentally deleting things -- it's just a local SQLite database)

Finally run the app with

python wsgi.py

Navigate to the posted URL in your terminal to be greeted with Swagger, where you can test out the API.

Running tests

To run the test suite, simply pip install it and run from the root directory like so

pip install pytest
pytest

About

A demonstration of best practices for a large FastAPI project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages