API using FastAPI and PostgreSQL to create and share or keeping track of awesome food recipes. Our API have aslo a Crud System Using JWT and Oauth2 to Create a Complete API that Can Be Used with a High Quality Frontend Project. β
- To start using ChefAPI You need some experience in Cuisine maybe how to create a Moroccan
CousCous
orTajine
.
- Python 3.8.6 or higher
- PostgreSQL
- FastAPI
- Docker
# clone the repo
$ git clone https://github.com/GDGSNF/ChefAPI
# move to the project folder
$ cd ChefAPI
- Install
pipenv
a global python projectpip install pipenv
- Create a
virtual environment
for this project
# creating pipenv environment for python 3
$ pipenv --three
# activating the pipenv environment
$ pipenv shell
# if you have multiple python 3 versions installed then
$ pipenv install -d --python 3.8
# install all dependencies (include -d for installing dev dependencies)
$ pipenv install -d
- Using SQLAlchemy to Connect to our PostgreSQL Database
- Containerization The Database.
- Drop your PostgreSQL Configuration at the
.env.sample
and Don't Forget to change the Name to.env
# example of Configuration for the .env file
POSTGRES_SERVER = localhost
POSTGRES_USER = root
POSTGRES_PASSWORD = password
POSTGRES_DB = ChefAPI
- To run the Main we need to use uvicorn a lightning-fast ASGI server implementation, using uvloop and httptools.
# Running the application using uvicorn
$ uvicorn main:app
# To run the Application under a reload enviromment use -- reload
$ uvicorn main:app --reload
- We have the Dockerfile created in above section. Now, we will use the Dockerfile to create the image of the FastAPI app and then start the FastAPI app container.
$ docker build
- list all the docker images and you can also see the image
chefapi:latest
in the list.
$ docker images
- run the application at port 5000. The various options used are:
-p
: publish the container's port to the host port.-d
: run the container in the background.-i
: run the container in interactive mode.-t
: to allocate pseudo-TTY.--name
: name of the container
$ docker container run -p 5000:5000 -dit --name ChefAPI chefapi:latest
- Check the status of the docker container
$ docker container ps
Includes preconfigured packages to kick start ChefAPI by just setting appropriate configuration.
Package | Usage |
---|---|
uvicorn | a lightning-fast ASGI server implementation, using uvloop and httptools. |
Python-Jose | a JavaScript Object Signing and Encryption implementation in Python. |
SQLAlchemy | is the Python SQL toolkit and Object Relational Mapper that gives application developers the full power and flexibility of SQL. |
starlette | a lightweight ASGI framework/toolkit, which is ideal for building high performance asyncio services. |
passlib | a password hashing library for Python 2 & 3, which provides cross-platform implementations of over 30 password hashing algorithms |
bcrypt | Good password hashing for your software and your servers. |
python-multipart | streaming multipart parser for Python. |
yapf
packages for linting and formatting
- Join the ChefAPI Creator and Contribute to the Project if you have any enhancement or add-ons to create a good and Secure Project, Help any User to Use it in a good and simple way.
This project is licensed under the terms of the MIT license.