FastApi App that implements User Authentication, 2FA, role based access, user activity logs, monitoring via Prometheus and Grafana, containerization via docker-compose, and CRUD operations via SQLAlchemy
To run the project locally, follow these steps:
-
Clone the repository:
git clone https://github.com/sultanalieva-s/secure-auth-api.git cd secure-auth-api
-
Build and run docker containers:
docker-compose build docker-compose up
-
Access the application:
Open your browser and visit
http://127.0.0.1:8080/
to see the app running locally.
Swagger is available athttp://127.0.0.1:8080/docs/
.
This project uses MySQL for storing data. Some notes about migrations:
-
Migrations via Alembic (in case IF you have new changes to db models):
- Enter container's bash:
docker exec -it <container_id> bash
- Generate migration
alembic revision --autogenerate -m 'MIGRATION DESCRIPTION'
- Generate migration
alembic upgrade head
-
Create Admin :
- Enter container's bash:
docker exec -it <container_id> bash
- Run create_admin.py script
python3 create_admin.py
The project includes monitoring tools to keep track of errors, performance, and health of the application. Follow the setup instructions below:
-
Prometheus and Grafana:
- Prometheus is available at http://localhost:9090/ .
- Grafana is available at http://localhost:3000/. Use credentials: admin admin