{"id":17245384,"url":"https://github.com/breezewhite/simple-fastapi","last_synced_at":"2025-10-24T04:50:40.187Z","repository":{"id":112911465,"uuid":"389130576","full_name":"BreezeWhite/simple-fastapi","owner":"BreezeWhite","description":"A simple and minimum FastAPI template, coodernated with Celery for distributed, computation heavy tasks.","archived":false,"fork":false,"pushed_at":"2021-07-25T11:18:47.000Z","size":10,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-05T14:22:12.089Z","etag":null,"topics":["api-server","celery","distributed-computing","fastapi","fastapi-template","rabbitmq"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BreezeWhite.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2021-07-24T15:20:06.000Z","updated_at":"2024-10-03T02:41:29.000Z","dependencies_parsed_at":"2023-06-01T06:16:18.266Z","dependency_job_id":null,"html_url":"https://github.com/BreezeWhite/simple-fastapi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/BreezeWhite/simple-fastapi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BreezeWhite%2Fsimple-fastapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BreezeWhite%2Fsimple-fastapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BreezeWhite%2Fsimple-fastapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BreezeWhite%2Fsimple-fastapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BreezeWhite","download_url":"https://codeload.github.com/BreezeWhite/simple-fastapi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BreezeWhite%2Fsimple-fastapi/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267703073,"owners_count":24130463,"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","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["api-server","celery","distributed-computing","fastapi","fastapi-template","rabbitmq"],"created_at":"2024-10-15T06:29:25.264Z","updated_at":"2025-10-24T04:50:40.121Z","avatar_url":"https://github.com/BreezeWhite.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple FastAPI Template\n\nA simple, minimum, ready-to-go FastAPI template that could be setup in just a few minutes. Coordinates with Celery for distributed workload in the backend. Suitable for heavy computational scenarios such as machine learning, image processing, audio processing, etc.\n\nIt's easy to extend and implement more tasks. Just add tasks to `src/celery_server.py` and also the corresponding endpoints to `src/server.py`, then it's all done. No additional configurations are required.\n\n# Quick start\n``` bash\n# Clone this repo\ngit clone https://github.com/BreezeWhite/simple-fastapi.git\n\n# Install dependencies\nmake install\n\n# Start serving\nmake start\n```\nYou can play around the API from the browser by going to `http://127.0.0.1:8001/docs`.\n\n\n## Docker\nDockerfile is also provided for convenience. To build the image, run the following command:\n```bash\nmake build-docker\n```\n\nAnd to run the built image, execute following commnad:\n```bash\ndocker run -it --rm \\\n    -p 8001:8001 \\\n    -p 5672:5672 \\\n    -p 4369:4369 \\\n    -p 15672:15672 \\\n    simple-fastapi:latest\n```\n\n## Advanced\n\n### Distributed workload\n\nUsually, the picture looks like this:\n```\nRequest --\u003e Endpoint --(register task)--\u003e Broker --(dispatch task)--\u003e Worker\n            \u003cFastAPI\u003e                   \u003cRabbitMQ\u003e                   \u003cCelery\u003e\n```\nAll three serivces run on a single machine.\n\nBut with Celery, you can deploy multiple workers accross different machines to increase the computation power.\n```\n                          ------\u003e Worker (Machine 1)\n                          |\nRequest --\u003e Endpoint --\u003e Broker ---\u003e Worker (Machine 2)\n                          |\n                          ------\u003e worker (Machine 3)\n```\nTo do this, first launch the endpoint server and broker service on the same machine:\n```bash\n# It's neccessary to have a account registered to RabbitMQ for Celery to\n# login from a different machine.\nexport RABBIT_NAME=bonny\nexport RABBIT_PWD=love-carrot\nmake register-rabbit\n\n# (Optional) To make the endpoint available from anywhere, change the binding IP as following.\nexport GUNICORN_SERVE_URL=0.0.0.0:8001\n\n# Start the endpoint server\nmake start-gunicorn\n```\nAfter launching the above services, you can now launch the Celery on different machines\nand all connect to the same broker.\n```bash\n# Fill in the account information you've just setup.\nexport CELERY_BROKER_HOST=\u003cip address of the broker\u003e\nexport CELERY_BROKER_USER=bonny\nexport CELERY_BROKER_PASSWORD=love-carrot\n\n# To run in foreground\nmake start-celery-stdout\n\n# To run in background\nmake start-celery\n```\nCongratulations! You've just finished setup an distributed backend services!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbreezewhite%2Fsimple-fastapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbreezewhite%2Fsimple-fastapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbreezewhite%2Fsimple-fastapi/lists"}