Giter VIP home page Giter VIP logo

fastapi_postgres_starter's Introduction

FastAPI+Postgres Starter

Building the project

The project runs using docker-compose and mounts the codebase in a volume inside the container. This allows for live reloading using uvicorn --reload.

To get started:

  1. docker-compose build
  2. docker-compose up

To migrate the database:

By default, the postgres db is created inside a container. The default credentials are set in local.env and are:

POSTGRES_PASSWORD=admin
POSTGRES_USER=development_user
POSTGRES_DB=development

To get started with a sample database, you can use the northwind traders dataset, a popular test/demo database published by microsoft. Once the app is up, run: ./seed_local_db

Project structure

The src dir contains all the code. app.py holds the main fastapi instance and config reads the env vars and exposes them in python. Each component or subservice should have its own directory inside src, including an apirouter to bind to fastapi, models, db access code, etc.

Running in prod

The project is designed to get started locally on docker. To host in prod, you'll need a hosted, durable postgres instance. You can build the api container for use on kubernetes or something like fly.io.

fastapi_postgres_starter's People

Watchers

 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.