Skip to main content
New Self-paced AI courses — learn ML, deep learning, and agents on your schedule. Enroll free

Python and FastAPI

Module 23 · Dependency injection and application structure

Dependency injection from first principles, Depends in depth, routers, middleware, lifespan, configuration and real project layouts.

7 lessons Follow in order
Use the button below to sign in and unlock lessons.
Your path

Lessons in sequence

Work through these in order—each lesson builds on the previous one.

  1. Lesson 1 of 7

    23.1 Dependency injection from scratch

    Enroll to open · 26 min read

  2. Lesson 2 of 7

    23.2 Depends, sub-dependencies and caching

    Enroll to open · 27 min read

  3. Lesson 3 of 7

    23.3 Dependencies with yield and cleanup

    Enroll to open · 27 min read

  4. Lesson 4 of 7

    23.4 APIRouter and modular projects

    Enroll to open · 26 min read

  5. Lesson 5 of 7

    23.5 Middleware, CORS and request hooks

    Enroll to open · 28 min read

  6. Lesson 6 of 7

    23.6 Lifespan, startup/shutdown and application state

    Enroll to open · 26 min read

  7. Lesson 7 of 7

    23.7 Configuration, environments and a production project layout

    Enroll to open · 30 min read

← Back to course