Skip to content

A pdf parsing web application. FastAPI + Redis + Docker.

License

Notifications You must be signed in to change notification settings

jabertuhin/fastapi-with-redis

Repository files navigation

Description

A pdf parsing web application. [ Deatils will be added as I go with the development. ]

NOTE: Still a lot of work needs to be done to complete this project. Such as -

  • writing tests to achieve good coverage.
  • having meaningful work done by endpoints.
  • storing api-keys in postgresql.
  • kubernetes deployment.

Update: 14th August, 2021

API Rate Limit Feature Added.

Details: /pdf/extract endpoint can be access via a valid API_KEY. A user with valid API_KEY can access this endpoint 20 times per minute. If he crosses the limit, he won't be able to access the endpoint any longer and have to wait for the next term.

feature specific branch: task/jabertuhin/api-rate-limiter-with-redis

How to run locally (on linux machine)

step 1: Clone this repository into your local machine.

git clone https://github.com/jabertuhin/fastapi-with-redis.git

step 2: Enter into project root directory and create virtual environment. And activate it.

cd fastapi-with-redis
virtualenv venv
source venv/bin/activate

step 3: Installing application dependencies(including test dependencies).

make dev_setup

step 4: Run redis server with docker. (Assuming docker daemon is running.) This may take some time, depending on redis docker image availability on your pc.

docker run -p 6379:6379 redis

step 5: Run fastapi application with gunicorn server from project root(gunicorn doesn't run on windows machine).

make server

step 6: From your web browser visit http://0.0.0.0:8080/docs and this will load swagger UI.

To access /health endpoint, you won't need any input or api_key.

But to access /pdf/extract endpoint, you need to provide valid api_key.

valid api keys: ["x189-0sf0", "0nmsd82sdf", "0ijnsd89"]

In the top right corner, you will see a Authorize button, and clicking it will promt a input form like this -

Provide valid api-key to get successful response, and to check authentication you can provide random api-keys.

NOTE: This api-key checking is a dummy implementation.

References

PostgreSQL, SqlAlchemy


Redis

Logging

About

A pdf parsing web application. FastAPI + Redis + Docker.

Topics

Resources

License

Stars

Watchers

Forks