Developer productivity tool for making high-quality FastAPI production-ready APIs.
Project description
Documentation: https://fastapi-mvc.netlify.app
Source Code: https://github.com/rszamszur/fastapi-mvc
Example generated project: https://github.com/rszamszur/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 docstrings and 99% unit 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
- Reproducible development environment using Vagrant or Nix
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
[INFO] Executing shell command: ['/home/demo/.poetry/bin/poetry', 'install', '--no-interaction'].
Installing dependencies from lock file
No dependencies to install or update
Installing the current project: galactic-empire (0.1.0)
[INFO] Executing shell command: ['/home/demo/.poetry/bin/poetry', 'run', 'uvicorn', '--host', '127.0.0.1', '--port', '8000', '--reload', 'galactic_empire.app.asgi:application'].
INFO: Will watch for changes in these directories: ['/tmp/galactic-empire']
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO: Started reloader process [4713] using watchgod
INFO: Started server process [4716]
INFO: Waiting for application startup.
INFO: Application startup complete.
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
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:
- fastapi-mvc-example - Default generated project by
fastapi-mvc new ...
Contributing
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file fastapi-mvc-0.11.1.tar.gz
.
File metadata
- Download URL: fastapi-mvc-0.11.1.tar.gz
- Upload date:
- Size: 78.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a7da179398c16a3e9064ab30747c8209884ebc7780aaac0b617c09fc1fcbd72 |
|
MD5 | 65a311d55e2a7ab3c7d241dc70081e35 |
|
BLAKE2b-256 | c96fddda58f22daac993a4aab60badb1c2dca0aa8f78c57b436cd162c074807e |
File details
Details for the file fastapi_mvc-0.11.1-py3-none-any.whl
.
File metadata
- Download URL: fastapi_mvc-0.11.1-py3-none-any.whl
- Upload date:
- Size: 124.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 365635e259018331810cb273a9cad1a80624059fd4b5e67d1461c0a2c3a05651 |
|
MD5 | 30b40f8e30c030d220306c6797f026f8 |
|
BLAKE2b-256 | 18073ba012d3f117b3a928866295af8c22cbf476a345b6b4e1f343b62c100fb8 |