Skip to content

This fork is a backend for an application with registration and verification, implementation using FastAPI + MySQL and Docker.

Notifications You must be signed in to change notification settings

Misha-Mayskiy/UserAuthVerification

 
 

Repository files navigation

FastAPI Authentification/Verification + MySQL

APIs

image

Installation & Configuration

  • Install the Docker Desktop and Start It.
  • Clone this repository in your local machine.
  • Open the Terminal and navigate to the project folder.
  • Run docker volume create describly_mysql_data to create a docker volue in you machine. Required to persist the mysql data.
  • Below will be your mysql connection details.
MYSQL_HOST=mysql
MYSQL_USER=root
MYSQL_PASSWORD=Describly&123
MYSQL_DB=fastapi
MYSQL_PORT=3306

Building the Project

  • We can start building our projects by running docker-compose build
  • One build is done, run docker-compose up to start the services. Leave this terminal open to check the logs.
  • To stop the services you can press Ctrl + C - (Control + C)

Accessing the Docker Containers

Commands

  • To Generate the Migration From Model
docker-compose run fastapi-service /bin/sh -c "alembic revision --autogenerate -m "create my table table""
  • To Apply the Migration to Database
docker-compose run fastapi-service /bin/sh -c "alembic upgrade head"
  • To Revert last applied migration
docker-compose run fastapi-service /bin/sh -c "alembic downgrade -1"
  • To Run the Test
docker-compose run fastapi-service /bin/sh -c "pytest"
  • Display the info logs in the test
docker-compose run fastapi-service /bin/sh -c "pytest --log-cli-level=INFO"
  • Running a single test file
docker-compose run fastapi-service /bin/sh -c "pytest tests/test_folder/test_file.py"

About

This fork is a backend for an application with registration and verification, implementation using FastAPI + MySQL and Docker.

Resources

Stars

Watchers

Forks

Languages

  • Python 91.3%
  • HTML 6.8%
  • Mako 1.1%
  • Dockerfile 0.8%