CLI Reference¶
fastapi-mvc¶
Developer productivity tool for making high-quality FastAPI production-ready APIs.
Documentation: https://fastapi-mvc.netlify.app
Source: https://github.com/fastapi-mvc/fastapi-mvc
fastapi-mvc [OPTIONS] COMMAND [ARGS]...
Options
- -v, --verbose¶
Enable verbose logging.
generate¶
The ‘fastapi-mvc generate’ commands runs a generator of your choice for a fastapi-mvc project at the current working directory.
fastapi-mvc generate [OPTIONS] GENERATOR [ARGS]...
controller¶
Creates a new controller and its endpoints. Pass the controller name under_scored, and a list of endpoints as arguments.
This generates a controller file in app/controllers with unit test file. Finally, edits config/router.py in order to add controller to FastAPI router.
Generator template used: https://github.com/fastapi-mvc/copier-controller
fastapi-mvc generate controller [OPTIONS] NAME [ENDPOINTS]...
Options
- -R, --skip-routes¶
Do not add router entry to app/router.py.
Arguments
- NAME¶
Required argument
- ENDPOINTS¶
Optional argument(s)
Example: fastapi-mvc generate controller stock_market ticker buy:post sell:delete
Or using short-cut alias: fm g ctl stock_market ticker buy:post sell:delete
- Creates controller with URLs like /stock_market/ticker.
Controller: app/controllers/stock_market.py Test: tests/unit/app/controllers/test_stock_market.py
generator¶
Creates a new generator at lib/generators. Pass the generator name under_scored.
Generator template used: https://github.com/fastapi-mvc/copier-generator
fastapi-mvc generate generator [OPTIONS] NAME
Options
- -N, --skip-nix¶
Skip nix expression files.
- -G, --skip-actions¶
Skip GitHub actions files.
- --license <license>¶
Choose license.
- Default:
MIT- Options:
MIT | BSD2 | BSD3 | ISC | Apache2.0 | LGPLv3+ | LGPLv3 | LGPLv2+ | LGPLv2 | no
- --repo-url <repo_url>¶
New project repository url.
Arguments
- NAME¶
Required argument
Environment variables
- REPO_URL
Provide a default for
--repo-url
Example: fastapi-mvc generate generator awesome
Or using short-cut alias: fm g gen awesome
- creates a standard awesome generator:
lib/generators/awesome/.github lib/generators/awesome/.github/dependabot.yml lib/generators/awesome/.github/workflows/update-flake.yml lib/generators/awesome/.envrc lib/generators/awesome/.gitignore lib/generators/awesome/CHANGELOG.md lib/generators/awesome/LICENSE lib/generators/awesome/README.md lib/generators/awesome/__init__.py lib/generators/awesome/template lib/generators/awesome/template/{{package_name}} lib/generators/awesome/template/{{package_name}}/hello_world.py lib/generators/awesome/update.sh lib/generators/awesome/flake.nix lib/generators/awesome/flake.lock lib/generators/awesome/.generator.yml lib/generators/awesome/awesome.py
script¶
Creates an executable shell script scaffold at the current working directory.
Generator template used: https://github.com/fastapi-mvc/copier-script
fastapi-mvc generate script [OPTIONS] NAME
Options
- -n, --use-nix¶
Use nix-shell (shebang header).
Arguments
- NAME¶
Required argument
Example: fastapi-mvc generate script example.sh
Or using short-cut alias: fm g ss example.sh
- creates an executable file:
example.sh
new¶
The ‘fastapi-mvc new’ command creates a new FastAPI application with a default directory structure and configuration at the path you specify.
Default Project template used: https://github.com/fastapi-mvc/copier-project
fastapi-mvc new [OPTIONS] APP_PATH
Options
- -R, --skip-redis¶
Skip Redis utility files.
- -A, --skip-aiohttp¶
Skip aiohttp utility files.
- -H, --skip-helm¶
Skip Helm chart files.
- -G, --skip-actions¶
Skip GitHub actions files.
- -I, --skip-install¶
Do not run make install after project generation.
- -N, --skip-nix¶
Skip nix expression files.
- --license <license>¶
Choose license.
- Default:
MIT- Options:
MIT | BSD2 | BSD3 | ISC | Apache2.0 | LGPLv3+ | LGPLv3 | LGPLv2+ | LGPLv2 | no
- --repo-url <repo_url>¶
New project repository url.
- -n, --no-interaction¶
Do not ask any interactive question.
- --use-repo <use_repo>¶
Overrides fastapi-mvc copier-project repository.
- --use-version <use_version>¶
The branch, tag or commit ID to checkout after clone.
Arguments
- APP_PATH¶
Required argument
Environment variables
- REPO_URL
Provide a default for
--repo-url
Example: fastapi-mvc new ~/apis/Skynet
This generates a skeletal fastapi-mvc project in ~/apis/Skynet.
run¶
The ‘fastapi-mvc run’ commands runs development uvicorn server for a fastapi-mvc project at the current working directory.
fastapi-mvc run [OPTIONS]
Options
- --host <host>¶
Host to bind.
- Default:
127.0.0.1
- -p, --port <port>¶
Port to bind.
- Default:
8000
- -i, --install¶
Run poetry install.
update¶
The ‘fastapi-mvc update’ commands updates already generated project with the changes from new template version.
fastapi-mvc update [OPTIONS]
Options
- -n, --no-interaction¶
Do not ask any interactive question.
- -p, --pretend¶
Run but do not make any changes.
- --use-version <use_version>¶
The branch, tag or commit ID to checkout after clone.