Upgrade to Pro — share decks privately, control downloads, hide ads and more …

FastAPI: Fast & Modern API Development

FastAPI: Fast & Modern API Development

A demo presentation on Python FastAPI, for Fast and Modern API Development.

This is a presentation that demonstrates:

- Basic API Endpoints: GET and POST requests.
- Dependency Injection: Cleaner and modular code.
- Background Tasks: Non-blocking operations for improved performance.

Show the advantages of FastAPI:

- Fast and Efficient: Leverages FastAPI’s asynchronous capabilities.
- Automatic Documentation: Swagger UI and ReDoc are generated automatically.
- Type-Checked Validation: Uses Pydantic models for data validation.
- Modular Design: Easily extendable for larger projects.

Author Information:

- LinkedIn: https://www.linkedin.com/in/wallaceespindola/
- GitHub: https://github.com/wallaceespindola
- E-mail: [email protected]
- Twitter: https://x.com/wsespindola
- Gravatar: https://gravatar.com/wallacese
- Dev Community Articles: https://dev.to/wallaceespindola
- DZone Articles: https://dzone.com/users/1254611/wallacese.html
- Pulse Articles: https://www.linkedin.com/in/wallaceespindola/recent-activity/articles/
- Website: https://www.wtechitsolutions.com/

Wallace Espindola

March 03, 2025
Tweet

More Decks by Wallace Espindola

Other Decks in How-to & DIY

Transcript

  1. • What is FastAPI • Advantages and disadvantages • Where

    are the good things • Being compact and simple • Top technologies used • What market says • How to start • Tricks and threats Schedule
  2. Main learning takeaways 1) Discover FastAPI as technology for APIs;

    2) Step-by-step on how to start, implement and run it; 3) Advantages and disadvantages; 4) Tips and tricks.
  3. About me • Brazilian from Rio de Janeiro • 20+

    years in IT career • Living in Belgium since 2017 • Profile: SW development & architecture • Stack: Back-end / Java / Python / APIs / Web • Speaks: English, Portuguese, French and basic Spanish • Experience in many industries: Government, Oil&Gas, Banking, Telecom, Defense, Education, MedTech.
  4. Introduction to FastAPI • Modern framework built for quick &

    efficient API development • Uses async/await for non-blocking I/O • Auto-generated interactive docs (Swagger UI & ReDoc) • Built on Starlette & Pydantic • Born in Dec, 2018 • License MIT
  5. Key Components of FastAPI • Pydantic: Data validation library that

    uses Python type hints for schema validation and serialization. • Starlette: Lightweight ASGI framework enabling async functionality in Python. • Uvicorn: Minimal ASGI server with a multi-process model for handling HTTP requests. • OpenAPI Integration: Auto-generates interactive API docs (Swagger UI & ReDoc) for real-time endpoint exploration and testing.
  6. FastAPI in Action – A Basic API Example • Define

    endpoints with minimal code • Use Pydantic for data models and validation • May be run asynchronously • Auto-documented APIs with /docs or /redoc • Simple, compact and fast
  7. Code Breakdown – What’s Happening? • Route Definitions: ◦ /

    : Welcome message, hello word! (isAlive endpoint) ◦ /items/{item_id} : Handles path & query parameters ◦ /items/ : POST endpoint with JSON body validation • Key Benefits: ◦ Reduced boilerplate code ◦ Built-in error handling via data validation
  8. Why Choosing FastAPI? Benefits: • Clean, intuitive syntax • High

    performance & scalability • Built-in data validation • Ideal for microservices, ML APIs, & real-time apps
  9. How to find me LinkedIn: https://www.linkedin.com/in/wallaceespindola/ GitHub: https://github.com/wallaceespindola E-mail: [email protected]

    Twitter: @wsespindola Gravatar: https://gravatar.com/wallacese Dev Community Articles: https://dev.to/wallaceespindola Articles DZone Articles: https://dzone.com/users/1254611/wallacese.html Pulse Articles: https://www.linkedin.com/in/wallaceespindola/recent-activity/articles/ My company: https://www.wtechitsolutions.com/ Slides: https://speakerdeck.com/wallacese Thank you!!!