# kludex/fastapi-tips

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/kludex-fastapi-tips).**

3,432 stars · 140 forks

## Links

- GitHub: https://github.com/Kludex/fastapi-tips
- awesome-repositories: https://awesome-repositories.com/repository/kludex-fastapi-tips.md

## Tags

### Development Tools & Productivity

- [Async Route Handlers](https://awesome-repositories.com/f/development-tools-productivity/custom-task-functions/sql-function-namespaces/function-definitions/async-user-defined-functions/async-route-handlers.md) — Advises using async functions in route handlers to avoid thread pool performance penalties. ([source](https://github.com/Kludex/fastapi-tips/blob/main/README.md))
- [Web Framework Performance Tips](https://awesome-repositories.com/f/development-tools-productivity/productivity-tips/web-framework-performance-tips.md) — Provides a curated set of practical patterns for optimizing FastAPI applications.
- [Event Loop Replacements](https://awesome-repositories.com/f/development-tools-productivity/event-loop-integrations/event-loop-replacements.md) — Recommends replacing the default event loop with faster alternatives like uvloop for performance.

### Web Development

- [Async](https://awesome-repositories.com/f/web-development/route-handlers/async.md) — Advises using async functions in route handlers to avoid thread pool performance penalties. ([source](https://github.com/Kludex/fastapi-tips#readme))
- [Lifespan State Sharing](https://awesome-repositories.com/f/web-development/global-state-access/request-scoped-state/lifespan-state-sharing.md) — Provides a pattern for sharing state across requests using the ASGI lifespan protocol. ([source](https://github.com/Kludex/fastapi-tips#readme))
- [State Sharing Patterns](https://awesome-repositories.com/f/web-development/web-server-frameworks/asgi-frameworks/lifespan-integration/state-sharing-patterns.md) — Provides a pattern for sharing state across requests using the ASGI lifespan protocol.
- [Pure ASGI Middleware Implementations](https://awesome-repositories.com/f/web-development/web-server-frameworks/asgi-frameworks/middleware-libraries/pure-asgi-middleware-implementations.md) — Provides guidance on implementing middleware directly on the ASGI interface for better performance.

### Part of an Awesome List

- [Performance Optimized](https://awesome-repositories.com/f/awesome-lists/devtools/asgi-servers/performance-optimized.md) — Recommends replacing the default event loop and HTTP parser with faster alternatives for ASGI servers. ([source](https://github.com/Kludex/fastapi-tips#readme))
- [Async WebSocket Iteration Patterns](https://awesome-repositories.com/f/awesome-lists/devtools/async-and-websockets/async-websocket-iteration-patterns.md) — Ships a pattern for iterating WebSocket messages with async for loops instead of manual while loops.

### Networking & Communication

- [WebSocket Message Interception](https://awesome-repositories.com/f/networking-communication/websocket-message-interception.md) — Shows how to read WebSocket messages with an async for loop instead of a manual while loop. ([source](https://github.com/Kludex/fastapi-tips/blob/main/README.md))
- [Async Iteration Patterns](https://awesome-repositories.com/f/networking-communication/websocket-message-interception/async-iteration-patterns.md) — Shows how to read WebSocket messages with an async for loop instead of a manual while loop.

### Testing & Quality Assurance

- [Async](https://awesome-repositories.com/f/testing-quality-assurance/api-endpoint-testing/async.md) — Demonstrates testing async HTTP endpoints with an async client instead of a synchronous test client. ([source](https://github.com/Kludex/fastapi-tips#readme))
- [Async](https://awesome-repositories.com/f/testing-quality-assurance/http-request-clients/async.md) — Demonstrates testing async HTTP endpoints with an async client instead of a synchronous test client.
- [Async HTTP Test Clients](https://awesome-repositories.com/f/testing-quality-assurance/http-request-clients/async-http-test-clients.md) — Demonstrates a pattern for testing async HTTP endpoints with an async HTTP client.
- [AnyIO](https://awesome-repositories.com/f/testing-quality-assurance/integration-testing/test-marker-configurations/anyio.md) — Ships a pattern for running async tests with AnyIO markers instead of standard asyncio markers. ([source](https://github.com/Kludex/fastapi-tips#readme))
- [AnyIO Backend Test Runners](https://awesome-repositories.com/f/testing-quality-assurance/software-testing/testing-frameworks/test-frameworks/execution-and-infrastructure/test-execution-runners/custom-test-runners/anyio-backend-test-runners.md) — Ships a pattern for running async tests with AnyIO markers instead of standard asyncio markers.
