Skip to content
/ vaton Public

Start fastapi project with mongodb(motor+odamantic) + postgres(sqlalchemy) + redis

Notifications You must be signed in to change notification settings

IzyI/vaton

Repository files navigation

VATON


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.


Before starting work, it is necessary to !!!!!!!!

  1. Run docker composer
docker composer up -d
  1. Create venv and install poetry
pip install  poetry
  1. Install requirements
poetry install
  1. Activate venv.
  2. Create migration
alembic upgrade head
  1. Create role for user
python commander.py user create-all-role
  1. Create the first user
python commander.py user create [email protected] qwertyneabfywfv8374vf admin adminx

Make file Commands

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  

commander.py

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


MIGRATIONS

Create a new migration

  • add model to app/core/aiembic_import.py
  • go into the app folder
    Run commands:
alembic revision --autogenerate -m "TEXT INFO"
alembic upgrade head

Create tables

Run commands:

 alembic upgrade head

Base Commands poetry

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

About

Start fastapi project with mongodb(motor+odamantic) + postgres(sqlalchemy) + redis

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages