Git Product home page Git Product logo

fastapi-mvc-boilerplate's Introduction

๐Ÿงฐ fastapi-mvc-boilerplate

A sample FastAPI project implemented using the MVC Pattern.

๐Ÿ’ก Features

  • [โœ”๏ธ] MIT License
  • [โœ”๏ธ] FastApi + SQLAlchemy
  • [โœ”๏ธ] Class Based Controller with fastapi-router-controller
  • [โœ”๏ธ] Tests with unittest
  • [โœ”๏ธ] Dockerfile with tiangolo/uvicorn-gunicorn-fastapi:python3.8
  • [โœ”๏ธ] Configuration management with Environment Variables Interpolation
  • [โœ”๏ธ] Centralized logging management
  • [โœ”๏ธ] Log requests end-time
  • [โœ”๏ธ] Formatted Exception Handler
  • [โœ”๏ธ] Validation Exception Handler
  • [โœ”๏ธ] Vscode dotfiles preconfigured
  • [โœ”๏ธ] GitHub action for unit tests on PR
  • [โœ”๏ธ] Sample Gunicorn Configuration

๐Ÿ”จ How to use

  • Clone this repository or download it. Customize!
  • Just click on 'Use this template' button on GitHub page

๐ŸŒž How to start app

First install the dependencies

pip install -r requirements.txt

๐Ÿ“˜ If you are using VSCode

I included in the repository the VSCode configuration for tasks and debugging.

So, you can just use the VSCode shortcut to start the application:

  • Start FastApi
  • Start FastApi with Gunicorn

There are also two debug configurations:

  • Debug FastApi
  • Debug Python Current File

See more about VScode Tasks and Debug.

โœ‹ Manually

  • Start with unicorn
pip install unicorn
uvicorn server/main:app --reload
  • Start with gunicorn
pip install gunicorn
gunicorn server/main:app --config gunicorn_conf.py

๐Ÿ”จ How to run tests

Install tests requirements

pip install -r tests/requirements.txt

Run

python3 -m unittest discover -s tests -p '*_test.py'

๐Ÿ“” Notes

I am open to suggestions and criticisms, please, if something seems wrong or can be improved, tell it through an issue on the project

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.