/fastapi-challenge

REST API for a Loan Amortization

Primary LanguagePythonGNU Affero General Public License v3.0AGPL-3.0

FastAPI Logo

This challenge demonstrates a REST API for a Loan Amortization app using the Python miniframework FastAPI.

It provides sereral key features:

  • Create a user

  • Create a loan

  • Fetch loan schedule

  • Fetch loan summary for a specific month

Quick Start

Requirements

  • Python >= 3.8.1
  • Poetry
  • Database migrations
  • Docker
# Clone repository
$ git clone https://github.com/danielnegri/fastapi-challenge.git

# Install dependencies
$ pip3 install poetry
$ poetry use env 3.8
$ poetry shell
$ poetry install

Database Migrations:

$ export PYTHONPATH=$PWD

# Create database
$ alembic upgrade heads

# Seed database, create superuser
$ python app/pre_start.py # Create admin user

Running the live server

See Fast API: First Steps for instructions on setting up a local development environment.

$ uvicorn app.main:app --reload

Running the live server with Docker

$ docker build --rm --progress=plain -t fastapi-challenge .
$ docker run -it --rm -p 8000:80 fastapi-challenge
$ open http://localhost:8000/docs

How-To

For a more complete example including how to create users, loans and schedules, see the Tutorial - User Guide.

Contributing

See CONTRIBUTING for details on submitting patches and the contribution workflow.

License

This repository is under the AGPL 3.0 license. See the LICENSE file for details.