{"id":19199000,"url":"https://github.com/liemtv96/FastAPI-Kafka-MongoDB-OpenAI","last_synced_at":"2026-06-23T20:30:18.568Z","repository":{"id":242336781,"uuid":"808956062","full_name":"riottecboi/FastAPI-Kafka-MongoDB-OpenAI","owner":"riottecboi","description":"Create a scalable FastAPI application that serves an endpoint to recommend things to do in a given country during a specific season by consulting the OpenAI API, store the results in MongoDB.","archived":false,"fork":false,"pushed_at":"2024-06-12T05:59:21.000Z","size":23244,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-04T11:29:24.393Z","etag":null,"topics":["docker","docker-compose","fastapi","kafka","mongodb","openai","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/riottecboi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-01T09:12:26.000Z","updated_at":"2024-06-12T15:25:37.000Z","dependencies_parsed_at":"2024-06-02T10:53:22.151Z","dependency_job_id":"8959cb4a-a6fb-4f53-a998-4cd273aec470","html_url":"https://github.com/riottecboi/FastAPI-Kafka-MongoDB-OpenAI","commit_stats":null,"previous_names":["riottecboi/fastapi-kafka-mongodb-openai"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riottecboi%2FFastAPI-Kafka-MongoDB-OpenAI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riottecboi%2FFastAPI-Kafka-MongoDB-OpenAI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riottecboi%2FFastAPI-Kafka-MongoDB-OpenAI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riottecboi%2FFastAPI-Kafka-MongoDB-OpenAI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/riottecboi","download_url":"https://codeload.github.com/riottecboi/FastAPI-Kafka-MongoDB-OpenAI/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240271536,"owners_count":19774859,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-compose","fastapi","kafka","mongodb","openai","python3"],"created_at":"2024-11-09T12:25:15.639Z","updated_at":"2026-06-23T20:30:18.509Z","avatar_url":"https://github.com/riottecboi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FastAPI-Kafka-MongoDB-OpenAI\n\nCreate a scalable FastAPI application that serves an endpoint to recommend three things to do in a given country during a specific season by consulting the OpenAI API. \n\nAdditionally, integrate a distributed component for background processing to handle the OpenAI API calls asynchronously, store the results in MongoDB, and signal completion. \n\n\u003cimg src=\"demo/screenshots/demo.gif\" alt=\"demo\"\u003e\n\n## Installation \u0026 Usage\n\nThis project running on Python 3.11, so please be sure that you are install Python 3.11 on your machine\n\n````bash\nsudo add-apt-repository ppa:deadsnakes/ppa\nsudo apt update \nsudo apt install python3.11\n`````\n\nUse the package manager [pip](https://pip.pypa.io/en/stable/)\n\n````bash\nsudo apt-get install python3-pip\n`````\n\n````bash\npython3.11 -m pip install virtualenv\npython3.11 -m venv \u003cvirtual-environment-name\u003e\n`````\n\nactivate the virtual environment\n\n````bash\nsource \u003cvirtual-environment-name\u003e/bin/activate\n`````\nto install packages.\n\n```bash\npython3.11 -m pip install -r requirements.txt \n```\n\nTo run this project, you will need to add the following environment variables to your `app/core/config.py` or `app/core/settings.cfg` file\n\n- `KAFKA_BOOTSTRAP_SERVERS`\n- `KAFKA_TOPIC`\n- `MONGODB_URI`\n- `MONGODB_DATABASE`\n- `OPENAI_KEY`\n\n\nRunning a script\n\n```bash\n# Run a uvicorn service to serve FastAPI \nuvicorn main:app --host 0.0.0.0 --port 3000\n\n# Run a background worker\npython3.11 background-worker.py\n```\n\n## Docker\n\n\u003cimg src=\"demo/screenshots/docker.png\" alt=\"docker\"\u003e\n\nIn the project, I have declared [docker compose](https://docs.docker.com/compose/install/linux/#install-using-the-repository) file to create Kafka Zookeeper/Kafka/MongoDB services\n\n````bash\ndocker-compose -f docker-compose.yml up -d\n```````\n\nwhen all the containers are up, we need to check for the network name which being used to run with those services\n\n````bash\ndocker network ls\n```````\n\n```bash\ndocker build -f docker/Dockerfile -t \u003ccontainer-name\u003e .\ndocker run --name fastapi-app --network \u003cname-of-network-found-above\u003e -p 3000:8000 \u003ccontainer-name\u003e -d\n```\n\nNow, the FastAPI run on port 3000 at your machine\n\n\u003cimg src=\"demo/screenshots/logs.png\" alt=\"docker\"\u003e\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliemtv96%2FFastAPI-Kafka-MongoDB-OpenAI","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliemtv96%2FFastAPI-Kafka-MongoDB-OpenAI","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliemtv96%2FFastAPI-Kafka-MongoDB-OpenAI/lists"}