Skip to content

ArturLinnik/fastapi-microservice-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Fastapi Microservice Template

This is a template for creating microservices with FastAPI.

Description

This template uses cookiecutter for creating the project and provides a basic directory structure to create microservices, separating routers and API versioning.

The dependencies are handled with poetry with fastapi and uvicorn packages pre-defined.

Getting Started

Dependencies

  • Linux
  • python
  • poetry
  • cookiecutter

Installing

Once cookiecutter is installed, you can download this repository with it:

cookiecutter [email protected]:ArturLinnik/fastapi-microservice-template.git

Then, after filling the different fields that cookiecutter needs, you have to enter to the new directory

cd <directory-name>

give permissions of execution to setup.sh

chmod +x setup.sh

execute setup.sh and enter the virtual environment

./setup.sh && source .venv/bin/activate

Executing program

In order to execute the example of the template you can run python3 run.py.

Then, you can verify that it is working by opening in the browser http://localhost:8000/docs.

Help

  • If you haven't configured ssh in your machine you can use cookiecutter with HTTPS

  • You can install cookiecutter with:

pip install cookiecutter
  • If cookiecutter is not in yout PATH you can either add it to your PATH
PATH=$PATH:$HOME/.local/bin

or use it like:

python -m cookiecutter ...

This way you will need to repeat the command every time you enter a new terminal, for avoiding that, you can put it in your .zshrc or your .bashrc.

Authors

About

This is a template for creating microservices with FastAPI.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published