GithubHelp home page GithubHelp logo

fast-api-docker-use-case's Introduction

Overview

This is a stock screener app (taken from this youtube series https://www.youtube.com/watch?v=5GorMC2lPpk ) which was put together to learn about:

  1. FastAPI - https://fastapi.tiangolo.com/
  2. Docker - https://www.docker.com/
  3. Docker Compose - https://docs.docker.com/compose/

The idea was to take the API produced by following the above youtube series but to dockerize the application and the dataabse.

The use case is just a nice use case for CRUD operations but not a main part of the project - the idea is to add stock symbols to the database from a POST request, then grab some details fron yahoo finance to update the database with extra data. A GET request should list all the symbols in the database.

Next steps:

  1. Improve the business logic behind the API calls too be more inline with clean architecture https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html
  2. Implement react front end.
  3. Once front end is implemented, add service workers to allow extra long running tasks.

Running

  1. Set the following environment variables:

    POSTGRES_PASSWORD=<some passwoord>
    PGDATA=<some volume on local machine to persiist DB data>
    DB_NAME=<name of DB - default `postgres`>
    DB_PORT=<postgreSQL port - default 5432>
  2. Make the run.sh file executable and run it.

    chmod x run.sh
    ./run.sh

    This will build the API image (for FastAPI) and run 2 containers for the API and DB together.

    If you want to create a new DB you can use the psql utility either frm the host machine or within the container:

    Host Machine

    psql -h localhost -p 5432 -U postgres
    create database <DB name - this will need to be updated in the DB_NAME env variable>

    Container

    doocker exec -it postgres psql -U postgres

fast-api-docker-use-case's People

Contributors

m-o-leary avatar

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.