Giter VIP home page Giter VIP logo

fastapi-bank's Introduction

Bank

This is a simple bank application that allows a user to create an account, deposit money, withdraw money, and view their balance.

The architecture of the application is mix of layered architecture and Clean Architecture. The application is divided into layers:

  • domain - contains the business logic
  • application - contains the use cases
  • infrastructure - contains database implementation, migrations and web framework implementation.
  • presentation - contains the API endpoints

The app is covered with tests using pytest, and the coverage is 100% (with some exceptions, such as migrations, configurations).

Technologies used:

  • FastAPI (and Pydantic, SQLAlchemy, and Alembic, Asyncpg)
  • PostgreSQL
  • Docker
  • Docker-compose

Available endpoints:

  • GET /accounts/ - get all accounts

  • POST /accounts/ - create an account

  • PATCH /accounts/{account_id}/ - update an account

  • DELETE /accounts/{account_id}/ - delete an account

  • GET /accounts/{account_id}/balance/ - get the balance

  • GET /accounts/{account_id}/transactions/ - get account transactions

  • POST /accounts/{account_id}/deposit/ - deposit money to account

  • POST /accounts/{account_id}/withdraw/ - withdraw money from account

  • POST /accounts/{account_id}/transfer/ - transfer money to another account

  • GET /transactions/ - get all transactions (history of all transactions)

How to run the application (docker-compose)

To run the application, you need to have docker and docker-compose installed on your machine. If you don't have it installed, you can download it from here.

After you have docker and docker-compose installed, you can clone the repository with:

  git clone https://github.com/iza-w/fastapi-bank.git

Then you can run the application with:

  docker compose up -d 
  make migrate-docker  # run migrations

And that's it! The application is running on http://localhost:8000.

To stop the application, you can run:

  docker compose down

How to see the application in action

Open your browser and go to http://localhost:8000/docs. You will see the FastAPI Swagger UI where you can test the application.

You can also use the redoc UI by going to http://localhost:8000/redoc.

fastapi-bank's People

Contributors

iza-w avatar

Watchers

 avatar

Forkers

w-wajda

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.