Skip to content

triaxtec/fastapi-serverless-cookiecutter

Repository files navigation

fastapi-serverless-cookiecutter

If you are viewing this on GitHub, I recommend you check out the hosted docs instead as not everything here is in standard Markdown.

!!!warning While this cookiecutter is functional as-is, the documentation for this project is far from complete.

For generating FastAPI projects to be hosted on AWS Lambda using the Serverless framework. Includes everything that Triax uses for its internal projects like:

  1. CI/CD with CircleCI
  2. Private PyPI repos (e.g. on [Gemfury])
  3. Generation of Angular client libraries using OpenAPI Generator
  4. A bunch of security best-practices

Usage

  1. Install cookiecutter. I recommend installing with pipx like pipx install cookiecutter.
  2. Run this cookiecutter with cookiecutter gh:triaxtec/fastapi-serverless-cookiecutter
  3. Fill in the variables!

!!!warning Running a cookiecutter executes arbitrary Python code. Only run cookiecutters than you trust!

Variables

When you run this cookiecutter, you will be prompted to provide all of these values:

package_name

The name of the Python-installable package and top level directory that will be generated. By convention, this should be in kebab-case where each word is separated by a "-".

module_name

The name of the module where all your Python source code will go. This one should be snake_case where each word is separated by an underscore. The default is the same as package_name but in snake_case.

pypi_url

The URL to your private PyPI repository. If you aren't using one, you can leave this at the default. You'll have to remove the relevant pieces of pyproject.toml and CircleCI Config.

npm_url

The URL to your private NPM repository. If you aren't using one, you can leave this at the default. You'll have to remove the relevant pieces of Angular Client Config and CircleCI Config.

Now what?

  1. Explore the generated example in GitHub or generate your own and start playing!
  2. See Next Steps for setting up CircleCI, AWS, etc. to work with it.
  3. Check out What You Get for a walkthrough of everything that will be generated by this cookiecutter.

{!./hyperlinks.md!}