/cashbackgb

Primary LanguagePythonMIT LicenseMIT

Rest API for registering purchases and cashback consultation.

Python version Code Style Repository size Repository size GitHub last commit License

Status: Finished

AboutFeaturesDemoRunning the projectTech StackHow to contributeAuthorLicense

💻 About

Cashback GB - is an API project that aims to provide a backend for a web system where resellers can register their purchases and track the cashback return of each one.


⚙️ Features

API Routes:

✔️ Route to register a new reseller. (It's called user within API and database)
✔️ Route to validate a reseller login and obtain a JWT token.
✔️ Route to register a new purchase.
✔️ Route to edit a validating purchase.
✔️ Route to delete a purchase in validation.
✔️ Route to list registered purchases.
✔️ Route to display cashback accumulated so far. (Sum of purchases registered in the API + value from external API)

Technical resources:

✔️ Interactive documentation with OpenAPI (swagger)
✔️ Documentation with Redoc
✔️ JWT authentication
✔️ Unitary tests
✔️ Integration Tests (I chose to use the "tests trophy", if you don't know it you can see more about it here.)
✔️ Asynchronous database layer (both Postgres and SqLite)
✔️ Database Migrations
✔️ Dockerized application
✔️ CI/CD using AWS RDS, AWS ECR, AWS Lambda and AWS API Gateway and Serverless framework


👀 Demo

The application is available on AWS:

CashBack GB CashBack GB

🚀 Running the project

Pre-requisites

Before you begin, you will need to have the following tools installed on your machine:

Obs:

  • If an environment variable named APP_ENVIRONMENT is set to "PROD", the API by default will try to connect to a postgres database, otherwise it will create a sqlite database called temp.db in the project's root folder.
  • I'm assuming you already know and will follow these steps using a virtualenv. If you don't know, see more here.
Running locally
  1. Clone this repository:
    $ git clone https://github.com/wlsouza/cashbackgb.git
  2. Access the project folder cmd/terminal:
    $ cd cashbackgb
  3. Install the dependencies (step for Linux users only):
    $ make install-dev
  4. Install the dependencies (step for windows users only):
    $ pip install -r ./requirements.txt
    $ pip install -r ./requirements-dev.txt
  5. Run the application in development mode:
    $ uvicorn app.main:app
  6. The server will start at port: 8000 - see the docs
Running in docker
  1. Clone this repository:
    $ git clone https://github.com/wlsouza/cashbackgb.git
  2. Access the project folder cmd/terminal:
    $ cd cashbackgb
  3. Create a copy and rename the file "example.env" to ".env":
    $ cp example.env .env - (for Linux users)
    $ copy example.env .env - (for Windows users)
  4. Run the docker-compose in development mode:
    $ docker-compose build --no--cache && docker-compose up -d
  5. The server will start at port: 8000 - see the docs
Running tests
  1. Clone this repository:
    $ git clone https://github.com/wlsouza/cashbackgb.git
  2. Access the project folder cmd/terminal
    $ cd cashbackgb
  3. Install the dependencies (step for Linux users only)
    $ make install-dev
  4. Install the dependencies (step for windows users only)
    $ pip install -r ./requirements.txt
    $ pip install -r ./requirements-dev.txt
  5. Run the tests (step for Linux users only)
    $ make test
  6. Run the tests (step for windows users only)
    $ set APP_ENVIRONMENT="TEST"
    $ alembic upgrade head
    $ pytest app/tests/ -v --cov=app

🛠 Tech Stack

The following tools were used in the construction of the project:

Python + FastAPI

Dependences
Development Dependences

💪 How to contribute

  1. Fork the project.
  2. Create a new branch with your changes: git checkout -b my-feature
  3. Save your changes and create a commit message telling you what you did: git commit -m" feature: My new feature "
  4. Submit your changes: git push origin my-feature

🦸‍♂️ Autor


Wellington Lorenço de Souza
🚀

Linkedin Badge Gmail Badge


📝 License

This project is under the license MIT.