About • Features • Demo • Running the project • Tech Stack • How to contribute • Author • License
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.
✔️ 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)
✔️ 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
The application is available on AWS:
Before you begin, you will need to have the following tools installed on your machine:
- Git
- Python.
- In addition, it is good to have an editor to work with the code like VSCode
- And if you want to run using containers you will need Docker and Docker Compose.
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
- Clone this repository:
$ git clone https://github.com/wlsouza/cashbackgb.git
- Access the project folder cmd/terminal:
$ cd cashbackgb
- Install the dependencies (step for Linux users only):
$ make install-dev
- Install the dependencies (step for windows users only):
$ pip install -r ./requirements.txt
$ pip install -r ./requirements-dev.txt
- Run the application in development mode:
$ uvicorn app.main:app
- The server will start at port: 8000 - see the docs
Running in docker
- Clone this repository:
$ git clone https://github.com/wlsouza/cashbackgb.git
- Access the project folder cmd/terminal:
$ cd cashbackgb
- 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)- Run the docker-compose in development mode:
$ docker-compose build --no--cache && docker-compose up -d
- The server will start at port: 8000 - see the docs
Running tests
- Clone this repository:
$ git clone https://github.com/wlsouza/cashbackgb.git
- Access the project folder cmd/terminal
$ cd cashbackgb
- Install the dependencies (step for Linux users only)
$ make install-dev
- Install the dependencies (step for windows users only)
$ pip install -r ./requirements.txt
$ pip install -r ./requirements-dev.txt
- Run the tests (step for Linux users only)
$ make test
- Run the tests (step for windows users only)
$ set APP_ENVIRONMENT="TEST"
$ alembic upgrade head
$ pytest app/tests/ -v --cov=app
The following tools were used in the construction of the project:
Development Dependences
- Fork the project.
- Create a new branch with your changes:
git checkout -b my-feature
- Save your changes and create a commit message telling you what you did:
git commit -m" feature: My new feature "
- Submit your changes:
git push origin my-feature
Wellington Lorenço de Souza 🚀
This project is under the license MIT.