This is a basic Rest-api service written in Fastapi. It serves as an example to quickly start and develop your own api.
Full authorisation with JWT-token is implemented.
The User and Role functions are implemented.
SqlAlchemy for Postgresql is used as orm.
We have a Small Model with MongoBD attached to it. AsyncMotor is used as a driver.
- Run docker composer
docker composer up -d
- Create venv and install poetry
pip install poetry
- Install requirements
poetry install
- Activate venv.
- Create migration
alembic upgrade head
- Create role for user
python commander.py user create-all-role
- Create the first user
python commander.py user create [email protected] qwertyneabfywfv8374vf admin adminx
clean - Remove all build,
format - Format files
help - Show this help
lint - Lint files
poetry - Install poetry
pre-commit - Format & lint before commit
run-dev - Run the local development server
run - Run the local server
This file contains the basic commands for working with the database via sqlalchemy directly. Commands:
db - Common commands for working with the database
user - Common commands for working with users
- add model to app/core/aiembic_import.py
- go into the app folder
Run commands:
alembic revision --autogenerate -m "TEXT INFO"
alembic upgrade head
Run commands:
alembic upgrade head
poetry add - install packages
poetry remove - remove packages
poetry add - add packages
poetry update - update all packages
poetry install - install all packages
poetry show --latest - show all packages