Início Profile Projeto
Avatar de

Erick Gabriel Brunoro Mesquita

Challenge Back-End 3ª Edition

  • Python
  • Flask
  • Docker

Challenge Back-End 3ª Edition

Read this in other languages: Brazilian Portuguese

🪧 Vitrine.Dev
Nome Challenge Back-End 3ª Edition
🏷️ Tecnologias Python, Flask, Docker
🚀 URL https://challenge-backend-3-production.up.railway.app/login
🔥 Desafio https://www.alura.com.br/challenges/back-end-3

Web application to analyse and investigate financial transactions

Python 3.8 Teste with pytest Deploy with Docker Compose Status: Approved

Just upload your Spreadsheet or CSV file and have it analysed for suspicious transactions!

This project is split in Docker containers, to facilitate deployment and was submited and approved by Alura Teachers' Board in May 10 2022

Requirements

Features

  • 🔐 Access Control: Users CRUD with Login, Logout, Registration and Deletion of accounts
  • 📃 File upload: CSV and XML files with financial transactions data to be analysed
  • 💾 Database Storage: SQL Database Persistence
  • 🔬 Transactions Analysis: Investigation for fraudulent or suspicious transactions

🔐 Login

Only logged in users can access the system, upload files and generate analyses.

GIF showing user login

🔐 Signup

New users can only be registered by existing users. One of the project requirements is that a 6-digit numeric password is generated. The password is stored encrypted in the database with SHA512 and bcrypt

GIF showing new user account creation

🔬 Analysis

The following are considered suspects:

  • Transactions over BRL 100,000.00
  • Bank accounts that send or receive BRL 1,000,000.00 or more in the same month
  • Bank branches that send or receive BRL 1,000,000,000.00 or more in the same month

🛠️ Open and run the project

Go to https://challenge-backend-3-production.up.railway.app/login and see the service running!

Default user account is:

  • Login: Admin
  • Pass: 123999

or

  1. Clone this repository
  2. At the project's root folder, use the command python manage.py compose up --build to build the images and run the project

Optionally, you can add the environment variable APPLICATION_CONFIG to select the operating mode:

APPLICATION_CONFIG=testing python manage.py compose up

Modes of Operation

  • testing: Starts a database container without persistence. The flask application must run directly on the host, without containerization. This mode is especially useful for running pytest tests
  • development: Both the database and the application run in containers. Database data is stored on a volume on the host. The application code is brought in a volume from the host, so that with every change in the code, the server is automatically updated with the latest version.
  • production: Usage mode with additional security, which disables the Flask debugger. Gunicorn server is used for better production performance.

🛠️ Configuration

All project settings are together, to facilitate their change and deployment.

The environment variables used in the application and in the Docker containers are saved in JSON format, in the config folder.

Flask specific settings are in the application/config.py file

:man_technologist: Technologies used

:man_teacher:: Learning

This was my first project developing a complete Flask application from start to finish. I spent a lot more time reading documentation for Flask packages and plugins than actually writing code.

I learned that it is much easier to use a plug-in than trying to solve a big problem "by hand". There are many Flask plugins available to solve most problems that may arise.

Halfway through the project, I was forced to change the database from MySQL to PostgreSQL because the former is not compatible with the production computer architecture. I learned to always check in advance the compatibility of docker images and Python packages with all machines involved.

I learned to use SQLAlchemy to model and manipulate the database, including relationships and constraints. I also had to do several migrations during the project, and for that I had to learn how to use the Alembic package.