{"id":25423923,"url":"https://github.com/dref360/fastapi-dependency-tutorial","last_synced_at":"2025-10-31T14:30:44.534Z","repository":{"id":241904972,"uuid":"805871475","full_name":"Dref360/fastapi-dependency-tutorial","owner":"Dref360","description":"Real-life example of Dependency Injection using FastAPI","archived":false,"fork":false,"pushed_at":"2024-08-02T14:21:01.000Z","size":37,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-08-02T16:07:49.719Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Dref360.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-05-25T17:47:38.000Z","updated_at":"2024-08-02T14:21:04.000Z","dependencies_parsed_at":"2024-05-30T17:24:07.647Z","dependency_job_id":"b95af198-443a-4125-ac2e-db3078192110","html_url":"https://github.com/Dref360/fastapi-dependency-tutorial","commit_stats":null,"previous_names":["dref360/fastapi-dependency-tutorial"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dref360%2Ffastapi-dependency-tutorial","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dref360%2Ffastapi-dependency-tutorial/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dref360%2Ffastapi-dependency-tutorial/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dref360%2Ffastapi-dependency-tutorial/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Dref360","download_url":"https://codeload.github.com/Dref360/fastapi-dependency-tutorial/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239207385,"owners_count":19599963,"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":[],"created_at":"2025-02-16T22:47:13.623Z","updated_at":"2025-10-31T14:30:44.495Z","avatar_url":"https://github.com/Dref360.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Real-life example of Dependency Injection using FastAPI\n\nAuthor: Frederic Branchaud-Charron (@Dref360)\n\n**Goal**: Provide an real-world example of a dependency injection setup.\n\nIn this tutorial, we will visit a usecase often seen in production. Your customers probably store their data in different systems which makes it hard for your system to know where to look.\n\n\nOur App will use Dependency Injection to fetch our customers' deals from multiple CRM (Salesforce or Hubspot).\n\n\u003ca href=\"https://www.youtube.com/watch?v=47pLaFosHRE\"\u003e\n  \u003cimg src=\"https://github.com/Dref360/fastapi-dependency-tutorial/assets/8976546/0ac52c33-50cc-4456-9c33-ebb7a5ee7f36\" width=\"40%\" /\u003e\n\u003c/a\u003e\n\n\n**Resources**\n\n- [FastAPI Dependencies](https://fastapi.tiangolo.com/tutorial/dependencies/)\n- [FastAPI CLI](https://fastapi.tiangolo.com/fastapi-cli/)\n- [FastAPI Errors](https://fastapi.tiangolo.com/tutorial/handling-errors/)\n- [Dependency Injection (Wiki)](https://en.wikipedia.org/wiki/Dependency_injection)\n- [Stackify](https://stackify.com/dependency-injection/)\n\n\n**Dependency Injection** (DI) is a Design Pattern well used in Industry and in particular in \"Enterprise Languages\" such as Java or C#. \n\nThe objective of using DI is to make a class independent of its dependencies.[SOLID principles]() are easily followed when using this pattern.\n\nDI has many advantages:\n* Dependencies are reusable.\n* Dependencies can be mocked, allowing easier testing of a class.\n\n\n\n**Why this tutorial?**\n\nThe most common example of DI is the \"Logger\" example which I find uninspiring and doesn't teach you why you should use DI. I wanted to propose a practical example that anyone can easily understand.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdref360%2Ffastapi-dependency-tutorial","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdref360%2Ffastapi-dependency-tutorial","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdref360%2Ffastapi-dependency-tutorial/lists"}