Starting from version 1.4 SQLAlchemy supports asyncio. This means you don't need external tools like encode/databases. This educational project demonstrates how you can use new SQLAlchemy 2.0-style with FastAPI. Websockets, celery and alembic for DB migrations are used as well.
If you are interested in old styled SQLAlchemy async example you can check this repo.
Please note that this is educational project only and encryption method using here is not secure.
Run
docker compose up --build
Tu run tests use
docker compose exec web pytest
To install dependencies use poetry:
poetry install
To open API documentation go here: http://127.0.0.1:8000/docs
If you want to test websocket, you can run simple websocket client:
$ python websocket_test_client/main.py <USER_TOKEN>
Please note that you need user token for this. You can create user like this:
curl --location 'http://0.0.0.0:8000/sign-up/' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "sam_vimes@citywatch.com",
"password": "12345678",
"name": "Sam Vimes"
}'
To generate keypair use following command:
python console/generate_keys.py