Skip to main content

Developer productivity tool for making high-quality FastAPI production-ready APIs.

Project description

fastapi-mvc

fastapi-mvc CI ❄️ Nix CI ❄️ codecov K8s integration Code style: black PyPI PyPI - Downloads PyPI - Python Version GitHub


Documentation: https://fastapi-mvc.netlify.app

Source Code: https://github.com/fastapi-mvc/fastapi-mvc

Project scaffold: https://github.com/fastapi-mvc/copier-project

Example generated project: https://github.com/fastapi-mvc/example


Fastapi-mvc is a developer productivity tool for FastAPI web framework. It is designed to make programming FastAPI applications easier by making assumptions about what every developer needs to get started. It allows you to write less code while accomplishing more. Core features:

  • Generated project based on MVC architectural pattern
  • WSGI + ASGI production server
  • Generated project comes with Sphinx documentation and 100% tests coverage
  • Kubernetes deployment with Redis HA cluster
  • Makefile, GitHub actions and utilities
  • Helm chart for Kubernetes deployment
  • Dockerfile with K8s and cloud in mind
  • Generate pieces of code or even your own generators
  • Uses Poetry dependency management
  • Includes set of Nix expressions
  • Update already generated project with changes from the new template version
  • Virtualized reproducible development environment using Vagrant

Fastapi-mvc comes with a number of scripts called generators that are designed to make your development life easier by creating everything that’s necessary to start working on a particular task. One of these is the new application generator, which will provide you with the foundation of a fresh FastAPI application so that you don’t have to write it yourself.

Creating a new project is as easy as:

$ fastapi-mvc new /tmp/galactic-empire

This will create a fastapi-mvc project called galactic-empire in a /tmp/galactic-empire directory and install its dependencies using make install.

Once project is generated and installed lets run development uvicorn server (ASGI):

$ cd /tmp/galactic-empire
$ fastapi-mvc run

To confirm it’s actually working:

$ curl 127.0.0.1:8000/api/ready
{"status":"ok"}

Now let's add new API endpoints. For that we need to generate new controller:

$ fastapi-mvc generate controller death_star status load:post fire:delete

And then test generated controller endpoints:

$ curl 127.0.0.1:8000/api/death_star/status
{"hello":"world"}
$ curl -X POST 127.0.0.1:8000/api/death_star/load
{"hello":"world"}
$ curl -X DELETE 127.0.0.1:8000/api/death_star/fire
{"hello":"world"}

You will see it working in server logs as well:

INFO:     127.0.0.1:47284 - "GET /api/ready HTTP/1.1" 200 OK
INFO:     127.0.0.1:55648 - "GET /api/death_star/status HTTP/1.1" 200 OK
INFO:     127.0.0.1:55650 - "POST /api/death_star/load HTTP/1.1" 200 OK
INFO:     127.0.0.1:55652 - "DELETE /api/death_star/fire HTTP/1.1" 200 OK

You can get the project directly from PyPI:

pip install fastapi-mvc

Or build with Nix from flake:

# Optionally setup fastapi-mvc Nix binary cache to speed up the build process
# https://app.cachix.org/cache/fastapi-mvc#pull
nix-env -iA cachix -f https://cachix.org/api/v1/install
cachix use fastapi-mvc
# Install with Nix from flake:
nix build github:fastapi-mvc/fastapi-mvc#default --profile $HOME/.nix-profile

Projects created with fastapi-mvc

If you have created a project with fastapi-mvc, feel free to open PR and add yourself to the list. Share your story and project. Your success is my success :)

Projects:

Contributing

CONTRIBUTING

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastapi_mvc-0.27.0.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

fastapi_mvc-0.27.0-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

Details for the file fastapi_mvc-0.27.0.tar.gz.

File metadata

  • Download URL: fastapi_mvc-0.27.0.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for fastapi_mvc-0.27.0.tar.gz
Algorithm Hash digest
SHA256 1730267ed75bdf906ea4b847fc9ebec91c2844212ac97361dc0e038fcfc5f3b3
MD5 02ce19e03c9b49b0b830ae24b8eefa69
BLAKE2b-256 30bb55bf27ab063224da6de3387fff92684318d6ce94ad84a56bbfcc233b62f9

See more details on using hashes here.

File details

Details for the file fastapi_mvc-0.27.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fastapi_mvc-0.27.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bc7cea9518156121851e631d94824214b36c122b613150f1d2d26c32b7d564be
MD5 04c4ad748c067f440c686bd7d7ccbc49
BLAKE2b-256 f5a5525bda9969fbdbea39cb75a7b1e92a1568bc7d99e3a0b419b3401db2fa6f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page